lacm: Fitting Latent Autoregressive Count Models by Maximum...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/lacm.R

Description

Fits latent autoregressive count models by maximum pairwise likelihood.

Usage

1
2
3
4
lacm(formula, data, subset, offset, contrasts = NULL, start.theta = NULL, fixed, d = 1,
     kernel.type = c("Rectangular", "Trapezoidal"), fit = TRUE, gh.num = 20,
     reltol.opt = 1e-06, opt.method = c("BFGS", "Nelder-Mead"), maxit.opt = 1000,
     sandwich.lag = NULL, bread.method = c("Outer-product", "Hessian"), ...) 

Arguments

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lacm is called.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

offset

this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be NULL or a numeric vector of length equal to the number of cases. One or more offset terms can be included in the formula instead or as well, and if more than one is specified their sum is used. See model.offset.

contrasts

an optional list. See the contrasts.arg of model.matrix.default.

start.theta

optional numeric vector with starting values for the model parameters.

fixed

optional numeric vector of the same length as the total number of parameters. If supplied, only NA entries in fixed will be varied.

d

order of the pairwise likelihood. Defaults to 1.

kernel.type

one of "Rectangular", "Trapezoidal" indicating the type of kernel weights to be used in the weighted pairwise likelihood specification. The default "Rectangular" corresponds to equal contribution from all pairs of observations that are distant apart up to lag d. Can be abbreviated.

fit

a logical value indicating whether to compute the maximum pairwise likelihood estimates or not.

gh.num

number of the Gauss-Hermite quadrature nodes. Defaults to 20.

reltol.opt

relative convergence tolerance to be passed to optim. Defaults to 1e-6.

opt.method

one of "BFGS" or "Nelder-Mead" indicating the optimization method to be passed to optim. Can be abbreviated. See optim for details.

maxit.opt

the maximum number of iterations to be passed to optim. Defaults to 1000.

sandwich.lag

the lag length used for computing the bandwith of the sandwich variance. See ‘Details’.

bread.method

one of "Outer-product" or "Hessian" indicating whether the bread matrix of the sandwich variance is estimated with the outer-product of the individual gradients or with a numerical approximation of the Hessian matrix. Can be abbreviated. See ‘Details’.

...

further arguments passed to or from other methods.

Details

Function lacm performs maximum pairwise likelihood estimation in latent autoressive count models, see Pedeli and Varin (2020) for details.

Evaluation of the pairwise likelihood is performed through double Gauss-Hermite quadrature with the gh.num nodes and weights calculated by gauss.quad.

Standard formula y ~ x1 + x2 indicates that the mean response is modelled as a function of covariates x1 and x2 through a log link function.

Starting values supplied by the user can be specified through start.theta. If start.theta=NULL, then starting values are obtained using the method-of-moments as discussed in Ng et al. (2011).

Sandwich standard errors that are robust to heteroschedasticity and autocorrelation (HAC-type) are computed. The "meat matrix" is estimated using a lag length equal to sandwich.lag. If sandwich.lag is NULL, then L is set equal to 10 * log10(n), where n is the time series length and d is the pairwise likelihood order. The "bread matrix" is computed with the average of outer products of the individual grandients (bread.matrix = "Outer-product") or with a numerical approximation of the Hessian (bread.method = "Hessian"). Details are given in Pedeli and Varin (2020).

Value

An object of class "lacm" with the following components:

nobs

the number of observations.

p

the number of regressors, including the intercept.

d

the order of the pairwise likelihood.

npar

the number of parameters.

Y

the response used.

X

the model matrix used for the mean response.

offset

the offset used.

sandwich.lag

the lag length used for the bandwith of the HAC-type standard errors.

fit

logical. Was the model fitted or not?

gh.num

number of Gauss-Hermite nodes used.

call

the matched call.

terms

the terms object used.

latent

logical. Does the model include the latent part?

fixed

the numeric vector indicating which parameters are constants.

ifree

indeces of the free parameters.

kweights

the kernel weights used.

start.theta

the starting values.

objfun

function computing the logarithm of the pairwise likelihood of order d.

grad

function computing the gradient of the pairwise likelihood of order d.

gh

Gauss-Hermite nodes and weights used.

opt.method

a character string specifying the method argument passed to optim. The default optimization routine is the quasi-Newton algorithm BFGS. See optim for details.

convergence

an integer code indicating convergence of the optimizer. See link{optim} for details.

gh

a list with components the Gauss-Hermite nodes and the weights used for approximating the pairwise likelihood.

plik

the maximum pairwise likelihood value.

theta

the maximum pairwise likelihood estimate.

jacobian

the jacobian of the individual pairwise likelihood terms.

outer-product

logical. Was the bread matrix of the sandwich variance computed with the outer product of the individual scores?

H

the bread matrix.

J

the meat matrix.

vcov

the variance-covariance matrix of the maximum pairwise likelihood estimate.

CLIC

the composite likelihood information criterion.

Functions summary.lacm, coefficients and vcov.lacm can be used to obtain or print a summary of the results, extract coefficients and their estimated variance-covariance matrix of the model fitted by lacm.

Author(s)

Xanthi Pedeli and Cristiano Varin.

References

Ng, C., Joe, H., Karlis, D., and Liu, J. (2011). Composite likelihood for time series models with a latent autoregressive process. Statistica Sinica, 21, 279–305.

Pedeli, X. and Varin, C. (2020). Pairwise likelihood estimation of latent autoregressive count models. Statistical Methods in Medical Research.doi: 10.1177/0962280220924068.

See Also

CLIC.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data("polio", package = "lacm")
## model components
trend <- 1:length(polio)
sin.term <- sin(2 * pi * trend / 12)
cos.term <- cos(2 * pi * trend / 12)
sin2.term <- sin(2 * pi * trend / 6)
cos2.term <- cos(2 * pi * trend / 6)
## fit model with pairwise likelihood of order 1
mod1 <- lacm(polio ~ I(trend * 10^(-3)) + sin.term + cos.term + sin2.term + cos2.term)
mod1
summary(mod1)
## refit with d = 3
mod3 <- update(mod1, d = 3)
summary(mod3)

lacm documentation built on July 1, 2020, 6:53 p.m.

Related to lacm in lacm...