walsGLMfitIterate {WALS} | R Documentation |
Iteratively fitting walsGLM, internal function for walsGLM.formula and walsGLM.matrix.
Description
Wrapper around walsGLMfit
that allows iteratively
(re-)fitting walsGLM
models.
Usage
walsGLMfitIterate(
y,
X1,
X2,
family,
na.action = NULL,
weights = NULL,
offset = NULL,
prior = weibull(),
controlInitGLM = controlGLM(),
keepY = TRUE,
keepX = FALSE,
iterate = FALSE,
tol = 1e-06,
maxIt = 50,
nIt = NULL,
verbose = FALSE,
...
)
Arguments
y |
Response as vector. |
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 |
family |
Object of class |
na.action |
Not implemented yet. |
weights |
Not implemented yet. |
offset |
Not implemented yet. |
prior |
Object of class |
controlInitGLM |
Controls estimation of starting values for one-step ML,
see |
keepY |
If |
keepX |
If |
iterate |
if |
tol |
Only used if |
maxIt |
Only used if |
nIt |
Only used if |
verbose |
If |
... |
Arguments to be passed to the workhorse function |
Details
The parameter tol
is used to control the convergence of the iterative
fitting algorithm. Let i
be the current iteration step for the
coefficient vector \beta_{i} = (\beta_{i,1}, \ldots, \beta_{i,k})', k > 0
.
If
\frac{||\beta_{i} - \beta_{i-1}||_{2}}{\sqrt{k}}
= \sqrt{\frac{\sum_{j = 1}^{k} (\beta_{i,j} - \beta_{i-1,j})^{2}}{k}} < \texttt{tol},
then the fitting process is assumed to have converged and stops.
Value
A list containing all elements returned from walsGLMfit
and additionally the following elements:
y |
If |
x |
list. If |
initialFit |
List containing information (e.g. convergence) on the
estimation of the starting values for |
weights |
returns the argument |
offset |
returns the argument |
converged |
Logical. Only relevant if |
it |
Number of iterations run in the iterative fitting algorithm.
|
deviance |
Deviance of the fitted regression model. |
residuals |
Raw residuals, i.e. response - fitted mean. |
See Also
Examples
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
str(walsGLMfitIterate(y, X1, X2, family = binomialWALS(), prior = weibull(),
iterate = TRUE))