zeitzeigerPredictCv: Predict corresponding time for observations on...

Description Usage Arguments Value See Also

View source: R/zeitzeiger_cv.R

Description

zeitzeigerPredictCv calls zeitzeigerPredict for each fold of cross-validation. By default, if a parallel backend is registered, this function processes the folds in parallel.

Usage

1
2
3
zeitzeigerPredictCv(x, time, foldid, spcResultList, fitMeanArgs = list(rparm =
  NA, nknots = 3), constVar = TRUE, fitVarArgs = list(rparm = NA),
  nSpc = NA, betaSv = FALSE, timeRange = seq(0, 1, 0.01), dopar = TRUE)

Arguments

x

Matrix of measurements, observations in rows and features in columns.

time

Vector of values of the periodic variable for observations, where 0 corresponds to the lowest possible value and 1 corresponds to the highest possible value.

foldid

Vector of values indicating which fold each observation is in.

spcResultList

Result from zeitzeigerSpcCv.

fitMeanArgs

List of arguments to pass to bigspline for fitting mean of each SPC.

constVar

Logical indicating whether to assume constant variance as a function of the periodic variable.

fitVarArgs

List of arguments to pass to bigspline for fitting variance of each SPC. Unused if constVar==TRUE.

nSpc

Vector of the number of SPCs to use for prediction. If NA (default), nSpc will become 1:K, where K is the number of SPCs in spcResult. Each value in nSpc will correspond to one prediction for each test observation. A value of 2 means that the prediction will be based on the first 2 SPCs.

betaSv

Logical indicating whether to use the singular values of the SPCs as weights in the likelihood calculation.

timeRange

Vector of values of the periodic variable at which to calculate likelihood. The time with the highest likelihood is used as the initial value for the MLE optimizer.

dopar

Logical indicating whether to process the folds in parallel. Use registerDoParallel to register the parallel backend.

Value

A list of the same structure as zeitzeigerPredict, combining the results from each fold of cross-validation.

timeDepLike

3-D array of likelihood, with dimensions for each observation, each element of nSpc, and each element of timeRange.

mleFit

List (for each element in nSpc) of lists (for each observation) of mle2 objects.

timePred

Matrix of predicted times for observations by values of nSpc.

See Also

zeitzeigerPredict, zeitzeigerFitCv, zeitzeigerSpcCv


jakejh/zeitzeiger documentation built on Nov. 22, 2017, 2:06 a.m.