icdglm: EM by the Method of Weights for Incomplete Data in GLMs

Description Usage Arguments Value References See Also Examples

View source: R/icdglm.R

Description

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

Usage

1
2
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 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.

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:

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

1
2
3
4
5
6
7
8
9
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)

Example output

[1] 25

Family: binomial 
Link function: logit 

  [1] 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0
 [38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  [1] 0.8294499084 0.1705500916 0.6742940260 0.3257059740 0.4754229237
  [6] 0.9944807715 0.5107607807 0.5107607807 0.3468240125 0.9946596911
 [11] 0.9946596911 0.9946596911 0.9946596911 0.3881737180 0.0832408019
 [16] 0.2557721190 0.0548483200 0.1235462631 0.0852078943 0.5245770763
 [21] 0.0055192285 0.4892392193 0.4892392193 0.6531759875 0.0053403089
 [26] 0.0053403089 0.0053403089 0.0053403089 0.3718175199 0.1567679602
 [31] 0.2449948323 0.1032962087 0.1318768832 0.0004574796 1.0000000000
 [36] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [41] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [46] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [51] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [56] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [61] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [66] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [71] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [76] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [81] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [86] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [91] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
 [96] 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
[101] 1.0000000000 1.0000000000 1.0000000000
  [1] 0.2073504599 0.0426295106 0.1685603970 0.0784739771 0.1145533086
  [6] 0.2373164110 0.1276719906 0.1276719906 0.0866811769 0.2373673708
 [11] 0.2373673708 0.2373673708 0.2373673708 0.0970287079 0.0208048437
 [16] 0.0639332973 0.0137085435 0.0297644061 0.0203331450 0.1271397255
 [21] 0.0015985198 0.1222477336 0.1222477336 0.1633018425 0.0015472166
 [26] 0.0015472166 0.0015472166 0.0015472166 0.0929063577 0.0391950068
 [31] 0.0612170348 0.0258260269 0.0319676485 0.0001325362 0.2499848359
 [36] 0.2499848359 0.2499848359 0.2499848359 0.2499848359 0.2499848359
 [41] 0.2499848359 0.2499848359 0.2499848359 0.2499848359 0.2498517596
 [46] 0.2498517596 0.2498517596 0.2498517596 0.2498517596 0.2498517596
 [51] 0.2498517596 0.2498517596 0.2498517596 0.2498517596 0.2409264904
 [56] 0.2409264904 0.2409264904 0.2409264904 0.2409264904 0.2409264904
 [61] 0.2423878819 0.2423878819 0.2499972003 0.2499972003 0.2499972003
 [66] 0.2499972003 0.2499972003 0.2499972003 0.2499972003 0.2499563077
 [71] 0.2499848359 0.2499848359 0.2499848359 0.2499848359 0.2499848359
 [76] 0.2499848359 0.2499848359 0.2499848359 0.2499848359 0.2498517596
 [81] 0.2498517596 0.2498517596 0.2498517596 0.2498517596 0.2498517596
 [86] 0.2498517596 0.2498517596 0.2498517596 0.2498517596 0.2409264904
 [91] 0.2409264904 0.2423878819 0.2423878819 0.2423878819 0.2423878819
 [96] 0.2423878819 0.2423878819 0.2423878819 0.2499563077 0.2499563077
[101] 0.2499563077 0.2499972003 0.2389042285
  [1] 0.4961059 0.5066100 0.4961059 0.5952550 0.5952550 0.6053365 0.4961059
  [8] 0.4961059 0.5066100 0.6053365 0.6053365 0.6053365 0.6053365 0.4961059
 [15] 0.5066100 0.4961059 0.5066100 0.5952550 0.6053365 0.5872475 0.5973935
 [22] 0.4878246 0.4878246 0.4983268 0.5973935 0.5973935 0.5973935 0.5973935
 [29] 0.4878246 0.4983268 0.4878246 0.4983268 0.5872475 0.5973935 0.4961059
 [36] 0.4961059 0.4961059 0.4961059 0.4961059 0.4961059 0.4961059 0.4961059
 [43] 0.4961059 0.4961059 0.4878246 0.4878246 0.4878246 0.4878246 0.4878246
 [50] 0.4878246 0.4878246 0.4878246 0.4878246 0.4878246 0.5952550 0.5952550
 [57] 0.5952550 0.5952550 0.5952550 0.5952550 0.5872475 0.5872475 0.4983268
 [64] 0.4983268 0.4983268 0.4983268 0.4983268 0.4983268 0.4983268 0.5066100
 [71] 0.4961059 0.4961059 0.4961059 0.4961059 0.4961059 0.4961059 0.4961059
 [78] 0.4961059 0.4961059 0.4878246 0.4878246 0.4878246 0.4878246 0.4878246
 [85] 0.4878246 0.4878246 0.4878246 0.4878246 0.4878246 0.5952550 0.5952550
 [92] 0.5872475 0.5872475 0.5872475 0.5872475 0.5872475 0.5872475 0.5872475
 [99] 0.5066100 0.5066100 0.5066100 0.4983268 0.6053365
            (Intercept)       x1       x2       x3
(Intercept)   19.198062 4.584282 5.671776 9.504484
x1             4.584282 4.584282 1.428576 2.114663
x2             5.671776 1.428576 5.671776 2.235075
x3             9.504484 2.114663 2.235075 9.504484
Warning message:
icdglm.fit: algorithm did not converge 

Call:
icdglm(formula = y ~ x1 + x2 + x3, family = binomial(link = "logit"), 
    data = complete.data$data, weights = complete.data$weights, 
    indicator = complete.data$indicator)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.3591  -1.1708   0.3747   1.0318   1.1982  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.01558    0.39124  -0.040    0.968
x1           0.04202    0.53576   0.078    0.937
x2           0.40131    0.50464   0.795    0.426
x3          -0.03313    0.46073  -0.072    0.943

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 113.48  on 81  degrees of freedom
Residual deviance: 112.77  on 78  degrees of freedom
AIC: 118.15

Number of Fisher Scoring iterations: 25

icdGLM documentation built on May 2, 2019, 9:16 a.m.

Related to icdglm in icdGLM...