buildAR: Builds an autoregressive model

View source: R/buildAR.R

buildARR Documentation

Builds an autoregressive model

Description

Description text

Usage

buildAR(
  vec,
  x = NULL,
  wsize,
  method = c("equal", "unweighted", "triangle"),
  seed = NULL,
  rhat_method = c("none", "geometric", "arithmetic"),
  lambda = 0
)

Arguments

vec

A vector of numeric data

x

A vector containing a covariate with which to generate AR model, if unspecified, defaults to vec

wsize

Number of prior observations to use for averaging

method

Type of weighting to use

seed

Seed for random number generator

rhat_method

Method for calculating rhat, if "none", rhat = 1 and has no effect

lambda

Shrinkage parameter, if not specified, default is 0 which produces no shrinkage. If an array is specified, all values in teh array are evaluated and the optimal lambda is chosen based on residual sum of squares. Values should be between 0 and 1 inclusive.

Value

A list with the following components:

wsize is the number of prior observations used for averaging

vec is a numeric vector containing the input data

fit is a numeric vector containing the autoregressive model fitted data

errors is a numeric vector containing the difference between fit and vec

initphi is a numeric vector containing the initial phi

finalphi is a numeric vector containing the final phi


olshena/COVIDNearTerm documentation built on May 27, 2023, 1:23 p.m.