Description Usage Arguments Value Examples
View source: R/miss.glm.model.select.R
Model selection for the logistic regression model with missing data.
1 | miss.glm.model.select(Y, X, seed = NA)
|
Y |
Binary response vector N * 1 |
X |
Design matrix with missingness N * p |
seed |
An integer as a seed set for the random generator. The default value is 200. |
An object of class "miss.glm
".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Generate dataset
N <- 40 # 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 <- X.complete
X[patterns] <- NA
# model selection for SAEM
miss.model = miss.glm.model.select(Y,X,seed=100)
print(miss.model)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.