incidental (version 0.1)

scan_spline_dof: Scan spline degrees of freedom

Description

This function holds the regularization parameter value fixed and scans spline degrees of freedom.

Usage

scan_spline_dof(
  reported,
  delay_dist,
  dof_grid,
  method = "bic",
  lam = 0,
  regularization_order = 2,
  reported_val = NULL,
  end_pad_size = 0,
  fisher_approx_cov = FALSE
)

Arguments

reported

An integer vector of reported cases.

delay_dist

A positive vector that sums to one, which describes the delay distribution.

dof_grid

An integer vector of degrees of freedom for the spline basis.

method

Metric to choose "best" dof: 'aic', 'bic', 'val'. If method='val', reported_val must be non NULL and match reported size.

lam

A fixed value for the beta parameter regularization strength.

regularization_order

An integer (typically 0, 1, 2), indicating differencing order for L2 regularization of spline parameters. Default is 2 for second derivative penalty.

reported_val

Validation time series of equal size to reported vector for use with 'val' method. Default is NULL.

end_pad_size

And integer number of steps the spline is defined beyond the final observation.

fisher_approx_cov

A flag to use either the Fisher Information (TRUE) or the Hessian (FALSE) to approx posterior covariance over parameters.

Value

A list of degree of freedom fit statistics:

  • best_dof = best degrees of freedom

  • dof_resdf = data frame of fit statistics (lambda, dof, aic, bic, val_lls, train_lls)