subset_data_nplcm_by_index | R Documentation |
clean_perch_data()
It is particularly useful in simulating data from a regression model where one generates a case and control at a particular covariate value, and just choose a case or control to retain in the simulated data.
subset_data_nplcm_by_index(data_nplcm, index)
data_nplcm |
data for fitting nplcm; See |
index |
a vector of indices indicating the observations you hope to subset; it will subset in all the sublists of data_nplcm |
a list with the requested data, in the order determined by 'index'
Other data operation functions:
combine_data_nplcm()
,
merge_lists()
J = 3 # number of causes
cause_list = c(LETTERS[1:J]) # cause list
K = 2 # number of subclasses
lambda = c(1,0) # subclass weights for control group
eta = c(1,0) # subclass weights for case group
# setup parameters for the present individual:
set_parameter <- list(
cause_list = cause_list,
etiology = c(0.5,0.2,0.3), # only meaningful for cases
pathogen_BrS = LETTERS[1:J],
pathogen_SS = LETTERS[1:2],
meas_nm = list(MBS = c("MBS1"),MSS=c("MSS1")),
Lambda = lambda, # for BrS
Eta = t(replicate(J,eta)), # case subclass weight for BrS
PsiBS = cbind(c(0.15,0.3,0.35),
c(0.25,0.2,0.15)), # FPR
PsiSS = cbind(rep(0,J),rep(0,J)),
ThetaBS = cbind(c(0.95,0.9,0.85), # TPR
c(0.95,0.9,0.85)),
ThetaSS = cbind(c(0.25,0.10),
c(0.25,0.10)),
Nd = 5,
Nu = 3
)
simu_out <- simulate_nplcm(set_parameter)
out <- simu_out$data_nplcm
out
subset_data_nplcm_by_index(out,c(1,4,5))
subset_data_nplcm_by_index(out,2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.