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 spBFA model object for which predictions are desired from.

NewTimes

A numeric vector including desired time(s) points for prediction.

NewX

A matrix including covariates at times NewTimes for prediction. NewX must have dimension (M x O x NNewVistis) x P. Where NNewVisits is the number of temporal locations being predicted. The default sets NewX to NULL, which assumes that the covariates for all predictions are the same as the final time point.

NewTrials

An array indicating the trials for categorical predictions. The array must have dimension M x C x NNewVisits and contain only non-negative integers. The default sets NewTrials to NULL, which assumes the trials for all predictions are the same as the final time point.

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 containing NNewVistis matrices, one for each new time prediction. Each matrix is dimension NKeep x K, where K is the number of latent factors Each matrix contains posterior samples obtained by Bayesian krigging.

Y

A list containing NNewVistis posterior predictive distribution matrices. Each matrix is dimension NKeep x (M * O), where M is the number of spatial locations and O 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


[Package spBFA version 1.3 Index]