This function prepares data, specifies hyperparameters in priors (true positive rates and etiology fractions), initializes the posterior sampling chain, writes the model file (for JAGS or WinBUGS with slight differences in syntax), and fits the model. Features:
no regression;
no nested subclasses
Arguments
- data_nplcm
Cases are on top of controls in the rows of diagnostic test results and the covariate matrix. This is assumed by
bakerto automatically write model files (.bug).MobsA list of measurements of distinct qualities (Bronze-, Silver, and Gold-Standard:MBS,MSS,MGS). The elements of the list should includeMBS,MSS, andMGS. If any of the component is not available, please specify it as, e.g.,MGS=NULL(effectively deletingMGSfromMobs).MBSa list of data frame of bronze-standard (BrS) measurements. For each data frame (referred to as a 'slice'), rows are subjects, columns are causative agents (e.g., pathogen species). We uselisthere to accommodate the possibility of multiple sets of BrS data. They have imperfect sensitivity/specificity (e.g. nasopharyngeal polymerase chain reaction - NPPCR).MSSa list of data frame of silver-standard (SS) measurements. Rows are subjects, columns are causative agents measured in specimen (e.g. blood culture). These measurements have perfect specificity but imperfect sensitivity.MGSa list of data frame of gold-standard (GS) measurements. Rows are subject, columns are measured causative agents These measurements have perfect sensitivity and specificity.
YVector of disease status:1for case,0for control.XCovariate matrix. A subset of columns are primary covariates in cause-specific- case-fraction (CSCF) functions and hence must be available for cases, and another subset are covariates that are available in the cases and the controls. The two sets of covariates may be identical, overlapping or completely different. In general, this is not the design matrix for regression models, because for enrollment date in a study which may have non-linear effect, basis expansion is often needed for approximation.
- model_options
A list of model options: likelihood and prior.
use_measurementsA vector of characters strings; can be one or more from
"BrS","SS","GS".likelihood-
- cause_list
The vector of causes (NB: specify);
- k_subclass
The number of nested subclasses in each disease class (one of case classes or the control class; the same
k_subclassis assumed for each class) and each slice of BrS measurements.1for conditional independence; larger than1for conditional dependence. It is only available for BrS measurements. It is a vector of length equal to the number of slices of BrS measurements;- Eti_formula
Formula for etiology regressions. You can use
s_date_Eti()to specify the design matrix forRformat enrollment date; it will produce natural cubic spline basis. Specify~ 1if no regression is intended.- FPR_formula
formula for false positive rates (FPR) regressions; see
formula(). You can uses_date_FPR()to specify part of the design matrix forRformat enrollment date; it will produce penalized-spline basis (based on B-splines). Specify~ 1if no regression is intended. (NB: Ifeffect="fixed",dm_Rdate_FPR()will just specify a design matrix with appropriately standardized dates.)
prior-
- Eti_prior
Description of etiology prior (e.g.,
overall_uniform- all hyperparameters are1; or0_1- all hyperparameters are0.1);- TPR_prior
Description of priors for the measurements (e.g., informative vs non-informative). Its length should be the same as
use_measurementsabove. Please see examples for how to specify. The package can also handle multiple slices of BrS, SS data, so separate specification of the TPR priors are needed.
- mcmc_options
A list of Markov chain Monte Carlo (MCMC) options.
debugstatusLogical - whether to pause WinBUGS after it finishes model fitting; (NB: is this obsolete? Test.)n.chainsNumber of MCMC chains;n.burninNumber of burn-in iterations;n.thinTo keep every othern.thinsamples after burn-in period;individual.predTRUEto perform individual prediction (Icatvariables in the.bugfile);FALSEotherwise;ppdTRUEto simulate new data (XXX.newvariables in the.bugfile) from the posterior predictive distribution (ppd);FALSEotherwise;get.pEtiTRUEfor getting posterior samples of individual etiologic fractions;FALSEotherwise. For non-regression, or regression models with all discrete predictors, by default this isTRUE, so no need to specify this entry. It is only relevant for regression models with non-discrete covariates. Because individuals have distinct CSCFs at their specific covariate values, it's easier to just store the posterior samples of the regression coefficients and reconstruct the pies afterwards, rather than storing them throughJAGS.result.folderPath to folder storing the results;bugsmodel.dirPath to.bugmodel files;jags.dirPath to where JAGS is installed; ifNULL, this will be set tojags.dir="".
See also
write_model_NoReg for constructing .bug model file; This function
then put it in the folder mcmc_options$bugsmodel.dir.
Other model fitting functions:
nplcm_fit_Reg_Nest(),
nplcm_fit_Reg_NoNest(),
nplcm_fit_Reg_discrete_predictor_NoNest()