tls {tls} | R Documentation |
Fitting error-in-variables models via total least squares.
Description
It can be used to carry out regression models that account for measurement errors in the independent variables.
Usage
tls(formula, data, method = c("normal", "bootstrap"), conf.level = 0.95,
...)
Arguments
formula |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. |
data |
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. |
method |
method for computing confidence interval |
conf.level |
the confidence level for confidence interval. |
... |
Optional arguments for future usage. |
Details
This function should be used with care. Confidence interval estimation is given by normal approximation or bootstrap. The normal approximation and bootstrap are proper when all the error terms are independent from normal distribution with zero mean and equal variance (see the references for more details).
Value
tls
returns parameters of the fitted model including
estimations of coefficient, corresponding estimated standard errors
and confidence intervals.
Author(s)
Yan Li
References
Gleser, Estimation in a Multivariate "Errors in Variables" Regression Model: Large Sample Results, 1981, Ann. Stat.
Golub and Laon, An Analysis of the Total Least Squares Problem, 1980, SIAM J. Numer. Anal.
Pesta, Total least squares and bootstrapping with applications in calibration, 2012, Statistics.
Examples
library(tls)
set.seed(100)
X.1 <- sqrt(1:100)
X.tilde.1 <- rnorm(100) + X.1
X.2 <- sample(X.1, size = length(X.1), replace = FALSE)
X.tilde.2 <- rnorm(100) + X.2
Y <- rnorm(100) + X.1 + X.2
data <- data.frame(Y = Y, X.1 = X.tilde.1, X.2 = X.tilde.2)
tls(Y ~ X.1 + X.2 - 1, data = data)