predict_functions.gpdpgrow {growfunctions} | R Documentation |
Use the model-estimated GP covariance parameters from gpdpgrow() to predict the GP function at
future time points. Inputs the gpdpgrow
object of estimated parameters.
Description
A companion function to gpdpgrow
Usage
## S3 method for class 'gpdpgrow'
predict_functions(
object,
J = 500,
test_times,
time_points = NULL,
sn_order = NULL,
...
)
Arguments
object |
Object of class |
J |
Scalar denoting number of draws to take from posterior predictive for each unit.
Defaults to |
test_times |
A numeric vector holding test times at which to predict GP function values
Will use the estimated covariance parameters from the training data to predict
functions at the test_times for the |
time_points |
Inputs a vector of common time points at which the collections of functions were
observed (with the possibility of intermittent missingness). The length of |
sn_order |
An integer vector of length, |
... |
further arguments passed to or from other methods. |
Value
out A list object containing containing two matrices; the first is a K x (N*T) matrix of predicted function values for each of K sampled iterations. N is slow index and denotes the number of experimental units. The second matrix is an N x T average over the K sampled draws, composed in Rao-Blackwellized fashion.
Note
Intended as a companion function for gpdpgrow
for prediction
Author(s)
Terrance Savitsky tds151@gmail.com
See Also
Examples
## Not run:
library(growfunctions)
data(cps)
y_short <- cps$y[,(cps$yr_label %in% c(2010:2013))]
t_train <- ncol(y_short)
N <- nrow(y_short)
t_test <- 4
## Model Runs
res_gp = gpdpgrow(y = y_short
n.iter = 50,
n.burn = 25,
n.thin = 1,
n.tune = 0)
## Prediction Model Runs
T_test <- 4
T_yshort <- ncol(y_short)
pred_gp <- predict_functions( object = res_gp,
test_times = (T_yshort+1):(T_yshort+T_test) )
## plot estimated and predicted functions
plot_gp <- predict_plot(object = pred_gp,
units_label = cps$st,
single_unit = FALSE,
credible = TRUE)
## End(Not run)