Description Usage Arguments Value Examples
This function is used to perform statistical inference for logistic regression model with missing values, by algorithm SAEM.
1 |
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. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.