# Predict corresponding time for test observations

Source:`R/zeitzeiger_predict.R`

`zeitzeigerPredict.Rd`

Predict the value of the periodic variable for test observations given training data and SPCs.

## Usage

```
zeitzeigerPredict(
xTrain,
timeTrain,
xTest,
spcResult,
nKnots = 3,
nSpc = NA,
timeRange = seq(0, 1 - 0.01, 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.

- spcResult
Output of

`zeitzeigerSpc()`

.- nKnots
Number of internal knots to use for the periodic smoothing spline.

- 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.- 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

- timeDepLike
3-D array of likelihood, with dimensions for each test observation, each element of

`nSpc`

, and each element of`timeRange`

.- mleFit
List (for each element in

`nSpc`

) of lists (for each test observation) of`mle2`

objects.- timePred
Matrix of predicted times for test observations by values of

`nSpc`

.