predict.grid {rts2}R Documentation

Extract predictions from a grid object

Description

Extract incidence and relative risk predictions. The predictions will be extracted from the last model fit in the grid object. If no previous model fit then use either grid$lgcp_ml() or grid$lgcp_bayes(), or see grid$model_fit() to update the stored model fit.

Usage

## S3 method for class 'grid'
predict(
  object,
  type = c("pred", "rr", "irr"),
  irr.lag = NULL,
  t.lag = 0,
  popdens = NULL,
  verbose = TRUE,
  ...
)

Arguments

object

A grid object.

type

Vector of character strings. Any combination of "pred", "rr", and "irr", which are, posterior mean incidence (overall and population standardised), relative risk, and incidence rate ratio, respectively.

irr.lag

integer. If "irr" is requested as type then the number of time periods lag previous the ratio is in comparison to

t.lag

integer. Extract predictions for previous time periods.

popdens

character string. Name of the column in grid_data with the population density data

verbose

Logical indicating whether to print messages to the console

...

Further arguments passed from other methods

Details

Three outputs can be extracted from the model fit:

Predicted incidence: If type includes pred then pred_mean_total and pred_mean_total_sd provide the predicted mean total incidence and its standard deviation, respectively. pred_mean_pp and pred_mean_pp_sd provide the predicted population standardised incidence and its standard deviation. These are added to the grid data or to the regional data for spatially-aggregated data.

Relative risk: if type includes rr then the relative risk is reported in the columns rr and rr_sd. The relative risk here is the exponential of the latent field, which describes the relative difference between expected mean and predicted mean incidence. These are added to the grid data.

Incidence risk ratio: if type includes irr then the incidence rate ratio (IRR) is reported in the columns irr and irr_sd. This is the ratio of the predicted incidence in the last period (minus t_lag) to the predicted incidence in the last period minus irr_lag (minus t_lag). For example, if the time period is in days then setting irr_lag to 7 and leaving t_lag=0 then the IRR is the relative change in incidence in the present period compared to a week prior. These are added to the grid data or to the regional data for spatially-aggregated data.

Value

An sf object in which the predictions are stored.

Examples

# See examples for grid$lgcp_bayes() and grid$lgcp_ml()

[Package rts2 version 0.7.5 Index]