ar1_NegBinom: Autoregressive Negative Binomial

View source: R/ar1_NegBinom.R

ar1_NegBinomR Documentation

Autoregressive Negative Binomial

Description

Fits a simple AR1 negative binomial model. Let Y_1, \ldots, Y_N be the N random variables representing observed data y_1^*, \ldots y_N^*, respectively. The model assumes that Y_n|Y_{n-1} for some n \in 1:N has the following distribution:

Y_n | Y_{n - 1} = y_{n-1}* \sim NB(a + by_{n-1}^*, \psi)

Where a, b and \psi are model parameters that need to be estimated.

Usage

ar1_NegBinom(
  data,
  init,
  start_vals = c(10, 0.5, 1),
  transform = TRUE,
  a = 2,
  ...
)

Arguments

data

The data to fit, numeric vector.

init

Initial value

start_vals

Starting values for the parameters

transform

Boolean, whether or not to use variable transformations in the optimization

a

Only used if transform == TRUE. a is a numeric representing the maximum value for the AR1 coefficient, and -a is the minimum value.

...

other parameters to be passed into the optim function

Details

Missing values are currently ignored.

Value

An AR1_NegBinom model

Examples

ar1_NegBinom(round(sunspot.year), init = 5)

zjiang2/haitipkg documentation built on March 1, 2024, 11:34 p.m.