miss.glm {misaem} | R Documentation |
This function is used to perform statistical inference for logistic regression model with missing values, by algorithm SAEM.
miss.glm(formula, data, control = list(...), ...)
formula |
an object of class " |
data |
an optional data frame containing the variables in the model. If not found in |
control |
a list of parameters for controlling the fitting process. For |
... |
arguments to be used to form the default control argument if it is not supplied directly. |
An object of class "miss.glm
": a list with following components:
coefficients |
Estimated |
ll |
Observed log-likelihood. |
var.covar |
Variance-covariance matrix for estimated parameters. |
s.err |
Standard error for estimated parameters. |
mu.X |
Estimated |
Sig.X |
Estimated |
call |
the matched call. |
formula |
the formula supplied. |
# Generate dataset
N <- 100 # number of subjects
p <- 3 # number of explanatory variables
mu.star <- rep(0,p) # mean of the explanatory variables
Sigma.star <- diag(rep(1,p)) # covariance
beta.star <- c(1, 1, 0) # coefficients
beta0.star <- 0 # intercept
beta.true = c(beta0.star,beta.star)
X.complete <- matrix(rnorm(N*p), nrow=N)%*%chol(Sigma.star) +
matrix(rep(mu.star,N), nrow=N, byrow = TRUE)
p1 <- 1/(1+exp(-X.complete%*%beta.star-beta0.star))
y <- as.numeric(runif(N)<p1)
# Generate missingness
p.miss <- 0.10
patterns <- runif(N*p)<p.miss #missing completely at random
X.obs <- X.complete
X.obs[patterns] <- NA
df.obs = data.frame(y,X.obs)
# SAEM
miss.list = miss.glm(y~., data=df.obs, print_iter=FALSE,seed=100)
print(miss.list)
print(summary(miss.list))
summary(miss.list)$coef