writePCModel: Write the model

Description Usage Arguments Details Value References Examples

Description

The writePCModel function writes a NIMBLE model that incorporates the process convolution approach.

Usage

1
2
3
4
5
writePCModel(PCDataObj, typeOfZero = "censored", covariates = NULL,
  covariatesForBinary = NULL, coefPrior = "sdunif",
  multiSampsPerSubj = NULL, errorVarianceLevel = "sample",
  latentVarianceLevel = "sample", addAssignNode = NULL,
  assignNodeLevel = NULL)

Arguments

PCDataObj

An object of class PCDataList. This object is the result of using the createPCData function.

typeOfZero

A character string specifying the type of zero that will be assumed. The two options are "censored" (default) and "true". If there are no zeros for the outcome of interest then this argument is superfluous.

covariates

A concatenated character string specifying the covariates that will be included in the model. When there are no zeros in the data, or when zeros are assumed to be censored, there is only a single set of covariates. When the zeros are assumed to be true zeros, there are two model parts, a binary and a marginalized. The covariates specified in this argument will be used in the marginalized part of the model.

covariatesForBinary

A concatenated character string specifying covariates that will be included in the binary part of the marginalized two part model. This argument will only be used if there are zeros in the data and typeOfZero='true'. If typeOfZero='true', and this argument is left empty, then the covariates for the binary part of the model will be assumed to be the same as those for the marginalized part of the model.

coefPrior

A character string specifying the prior that should be assumed for model coefficients. The options are "sdunif" (default), "dnorm", and "Cauchy". See details for more information.

multiSampsPerSubj

A TRUE/FALSE variable indicating whether or not there are mutliple samples per subject.

errorVarianceLevel

A character string specifying the level at which the error variance should be estimated. The options are "sample" (default), "subject", and "overall". As an example, if errorVarianceLevel="sample" then a separate error variance is estimated for each sample.

latentVarianceLevel

A character string specifying the level at which the latent variance should be estimated. The options are "sample" (default), "subject", and "overall".

Details

For the model coefficients, three possible priors are allowed.

sdunif For all model coefficients, including the intercept(s), the prior is given by

β \sim \mbox{N}(0, σ^{2}_{β}); σ_{β} \sim \mbox{U}(0,10).

dnorm For all model coefficients, including the intercept(s), the prior is given by

β \sim \mbox{N}(0, 0.00001).

Cauchy The Cauchy priors are specified according to the recommendations of Gelman et al. (input citation). While Gelman used the Cauchy priors in the context of logistic regression, imaging mass spectrometry data is often lognormally distributed, and on the log scale parameter spaces may need to be constrained in a similar way. For intercepts, the prior is

β_{0} \sim \mbox{Cauchy}(0, \mbox{scale}=10).

For other model coefficients the prior is

β \sim \mbox{Cauchy}(0, \mbox{scale}=2.5).

Value

A list containing the model and other information supplied to the createPCData function.

model

A model object created using the link[nimble]{nimbleCode} function.

covariates

A concatenated character string of the covariate names.

covariatesForBinary

A concatenated character string of the covariate names for the binary part of the marginalized two-part model.

coefPrior

A character string specifying the assumed prior for the model coefficients.

multiSampsPerSubj

A TRUE/FALSE variable indicating whether there are multiple samples per subject.

errorVarianceLevel

A character string specifying the level (overall, subject, or sample) at which the error variance will be estimated.

latentVarianceLevel

A character string specifying the level (overall, subject, or sample) at which the latent variance will be estimated.

typeOfZero

A character string specifying the assumption made about the type of zeros in the data.

References

de Valpine, P., D. Turek, C.J. Paciorek, C. Anderson-Bergman, D. Temple Lang, and R. Bodik. 2017. Programming with models: writing statistical algorithms for general model structures with NIMBLE. Journal of Computational and Graphical Statistics. 26: 403-413.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data("TAMdata")
# The dataset is trimmed only for the speed of the example
TAMdata <- TAMdata[TAMdata$subject < 3, ]
TAMdata <- rScale(TAMdata, subjectVar = 'subject', sampleVar = 'ROI',
                  xCoord = 'x', yCoord = 'y')
rangs <- estRange(TAMdata, outcome = 'X1282.auc', spatialVar = 'TAM',
                  semivEst = 'modulus', logTransform = TRUE)
structs <- chooseStructures(rangs)
PCdat <- createPCData(structs, trimData = FALSE,
                      covariates = c("secondary", "TAM", "secTAM"),
                      covariateTypes = c("binary", "binary", "binary"),
                      covariateLevels = c("sample", "raster", "raster"))
PCmod <- writePCModel(PCdat, multiSampsPerSubj = TRUE, typeOfZero = "censored")

cammiller/imagingPC documentation built on June 28, 2019, 12:04 a.m.