walsFit {WALS} | R Documentation |
Fitter function for Weighted Average Least Squares estimation
Description
Workhorse function behind wals
and walsGLM
.
Usage
walsFit(
X1,
X2,
y,
sigma = NULL,
prior = weibull(),
method = "original",
svdTol = .Machine$double.eps,
svdRtol = 1e-06,
keepUn = FALSE,
eigenSVD = TRUE,
prescale = TRUE,
postmult = FALSE,
...
)
Arguments
X1 |
Design matrix for focus regressors. Usually includes a constant
(column full of 1s) and can be generated using |
X2 |
Design matrix for auxiliary regressors. Usually does not include
a constant column and can also be generated using |
y |
Response as vector. |
sigma |
if NULL (default), then the variance of the error term is estimated, see p.136 of Magnus and De Luca (2016). If sigma is specified, then the unrestricted estimator is divided by sigma before performing the Bayesian posterior mean estimation. |
prior |
Object of class |
method |
Specifies method used. Available methods are
|
svdTol |
Tolerance for rank of matrix |
svdRtol |
Relative tolerance for rank of matrix |
keepUn |
If |
eigenSVD |
If |
prescale |
If |
postmult |
If
where
instead of
See Huynh (2024b) for more details. The latter is used
in the original MATLAB code for WALS in the linear regression model
(Magnus et al. 2010; De Luca and Magnus 2011; Kumar and Magnus 2013; Magnus and De Luca 2016),
see eq. (12) of Magnus and De Luca (2016).
The first form is required in eq. (9) of De Luca et al. (2018).
It is not recommended to set |
... |
Arguments for internal function |
Value
A list containing
coef |
Model averaged estimates of all coefficients. |
beta1 |
Model averaged estimates of the coefficients of the focus regressors. |
beta2 |
Model averaged estimates of the coefficients of the auxiliary regressors. |
gamma1 |
Model averaged estimates of the coefficients of the transformed focus regressors. |
gamma2 |
Model averaged estimates of the coefficients of the transformed auxiliary regressors. |
vcovBeta |
Estimated covariance matrix of the regression coefficients. |
vcovGamma |
Estimated covariance matrix of the coefficients of the transformed regressors. |
sigma |
Estimated or prespecified standard deviation of the error term. |
prior |
|
method |
Stores |
betaUn1 |
If |
betaUn2 |
If |
gammaUn1 |
If |
gammaUn2 |
If |
fitted.values |
Estimated conditional means of the data. |
residuals |
Residuals, i.e. response - fitted mean. |
X1names |
Names of the focus regressors. |
X2names |
Names of the auxiliary regressors. |
k1 |
Number of focus regressors. |
k2 |
Number of auxiliary regressors. |
n |
Number of observations. |
condition |
Condition number of the matrix
|
References
De Luca G, Magnus JR (2011).
“Bayesian model averaging and weighted-average least squares: Equivariance, stability, and numerical issues.”
The Stata Journal, 11(4), 518–544.
doi:10.1177/1536867X1201100402.
De Luca G, Magnus JR, Peracchi F (2018).
“Weighted-average least squares estimation of generalized linear models.”
Journal of Econometrics, 204(1), 1–17.
doi:10.1016/j.jeconom.2017.12.007.
Huynh K (2024b).
“WALS: Weighted-Average Least Squares Model Averaging in R.”
University of Basel.
Mimeo.
Kumar K, Magnus JR (2013).
“A characterization of Bayesian robustness for a normal location parameter.”
Sankhya B, 75(2), 216–237.
doi:10.1007/s13571-013-0060-9.
Magnus JR, De Luca G (2016).
“Weighted-average least squares (WALS): A survey.”
Journal of Economic Surveys, 30(1), 117-148.
doi:10.1111/joes.12094.
Magnus JR, Powell O, Prüfer P (2010).
“A comparison of two model averaging techniques with an application to growth empirics.”
Journal of Econometrics, 154(2), 139-153.
doi:10.1016/j.jeconom.2009.07.004.
See Also
Examples
X <- model.matrix(gdpgrowth ~ lgdp60 + equipinv + school60 + life60 + popgrowth
+ law + tropics + avelf + confucian, data = GrowthMPP)
X1 <- X[, c("(Intercept)", "lgdp60", "equipinv", "school60", "life60", "popgrowth")]
X2 <- X[, c("law", "tropics", "avelf", "confucian")]
y <- GrowthMPP$gdpgrowth
walsFit(X1, X2, y, prior = weibull(), method = "svd")