icdglm {icdGLM} | R Documentation |
EM by the Method of Weights for Incomplete Data in GLMs
Description
This function applies the EM algorithm by the method of weights to incomplete data in a general linearized model.
Usage
icdglm(formula, family = binomial(link = "logit"), data, weights = rep.int(1, NROW(data)),
indicator = rep.int(0, NROW(data)), control = list(), model = TRUE)
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. |
family |
a description of the error distribution and link function to be used in the model. This can be a character string naming a family function, a family function or the result of a call to a family function. (See |
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. If not found in data, the variables are taken from environment(formula) |
weights |
a vector which attaches a weight to each observation. For incomplete data, this is obtained from |
indicator |
a vector that indicates which observations belong to each other. This is obtained from |
control |
a list of control characteristics used for the iteration process in icdglm.fit. See |
model |
a logical value indicating whether model frame should be included as a component of the returned value. |
Value
icdglm returns an object of class inheriting from "icdglm.fit", "glm" and "lm". The function summary.icdglm can be used to obtain a summary of the results.
icdglm
returns a list with the following elements:
xa matrix of numerics containing all independent variables
ya vector of numerics containing the dependent variable
new.weightsthe new weights obtained in the final iteration of icdglm.fit
indicatora vector of integers indicating which observations belong to each other
glm.fit.datatypical
glm.fit
output for the last iteration. Seeglm.fit
for further information.coefficientsa named vector of coefficients
qrQR Decomposition of the information matrix
residualsthe residuals of the final iteration
fitted.valuesthe fitted mean values, obtained by transforming the linear predictors by the inverse of the link function.
rankthe numeric rank of the fitted linear model
familythe family object used.
linear.predictorsthe linear fit on link scale
devianceup to a constant, minus twice the maximized log-likelihood. Where sensible, the constant is chosen so that a saturated model has deviance zero.
aicsee glm
null.devianceThe deviance for the null model, comparable with deviance. The null model will include the offset, and an intercept if there is one in the model. Note that this will be incorrect if the link function depends on the data other than through the fitted mean: specify a zero offset to force a correct calculation.
iteran integer containing the number of iterations in icdglm.fit before convergence
weightsthe working weights, that is the weights in the final iteration of the IWLS fit.
prior.weightsthe weights initially supplied, a vector of 1s if none were.
df.residualthe residual degrees of freedom from the initial data set
df.nullthe residual degrees of freedom from initial data set for the null model
modelmodel frame
convergedTRUE if icdglm converged.
callthe match call
formulathe formula supplied
termsthe terms object used
datathe data argument
controlthe value of the control argument used
References
Ibrahim, Joseph G. (1990). Incomplete Data in Generalized Linear Models. Journal of the American Statistical Association, Vol.85, No. 411, pp. 765 - 769.
See Also
expand_data
, icdglm.fit
, glm
, glm.fit
, glm.control
, summary.glm
Examples
data(TLI.data)
complete.data <- expand_data(data = TLI.data[,1:3],
y = TLI.data[,4],
missing.x = 1:3,
value.set = 0:1)
example <- icdglm(y ~ x1 + x2 + x3, family = binomial(link = "logit"),
data = complete.data$data, weights = complete.data$weights,
indicator = complete.data$indicator)
summary(example)