predict.spBFA {spBFA} | R Documentation |
predict.spBFA
Description
Predicts future observations from the spBFA
model.
Usage
## S3 method for class 'spBFA'
predict(
object,
NewTimes,
NewX = NULL,
NewTrials = NULL,
type = "temporal",
Verbose = TRUE,
seed = 54,
...
)
Arguments
object |
A |
NewTimes |
A numeric vector including desired time(s) points for prediction. |
NewX |
A matrix including covariates at times |
NewTrials |
An array indicating the trials for categorical predictions. The array must have dimension |
type |
A character string indicating the type of prediction, choices include "temporal" and "spatial". Spatial prediction has not been implemented yet. |
Verbose |
A boolean logical indicating whether progress should be output. |
seed |
An integer value used to set the seed for the random number generator (default = 54). |
... |
other arguments. |
Details
predict.spBFA
uses Bayesian krigging to predict vectors at future
time points. The function returns the krigged factors (Eta
) and also the observed outcomes (Y
).
Value
predict.spBFA
returns a list containing the following objects.
Eta
A
list
containingNNewVistis
matrices, one for each new time prediction. Each matrix is dimensionNKeep x K
, whereK
is the number of latent factors Each matrix contains posterior samples obtained by Bayesian krigging.Y
A
list
containingNNewVistis
posterior predictive distribution matrices. Each matrix is dimensionNKeep x (M * O)
, whereM
is the number of spatial locations andO
the number of observation types. Each matrix is obtained through Bayesian krigging.
Author(s)
Samuel I. Berchuck
Examples
###Load pre-computed regression results
data(reg.bfa_sp)
###Compute predictions
pred <- predict(reg.bfa_sp, NewTimes = 3)
pred.observations <- pred$Y$Y10 # observed data predictions
pred.krig <- pred$Eta$Eta10 # krigged parameters