Learn R Programming

icdGLM (version 1.0.0)

icdglm.fit: EM by the Method of Weights for Incomplete Data in GLMs (Algorithm)

Description

This function applies the EM algorithm by the method of weights to incomplete data in a general linearized model.

Usage

icdglm.fit(x, y, weights = rep.int(1, NROW(x)), indicator = rep.int(0, NROW(x)), family = binomial(link = "logit"), control=list())

Arguments

x
a vector, matrix, list or data frame containing the independent variables
y
a vector of integers or numerics. This is the dependent variable.
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.
family
family for glm.fit. See glm or family for more details. Default is binomial(link = "logit").
control
a list of control characteristics. See glm.control for further information. Default settings are: epsilon = 1e-10, maxit = 100, trace = FALSE.

Value

icdglm.fit 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. See glm.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 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)
          example1 <- icdglm.fit(x = complete.data$data[, 1:3],
                                 y = complete.data$data[, 4],
                                 weights = complete.data$weights,
                                 indicator = complete.data$indicator,
                                 family = binomial(link = "logit"),
                                 control = list(epsilon = 1e-10,
                                                maxit = 100, trace = TRUE))

Run the code above in your browser using DataLab