Description Usage Arguments Value Examples
Used in main function miss.saem. Calculate the variance of estimated parameters for logistic regression model with missing data, using Monte Carlo version of Louis formula.
1 2 3 4 5 6 7 8 9 10 11 |
beta |
Estimated parameter of logistic regression model. |
mu |
Estimated parameter μ. |
Sigma |
Estimated parameter Σ. |
Y |
Response vector N * 1 |
X.obs |
Design matrix with missingness N * p |
pos_var |
Index of selected covariates. |
rindic |
Missing pattern of X.obs. If a component in X.obs is missing, the corresponding position in rindic is 1; else 0. |
whichcolXmissing |
The column index in covariate containing at least one missing observation. |
mc.size |
Monte Carlo sampling size. |
Variance of estimated β.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Generate dataset
N <- 50 # 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
# Louis formula to obtain variance of estimates
V_obs = louis_lr_saem(beta.true,mu.star,Sigma.star,y,X.obs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.