lacm {lacm} | R Documentation |
Fitting Latent Autoregressive Count Models by Maximum Pairwise Likelihood
Description
Fits latent autoregressive count models by maximum pairwise likelihood.
Usage
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 |
data |
an optional data frame, list or environment (or object
coercible by |
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 |
contrasts |
an optional list. See the |
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 |
d |
order of the pairwise likelihood. Defaults to 1. |
kernel.type |
one of |
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 |
opt.method |
one of |
maxit.opt |
the maximum number of iterations to be passed to |
sandwich.lag |
the lag length used for computing the bandwith of the sandwich variance. See ‘Details’. |
bread.method |
one of |
... |
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 |
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 |
convergence |
an integer code indicating convergence of the optimizer. See |
gh |
a list with components the Gauss-Hermite |
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
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)