Fits latent autoregressive count models by maximum pairwise likelihood.
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"), …)
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’.
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.
an optional vector specifying a subset of observations to be used in the fitting process.
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
.
an optional list. See the contrasts.arg
of model.matrix.default
.
optional numeric vector with starting values for the model parameters.
optional numeric vector of the same length as the total number of parameters. If supplied, only NA
entries in fixed will be varied.
order of the pairwise likelihood. Defaults to 1.
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.
a logical value indicating whether to compute the maximum pairwise likelihood estimates or not.
number of the Gauss-Hermite quadrature nodes. Defaults to 20.
relative convergence tolerance to be passed to optim
. Defaults to 1e-6.
the maximum number of iterations to be passed to optim
. Defaults to 1000.
the lag length used for computing the bandwith of the sandwich variance. See ‘Details’.
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.
An object of class "lacm"
with the following components:
the number of observations.
the number of regressors, including the intercept.
the order of the pairwise likelihood.
the number of parameters.
the response used.
the model matrix used for the mean response.
the offset used.
the lag length used for the bandwith of the HAC-type standard errors.
logical. Was the model fitted or not?
number of Gauss-Hermite nodes used.
the matched call.
the terms
object used.
logical. Does the model include the latent part?
the numeric vector indicating which parameters are constants.
indeces of the free parameters.
the kernel weights used.
the starting values.
function computing the logarithm of the pairwise likelihood of order d.
function computing the gradient of the pairwise likelihood of order d.
Gauss-Hermite nodes and weights used.
a character string specifying the method argument passed to optim. The default optimization routine is the quasi-Newton algorithm BFGS. See optim
for details.
an integer code indicating convergence of the optimizer. See link{optim}
for details.
a list with components the Gauss-Hermite nodes
and the weights
used for approximating the pairwise likelihood.
the maximum pairwise likelihood value.
the maximum pairwise likelihood estimate.
the jacobian of the individual pairwise likelihood terms.
logical. Was the bread matrix of the sandwich variance computed with the outer product of the individual scores?
the bread matrix.
the meat matrix.
the variance-covariance matrix of the maximum pairwise likelihood estimate.
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.
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).
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.10.1177/0962280220924068.
CLIC
.
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab