Learn R Programming

icdGLM (version 1.0.2)

icdglm: 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)

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:

x

a matrix of numerics containing all independent variables

y

a vector of numerics containing the dependent variable

new.weights

the new weights obtained in the final iteration of icdglm.fit

indicator

a vector of integers indicating which observations belong to each other

glm.fit.data

typical glm.fit output for the last iteration. See glm.fit for further information.

coefficients

a named vector of coefficients

qr

QR Decomposition of the information matrix

residuals

the residuals of the final iteration

fitted.values

the fitted mean values, obtained by transforming the linear predictors by the inverse of the link function.

rank

the numeric rank of the fitted linear model

family

the family object used.

linear.predictors

the linear fit on link scale

deviance

up to a constant, minus twice the maximized log-likelihood. Where sensible, the constant is chosen so that a saturated model has deviance zero.

aic

see glm

null.deviance

The 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.

iter

an integer containing the number of iterations in icdglm.fit before convergence

weights

the working weights, that is the weights in the final iteration of the IWLS fit.

prior.weights

the weights initially supplied, a vector of 1s if none were.

df.residual

the residual degrees of freedom from the initial data set

df.null

the residual degrees of freedom from initial data set for the null model

model

model frame

converged

TRUE if icdglm converged.

call

the match call

formula

the formula supplied

terms

the terms object used

data

the data argument

control

the value of the control argument used

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 family for details of family functions.)

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 expand_data.

indicator

a vector that indicates which observations belong to each other. This is obtained from expand_data.

control

a list of control characteristics used for the iteration process in icdglm.fit. See glm.control for further information how this works. Default settings are: epsilon = 1e-10, maxit = 100, trace = FALSE.

model

a logical value indicating whether model frame should be included as a component of the returned value.

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

Run this code
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)

Run the code above in your browser using DataLab