fit.nb.inar1 {spass} | R Documentation |
Fitting Longitudinal Data with Negative Binomial Marginal Distribution and Autoregressive Correlation Structure of Order One: NB-INAR(1)
Description
fit.nb.inar1
fits data using the maximum likelihood of a reparametrized NB-INAR(1) model.
Usage
fit.nb.inar1(
x,
lower = rep(10, 3)^-5,
upper = c(10^5, 10^5, 1 - 10^-5),
method = "L-BFGS-B",
start
)
Arguments
x |
a matrix or data frame containing count data which is to be fitted. Columns correspond to time points, rows to observations. |
lower |
vector of lower bounds for estimated parameters |
upper |
vector of upper bounds for estimated parameters |
method |
algorithm used for minimization of the likelihood, see |
start |
vector of starting values for estimated parameters |
Details
the function fit.nb.inar1
fits a reparametrization of the NB-INAR(1) model as found in McKenzie (1986). The reparametrized model
assumes equal means and dispersion parameter between time points with an autoregressive correlation structure. The function is especially useful
for estimating parameters for an initial sample size calculation using n.nb.inar1
. The fitting function allows for incomplete follow up,
but not for intermittent missingness.
Value
fit.nb.inar1
return estimates of the mean mu
, dispersion parameter size
and correlation coefficient rho
.
Source
fit.nb.inar1
uses code contributed by Thomas Asendorf.
References
McKenzie Ed (1986), Autoregressive Moving-Average Processes with Negative-Binomial and Geometric Marginal Distributions. Advances in Applied Probability Vol. 18, No. 3, pp. 679-705.
See Also
rnbinom.inar1
for information on the NB-INAR(1) model, n.nb.inar1
for calculating
initial sample size required when performing inference, bssr.nb.inar1
for blinded
sample size reestimation within a running trial, optim
for more information on the used minimization algorithms.
Examples
#Generate data from the NB-INAR(1) model
set.seed(8)
random<-rnbinom.inar1(n=1000, size=1.5, mu=2, rho=0.6, tp=7)
estimate<-fit.nb.inar1(random)
estimate