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_Q_identity(Y, p, theta, psi)
|
Y |
the data for the current cluster (a subset of observations.) |
p |
prevalence parameter for each machine; should be a vector of dimension M=L. |
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 | # 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 <- rep(0.5,L0) #<----- M must equal L.
theta <- options_sim0$theta
psi <- options_sim0$psi
log_marginal_Q_identity(Y, 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.