likelihood_saem {misaem} | R Documentation |
likelihood_saem
Description
Used in main function miss.saem. Calculate the observed log-likelihood for logistic regression model with missing data, using Monte Carlo version of Louis formula.
Usage
likelihood_saem(
beta,
mu,
Sigma,
Y,
X.obs,
rindic = as.matrix(is.na(X.obs)),
whichcolXmissing = (1:ncol(rindic))[apply(rindic, 2, sum) > 0],
mc.size = 2
)
Arguments
beta |
Estimated parameter of logistic regression model. |
mu |
Estimated parameter |
Sigma |
Estimated parameter |
Y |
Response vector |
X.obs |
Design matrix with missingness |
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. |
Value
Observed log-likelihood.
Examples
# 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
# Observed log-likelihood
ll_obs = likelihood_saem(beta.true,mu.star,Sigma.star,y,X.obs)
[Package misaem version 1.0.1 Index]