simulate_data: simulate data from restricted latent class models

Description Usage Arguments Value Examples

View source: R/simulate.R

Description

This function takes in options_sim and simulate as specified by the options. NB: currently only supports logical "Or", or DINO model. Other restricted latent class models need to be added. NB: alpha1 needs to be update

Usage

1
simulate_data(options_sim, SETSEED = FALSE)

Arguments

options_sim

options for simulating data:

  • N - sample size;

  • M - number of machines;

  • L - number of protein landmarks;

  • K - number of ture components;

  • alpha1 - hyperparameter for determining the machine prevalence p_m; (NB: delete?)

  • theta - true positive rates for all protein landmarks;

  • psi - false positive rates for all protein landmarks.

  • frac - Percentage of (L-2M) dimensions that are positive in Q; See simulate_Q.

  • pop_frac - population prevalences of the K components.

SETSEED

FALSE by default; Set to TRUE if to fix random number generation.

Value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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.
)

simu     <- simulate_data(options_sim0, SETSEED=TRUE)
simu_dat <- simu$datmat
image(simu_dat)

oslerinhealth/rewind documentation built on May 26, 2021, 6:56 a.m.