predict_functions.gmrfdpgrow: Use the model-estimated iGMRF precision parameters from...

Description Usage Arguments Value Note Author(s) See Also Examples

Description

A companion function to gmrfdpgrow

Usage

1
2
## S3 method for class 'gmrfdpgrow'
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.

Note

Intended as a companion function for gmrfdpgrow for prediction

Author(s)

Terrance Savitsky tds151@gmail.com

See Also

gmrfdpgrow

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## 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)

growfunctions documentation built on July 17, 2021, 1:08 a.m.