Learn R Programming

baselinenowcast (version 0.2.0)

fit_by_horizon: Helper function that fits its each column of the matrix (horizon) to an observation model.

Description

Helper function that fits its each column of the matrix (horizon) to an observation model.

Usage

fit_by_horizon(obs, pred, fit_model = fit_nb)

Value

Vector of uncertainty parameters of the same length as the number of columns in the obs matrix.

Arguments

obs

Matrix or vector of observations.

pred

Matrix or vector of predictions.

fit_model

Function that ingests observations and expectations and returns uncertainty parameters, default is fit_nb.

See Also

Observation error estimation functions estimate_uncertainty(), fit_nb()

Examples

Run this code
obs <- matrix(
  c(
    5, 6, 2,
    1, 4, 2,
    8, 4, 2
  ),
  nrow = 3,
  byrow = TRUE
)
pred <- matrix(
  c(
    4.2, 5.2, 1.8,
    0.7, 3.5, 3.4,
    7.3, 4.1, 1.2
  ),
  nrow = 3,
  byrow = TRUE
)
disp <- fit_by_horizon(obs = obs, pred = pred)
disp

Run the code above in your browser using DataLab