zeitzeigerPredictGroup: Predict corresponding time for groups of test observations.

Description Usage Arguments Value See Also

View source: R/zeitzeiger_group.R

Description

zeitzeigerPredictGroup predicts the value of the periodic variable for each group of test observations, where the amount of time between each observation in a group is known. This function calls bbmle::mle2.

Usage

1
2
3
4
zeitzeigerPredictGroup(xTrain, timeTrain, xTest, groupTest, spcResult,
  fitMeanArgs = list(rparm = NA, nknots = 3), constVar = TRUE,
  fitVarArgs = list(rparm = NA), nSpc = NA, betaSv = FALSE,
  timeRange = seq(0, 1, 0.01))

Arguments

xTrain

Matrix of measurements for training data, observations in rows and features in columns.

timeTrain

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

xTest

Matrix of measurements for test data, observations in rows and features in columns.

groupTest

data.frame with one row per observation in xTest, and columns for group and timeDiff. Observations in the same group should have the same value of group. Within each group, the value of timeDiff should correspond to the amount of time between that observation and a reference time. Typically, timeDiff will equal zero for one observation per group.

spcResult

Result from zeitzeigerSpc.

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.

Value

A list with the following elements, where the groups will be sorted by their names.

timeDepLike

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

mleFit

List (for each element in nSpc) of lists (for each group of test observations) of mle2 objects.

timePred

Matrix of predicted times for each group of test observations by values of nSpc.

See Also

zeitzeigerPredict


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