predict.ngme: Prediction.

View source: R/predict.ngme.R

predict.ngmeR Documentation

Prediction.

Description

Obtains predicted values based on filtering and smoothing distributions.

Usage

## S3 method for class 'ngme'
predict(
  object,
  newdata = NULL,
  id = NULL,
  type = "Filter",
  quantiles = c(0.025, 0.975),
  controls = list(return.samples = FALSE, predict.derivatives = NULL, excursions =
    NULL, crps = TRUE, crps.skip = 1, nSim = 1000, nBurnin = 100, silent = TRUE, n.cores
    = 1, batch.size = 100)
)

Arguments

object

A fitted object obtained by calling "ngme".

id

A numeric vector containing the ID's of the subjects for whom predictions are to be obtained. Default is set to "NULL" indicating perform predictions for all the subjects.

type

A character string for the type of prediction: "Nowcast" for nowcasting, "Filter" for one step-ahead forecasting, "Smoothing" for smoothing.

quantiles

A two-element vector that contains the quantiles of the predictions to be calculated.

controls

A list of control variables.

  • "return.samples" A logical variable for returning the Monte Carlo samples used to compute the predictions; "TRUE" indicates return, "FALSE" do not return.

  • "predict.derivatives" A list for calculating excursion probabilities

    • Bfixed A list of fixed effects covariate matrices at t_{ij} + delta.

    • Brandom A list of random effects covariate matrices at t_{ij}+ delta.

    • delta A numeric value indicating \Deltat for calculating the derivative numerically.

  • "excursions" A list of excursion probabilities to compute. Each list should contain:

    • "type" Type of excursion for indicating calculation of the probabilities, greater than or less than a threshol. User should specify "greater than" by ">" "less than" by "<".

    • "level" A numeric value for the threshold compute excursion probability for.

    • "process" A character string that for which component of the model the excursion probabilities to be calculated.

      • x\alpha + dU + W + Z with x \alpha being fixed effects,

      • dU random effects and Z noise, to compute the probability for.

      • 'X' for x\alpha + dU + W,

      • 'W' for W,

      • 'Y' for x\alpha + dU + W + Z,

      • 'Xderivative' for the first derivarive of x\alpha + dU + W, and

      • 'Wderivative' for the first derivariate of W.

  • "crps" A logical variable for calculating continuous ranked probability score (CRPS); "TRUE" indicates calculate, "FALSE" do not calculate.

  • "crps.skip" A numerical value, say a, that indicates every ath element of the sample to be used to compute the crps score.

  • "nSim" A numerical value for the number of samples for the Gibbs sampler to obtain the predictions.

  • "nBurnin" A numeric value for the number of samples that are discarded as burn-in whilst calculating the predictions.

  • silent A logical value for printing the details; "TRUE" indicates do not print, "FALSE" indicates print.

  • n.cores Number of cores to use for paralell computations, default is set to 1.

  • batch.size Number of subjects to include in each paralell batch.

Value

A list of output.

See Also

ngme

Examples

  ## Not run: 
  fit <- ngme(...)
  predict(fit, ...)
  
## End(Not run)

davidbolin/ngme documentation built on Dec. 5, 2023, 11:48 p.m.