walsGLMfit | R Documentation |
Workhorse function behind walsGLM
and used internally in
walsGLMfitIterate
.
walsGLMfit(
X1,
X2,
y,
betaStart1,
betaStart2,
family,
prior = weibull(),
postmult = TRUE,
...
)
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. |
betaStart1 |
Starting values for coefficients of focus regressors X1. |
betaStart2 |
Starting values for coefficients of auxiliary regressors X2. |
family |
Object of class |
prior |
Object of class |
postmult |
If
where
instead of
See \insertCitehuynhwals;textualWALS for more details. The latter is used
in the original MATLAB code for WALS in the linear regression model,
see eq. (12) of \insertCitemagnus2016wals;textualWALS.
The first form is required in eq. (9) of \insertCitedeluca2018glm;textualWALS.
Thus, it is not recommended to set |
... |
Further arguments passed to |
Uses walsFit
under the hood after transforming the regressors
X1
and X2
and the response y
. For more details, see
\insertCitehuynhwalsWALS and \insertCitedeluca2018glm;textualWALS.
A list containing all elements returned by walsFit
,
except for residuals
, and additionally (some fields are replaced)
condition |
Condition number of the matrix
|
family |
Object of class |
betaStart |
Starting values of the regression coefficients for the one-step ML estimators. |
fitted.link |
Linear link fitted to the data. |
fitted.values |
Estimated conditional mean for the data. Lives on the scale of the response. |
walsGLM, walsGLMfitIterate, walsFit.
data("HMDA", package = "AER")
X <- model.matrix(deny ~ pirat + hirat + lvrat + chist + mhist + phist + selfemp + afam,
data = HMDA)
X1 <- X[,c("(Intercept)", "pirat", "hirat", "lvrat", "chist2", "chist3",
"chist4", "chist5", "chist6", "mhist2", "mhist3", "mhist4", "phistyes")]
X2 <- X[,c("selfempyes", "afamyes")]
y <- HMDA$deny
# starting values from glm.fit()
betaStart <- glm.fit(X, y, family = binomialWALS())$coefficients
k1 <- ncol(X1)
k2 <- ncol(X2)
str(walsGLMfit(X1, X2, y,
betaStart1 = betaStart[1:k1],
betaStart2 = betaStart[(k1 + 1):(k1 + k2)],
family = binomialWALS(), prior = weibull()))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.