avm.fwls | R Documentation |
This function applies feasible weighted least squares (FWLS) to a
linear regression model using error variance estimates obtained
from an auxiliary linear variance model fit using alvm.fit
or from an auxiliary nonlinear variance model fit using
anlvm.fit
.
avm.fwls(object, fastfit = FALSE)
object |
Either an object of class |
fastfit |
A logical. If |
The function simply calculates
\hat{\beta}=(X'\hat{\Omega}^{-1}X)^{-1}X'\hat{\Omega}^{-1}y
,
where X
is the design matrix, y
is the response vector, and
\hat{\Omega}
is the diagonal variance-covariance matrix of the
random errors, whose diagonal elements have been estimated by an
auxiliary variance model.
Either an object of class
"lm"
(if fastfit
is FALSE
) or otherwise a generic
list object
alvm.fit
, anlvm.fit
,
avm.vcov
mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
myalvm <- alvm.fit(mainlm = mtcars_lm, model = "linear",
varselect = "qgcv.linear")
myfwls <- avm.fwls(myalvm)
cbind(coef(mtcars_lm), coef(myfwls))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.