predict.ssnbayes | R Documentation |
It will take an observed and a prediction data frame. It requires the same number of observation/locations per day. It requires location id (locID) and points id (pid). The locID are unique for each site. The pid is unique for each observation. Missing values are allowed in the response but not in the covariates.
## S3 method for class 'ssnbayes'
predict(
object = object,
...,
path = path,
obs_data = obs_data,
pred_data = pred_data,
net = net,
nsamples = nsamples,
addfunccol = addfunccol,
locID_pred = locID_pred,
chunk_size = chunk_size,
seed = seed
)
object |
A stanfit object returned from ssnbayes |
... |
Other parameters |
path |
Path with the name of the SpatialStreamNetwork object |
obs_data |
The observed data frame |
pred_data |
The predicted data frame |
net |
(optional) Network from the SSN object |
nsamples |
The number of samples to draw from the posterior distributions. (nsamples <= iter) |
addfunccol |
The variable used for spatial weights |
locID_pred |
(optional) the location id for the predictions. Used when the number of pred locations is large. |
chunk_size |
(optional) the number of locID to make prediction from |
seed |
(optional) A seed for reproducibility |
The returned data frame is melted to produce a long dataset. See examples.
A data frame with the location (locID), time point (date), plus the MCMC draws from the posterior from 1 to the number of iterations. The locID0 column is an internal consecutive location ID (locID) produced in the predictions, starting at max(locID(observed data)) + 1. It is used internally in the way predictions are made in chunks.
Edgar Santos-Fernandez
#require('SSNdata')
#clear_preds <- readRDS(system.file("extdata/clear_preds.RDS", package = "SSNdata"))
#clear_preds$y <- NA
#pred <- predict(object = fit_ar,
# path = path,
# obs_data = clear,
# pred_data = clear_preds,
# net = 2,
# nsamples = 100, # numb of samples from the posterior
# addfunccol = 'afvArea', # var for spatial weights
# locID_pred = locID_pred,
# chunk_size = 60)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.