spass (version 1.2)

fit.nb.inar1: 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 mu, size and rho, respectively.

upper

vector of upper bounds for estimated parameters mu, size and rho, respectively.

method

algorithm used for minimization of the likelihood, see optim for details.

start

vector of starting values for estimated parameters mu, size and rho, respectively, used for optimization.

Value

fit.nb.inar1 return estimates of the mean mu, dispersion parameter size and correlation coefficient rho.

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.

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

Run this code
# NOT RUN {
#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
# }

Run the code above in your browser using DataLab