Learn R Programming

growfunctions (version 0.12)

predict_functions.gmrfdpgrow: Use the model-estimated iGMRF precision parameters from gmrfdpgrow() to predict the iGMRF function at future time points. Inputs the gmrfdpgrow object of estimated parameters.

Description

A companion function to gmrfdpgrow

Usage

"predict_functions"(object, J = 500, T_test, ...)

Arguments

object
Object of class gmrfdpgrow returned from model run of gmrfdpgrow()
J
Scalar denoting number of draws to take from posterior predictive for each unit. Defaults to J = 500.
T_test
The number of equally-spaced time points to predict the iGMRF functions ahead of of the functions estimated at T_train time points.
...
further arguments passed to or from other methods.

Value

out A list object containing containing two matrices; the first is a P x (N*T) matrix of predicted function values for each of P sampled iterations. N is slow index and denotes the number of experimental units. The second matrix is an N x T average over the P sampled draws, composed in Rao-Blackwellized fashion.

See Also

gmrfdpgrow

Examples

Run this code
## 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_gmrf            = gmrfdpgrow(y = y_short, 
#                                 q_order = c(2,4), 
#                                 q_type = c("tr","sn"), 
#                                 n.iter = 100, 
#                                 n.burn = 50, 
#                                 n.thin = 1) 
# ## Prediction Model Runs
# T_test             <- 4
# 
# pred_gmrf          <- predict_functions( object = res_gmrf,
#                                      J = 1000, 
#                                      T_test = T_test )
# 
# ## plot estimated and predicted functions
# plot_gmrf       <- predict_plot(object = pred_gmrf, 
#                                units_label = cps$st, 
#                                single_unit = TRUE, 
#                                credible = FALSE)
# ## End(Not run)

Run the code above in your browser using DataLab