Description Usage Arguments Value Examples
This R function computes the marginal likelihood by integrating over the distribution of component specific parameter (e.g., machine usage profiles). This function conditions upon a few model parameters: the true and false positive rates (theta and psi), the Q matrix and p-the prevalence parameter for each machines.
1 | log_marginal(Y, eta_star_enumerate, Q, p, theta, psi)
|
Y |
the data for the current cluster (a subset of observations.) |
eta_star_enumerate |
fixed binary matrix of 2^M rows and M columns. Need to be prespecified. |
Q |
Q-matrix |
p |
prevalence parameter for each machine; should be a vector of dimension M. |
theta |
true positive rates |
psi |
true positive rates |
log of marginal likelihood given other model parameters.
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 | # simulate data:
L0 <- 100
options_sim0 <- list(N = 200, # sample size.
M = 3, # true number of machines.
L = L0, # number of antibody landmarks.
K = 8, # number of true components.,
theta = rep(0.8,L0), # true positive rates
psi = rep(0.01,L0), # false positive rates
alpha1 = 1, # half of the people have the first machine.
frac = 0.2, # fraction of positive dimensions (L-2M) in Q.
#pop_frac = rep(1/K0,K0) # population prevalences.
#pop_frac = (1:K0)/sum(1:K0) # population prevalences.
pop_frac = c(rep(2,4),rep(1,4)) # population prevalences.
)
simu <- simulate_data(options_sim0, SETSEED=TRUE)
simu_dat <- simu$datmat
Y <- simu_dat
Q <- simu$Q
p <- c(0.5,0.25,0.1,0.02,0.05)
theta <- options_sim0$theta
psi <- options_sim0$psi
H_enumerate <- as.matrix(expand.grid(rep(list(0:1), options_sim0$M)),ncol=options_sim0$M)
#log_marginal0(Y, Q, p, theta, psi)
log_marginal(Y,H_enumerate, Q, p, theta, psi) # <-- this is the Rcpp implementation.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.