createPCData: Create the information for running models

Description Usage Arguments Value Examples

Description

The createPCData function generates all the information needed to fit a process convolution model in a Bayesian setting.

Usage

1
2
createPCData(structureObj, covariates, covariateTypes, covariateLevels,
  trimData = FALSE)

Arguments

structureObj

An object of class structureList. This object is the result of using the chooseStructures function.

covariates

A concatenated character string specifying the covariates for which modeling information will be generated. Not all covariates have to be included in the model that will be fit, so it is a good idea to include all covariates that may be of interest.

covariateTypes

A concatenated character string specifying the type of variable for each covariate given in the covariates argument. The three options are "binary", "continuous", and "categorical". Every variable in the covariates argument must have a corresponding covariate type, where the nth covariate type corresponds to the nth covariate in the covariates argument.

covariateLevels

A concatenated character string specifying the level at which each covariates exists. The options are "subject", "sample", and "raster". As an example, for a study examining differences between tumor and non-tumor samples, the level would be 'sample' since the covariate changes between samples. A level must be provided for every covariate given in the argument covariates.

trimData

A TRUE/FALSE argument specifying whether or not the data should be trimmed. If trimData=TRUE, the data will be subset to only include the variables required to fit a model.

Value

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

data

A data frame containing the data

nSubjs

The number of subjects

nSamps

The number of samples

cNSampsPerSubj

A cumulative vector of the number of samples per subject. If no subject variable was provided to the rScale function then this will be NULL.

cNRastPerSamp

A cumulative vector of the number of rasters per sample.

totalRasters

A numeric value for the total number of rasters.

covs

A list of lists of covariate information. For each variable in the covariates argument, a list of covariate information is created that includes elements covariate (the name of covariate), type (the type of covariate given in the covariateTypes argument), level (the level of the covariate given in the covariateLevels argument), info (the data corresponding to the covariate, given as data frames for subject-level and sample-level covariates and vectors for raster-level covariates), and mapping (a data frame mapping the given covariate values to new ones that are used in modeling).

KMat

A matrix of density values generated from the smoothing kernel function. The matrix has rows equal to the number of rows in the dataset and columns equal to the maximum number of support sites for any of the samples. Missing cells indicate that the support site corresponding to that column was removed for the sample corresponding to that data row.

rastersPerVar

A data frame showing the number of rasters, per level of the spatial variable, for each sample. The data frame also shows the cumulative number of rasters. If no spatial variable is given then this is NULL.

nSupportSites

The number of support sites per sample. If no spatial variable was given then this is a vector. If a spatial variable is given then this is a data frame showing the number of support sites per sample, for each level of the spatial variable.

nObs

A data frame giving the number of rasters per sample.

gT0SupportSites

If no spatial variable is provided, then this is NULL. If a spatial variable is given the this is a list of vectors, one for each level of the spatial variable, where each vector gives the samples numbers with more than one support site for the corresponding level of the spatial variable. If no spatial variable is given then this is NULL.

nVarLevels

The number of levels of the spatial variable. If no spatial variable is given then this is NULL.

subjectVar

A character string specifying the subject variable.

sampleVar

A character string specifying the sample variable.

spatialVar

A character string specifying the spatial variable.

covariates

A concatenated character string of the covariate names.

covariateTypes

A concatenated character string of the covariate types (binary, categorical, continuous) corresponding to the covariates.

covariateLevels

A concatenated character string of the covariate levels (subject, sample, raster) corresponding to the covariates.

outcome

A character string specifying the name of the variable to be modeled.

recStructures

An indicator where 0 means no structure was chosen (if estimmated range=0) and 1 means a structure was chosen.

Examples

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

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