getSamplerObj: DSP input data structure creation

Description Usage Arguments Details Value

Description

getSamplerObj creates data structures used by the DSP sampler algorithm. In fact, the only data created by dspDat that is used by the sampler is the data returned by this function.

Usage

1
getSamplerObj(modelObj, cycVec, fwLen, useNA)

Arguments

modelObj

The return object from getModelObj.

cycVec

The return object from getCommonCyc.

fwLen

A value specifying the number of days belonging to a cycle's fertile window. The length of the fertile window is assumed to be same across all cycles.

useNA

One of either "none" or "sex". If "none" then observations with missing data are removed from the model. If "sex" then observations with missing intercourse data are included in the model conditional on no other data missing in the observation. See Data Processing Steps for more details.

Details

Add details about the software

Value

getSamplerObj returns a list containing the following components:

U

Design matrix of model covariates, after removing observations for which intercourse did not occur (and for missing values when useNA is specified as "none"). See getModelObj for details regarding construction of U (before non-intercourse observations are removed).

idDayExpan

An nObs-integer vector that is used to expand an n-vector to an nObs-vector. In more detail, it is a vector of the form (1,1,1,2,2,2,2,...,n,n), where the number of 1's corresponds to the number of study observations for which intercourse occured for the first subject, the number of 2's corresponds to the number of study observations for which intercourse occured for the second subject, etc.

gamBinBool

A q-logical vector such that the p-th element states the logical status of whether the q-th predictor variable in the design matrix assumes values of only either 0 or 1.

varNames

A q-character vector such that the p-th element provides the name of the q-th predictor variable in the design matrix.

useNaSexBool

A logical value supplying the logical status of whether useNA has value "sex".

subjId

An n-vector of type determined at runtime supplying the subject IDs.

n

An integer value supplying the number of subjects in the study (after removing subjects without any days of intercourse in the fertile window).

nObs

An integer value supplying the number of fertile-window study days during which intercourse occured.

q

An integer value supplying the number of predictor variables in the design matrix.

idx: if useNA is specified as "none", then a list with name idx is included as an element in the getSamplerObj return object; if useNA is specified as "sex", then idx is not included in the getSamplerObj return object, and instead has to be created each scan through the sampler.

preg

An integer vector supplying the observation indices (after removing non-intercourse days) such that the observation day was a day within a cycle for which a successful pregnancy occured.

U

A list containing elements all and preg.

all is a list containing with q elements. Each element is such that the p-th element is either NULL if the p-th predictor variable takes on values not just 0 or 1, or otherwise is an integer vector supplying the observation indices (after removing non-intercourse days) such that the p-th predictor variable for that observation has a value of 1.

preg is constructed in the same way as all, with the exception that the indices are further restricted to belong to observations such that the observation day was a day within a cycle for which a successful pregnancy occured.

pregCyc

A list that partitions the observations (indices) by cycle, restricted to observations such that the observation day was a day within a cycle for which a successful pregnancy occured. In more detail, the process is conceptually equivalent to (i) subsetting the data to observations such that the observation day was a day within a cycle for which a successful pregnancy occured, and (ii) partitioning this subsetted data into vectors of indices such that each vector contains the observation indices belonging to a single cycle.

subj

An integer vector such that the elements are values corresponding to the indices of subjects that became pregnant during the study.

naSexDat: if useNA is specified as "none", then the following object is included as in element in the return list object:


dpritchLibre/DSP_Package documentation built on May 15, 2019, 1:49 p.m.