paramGen: Parameter Generators

Description Usage Arguments Details Value Author(s) Examples

Description

Functions which use the arguments of a glarma call to generate the initial delta, theta and phi vectors.

Usage

1
2
3
4
deltaGen(y, X, offset = NULL, phiInit, thetaInit, type, alpha,
         beta, alphaInit)
thetaGen(thetaLags, thetaInit)
phiGen(phiLags, phiInit)

Arguments

y

Numeric vector; response variable.

X

Matrix; the explanatory variables. A vector of ones should be added to the data matrix as the first column for the beta of the intercept.

offset

Either NULL or a numeric vector of length equal to the number of cases. Used to specify an a priori known component to be included in the linear predictor during fitting.

phiInit

Numeric vector; initial values for the corresponding AR orders.

thetaInit

Numeric vector; initial values for the corresponding orders.

type

Character; the count distribution. The default is the Poisson distribution.

beta

Numeric vector; initial values of the parameters of variables. It is for the user to construct the specific delta by themselves.

alpha

Numeric; an optional initial theta parameter for glm.nb.

alphaInit

Numeric; an initial theta parameter for glarma for negative binomial counts.

thetaLags

Numeric vector; MA orders

phiLags

Numeric vector; AR orders

Details

The thetaGen and phiGen functions take the arguments, thetaLags, phiLags, thetaInit and phiInit, in a glarma call to generate and return the initial theta and phi vectors with orders corresponding to their names. Then the deltaGen function uses the values returned by thetaGen, phiGen and other arguments in the glarma call to generate and return the initial delta vector with correct names.

Value

thetaGen returns a list containing thetaLags and thetaInit. thetaInit is the initial theta vector with its corresponding MA orders as its names.

phiGen returns a list containing phiLags and phiInit. phiInit is the initial phi vector with its corresponding MA orders as its names.

deltaGen returns a named vector giving the values of beta, phiInit, thetaInit plus alpha in the negative binomial case.

Author(s)

"Cenanning Li" <cli113@aucklanduni.ac.nz> and "William T.M. Dunsmuir" <w.dunsmuir@unsw.edu.au>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
### Using the polio data
data(Polio)
y <- Polio[, 2]
X <- as.matrix(Polio[, 3:8])

## generate the theta vector
theta.lags <- c(1, 2, 5)
theta.init <- c(0.0, 0.0, 0.0)

theta <- thetaGen(theta.lags, theta.init)
print(thetaLags <- theta[[1]])
print(theta.init <- theta[[2]])

## generate the vector of phi
phi.lags <- rep(0, 0)
phi.init <- rep(0, 0)
phi <- phiGen(phi.lags, phi.init)
print(phiLags <- phi[[1]])
print(phi.init <- phi[[2]])

## generate the delta vector
delta <- deltaGen(y = y, X = X, phiInit = phi.init,
                  thetaInit = theta.init, type = "Poi",
                  alpha = 1)
delta

glarma documentation built on May 2, 2019, 6:33 a.m.