nplcm_fit_NoReg: Fit nested partially-latent class model (low-level)

Description Usage Arguments Details Value See Also

View source: R/nplcm-fit-NoReg.R

Description

Fit nested partially-latent class model (low-level)

Usage

1
nplcm_fit_NoReg(data_nplcm, model_options, mcmc_options)

Arguments

data_nplcm

Must put cases at the top in 'Mobs$MBS' and control data at the bottom (this is related to the coding scheme in JAGS).

  • Mobs A list of measurements. The elements of the list should include MBS, MSS, and MGS. If any of the component is not available, please specify it as, e.g., MGS=NULL (effectively deleting MGS from Mobs).

    • MBS a list of data frame of bronze-standard (BrS) measurements. Rows are subjects, columns are pathogens. We use list here to accommodate the possibility of multiple sets of BrS data. They have imperfect sensitivity/specificity (e.g. nasopharyngeal PCR).

    • MSS a list of data frame of silver-standard (SS) measurements. Rows are subjects, columns are pathogens measured in specimen (e.g. blood culture). These measurements have perfect specificity but imperfect sensitivity.

    • MGS a list of data frame of gold-standard (GS) measurements. Rows are subject, columns are pathogen measurements. These measurements have perfect sensitivity and specificity.

  • Y Vector of disease status: 1 for case, 0 for control.

  • X Covariate matrix for regression modeling. It contains raw covariate data, not design matrix for regression models.

model_options

A list of model options.

  • likelihood

    • cause_list The vector of latent status;

    • k_subclass The number of nested subclasses. 1 for conditional independence, >1 for conditional dependence; 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 for R format enrollment date; it will produce natural cubic spline basis. Specify ~ 1 if no regression is intended.

    • FPR_formulaformula for false positive rates (FPR) regressions; see formula. You can use s_date_FPR to specify part of the design matrix for R format enrollment date; it will produce penalized-spline basis (based on B-splines). Specify ~ 1 if no regression is intended. NB: If effect="fixed", dm_Rdate_FPR will just specify a design matrix with appropriately standardized dates.

  • use_measurements a vector of characters strings; can be any singleton or combinations of "BrS", "SS", "GS".

  • prior

    • Eti_priorDescription of etiology prior (e.g., overall_uniform - all hyperparameters are 1; or 0_1 - all hyperparameters are 0.1);

    • TPR_priorDescription of priors for the measurements (e.g., informative vs non-informative). Its length should be the same with M_use;

mcmc_options

A list of Markov chain Monte Carlo (MCMC) options.

  • debugstatus Logical - whether to pause WinBUGS after it finishes model fitting;

  • n.chains Number of MCMC chains;

  • n.burnin Number of burn-in samples;

  • n.thin To keep every other n.thin samples after burn-in period;

  • individual.pred TRUE to perform individual prediction (Icat variables in the .bug file); FALSE otherwise;

  • ppd TRUE to simulate new data (XXX.new variables in the .bug file) from the posterior predictive distribution (ppd); FALSE otherwise;

  • get.pEti TRUE for getting posterior samples of individual etiologic fractions; FALSE otherwise. For non-regression, or regression models with all discrete predictors, this is defaulted to be TRUE; no need to specify this entry. It is only relevant for regression models with non-discrete covariates. Because individuals have distinct etiology pies 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 through JAGS.

  • result.folder Path to folder storing the results;

  • bugsmodel.dir Path to .bug model files;

  • winbugs.dir Path to where WinBUGS 1.4 is installed.

Details

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:

If running JAGS on windows, please go to control panel to add the directory to jags into ENVIRONMENTAL VARIABLE!

Value

BUGS fit results.

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_NoNest, nplcm_fit_Reg_discrete_predictor_NoNest


oslerinhealth-releases/baker documentation built on Nov. 4, 2019, 11:11 p.m.