fit.nb.inar1: Fitting Longitudinal Data with Negative Binomial Marginal...

Description Usage Arguments Details Value Source References See Also Examples

View source: R/fit.nb.inar1.r

Description

fit.nb.inar1 fits data using the maximum likelihood of a reparametrized NB-INAR(1) model.

Usage

1
2
3
4
5
6
7
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.

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

1
2
3
4
5
6
#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

Example output

Loading required package: mvtnorm
Loading required package: multcomp
Loading required package: survival
Loading required package: TH.data
Loading required package: MASS

Attaching package: 'TH.data'

The following object is masked from 'package:MASS':

    geyser

Loading required package: Rcpp
Loading required package: geepack
       mu      size       rho 
1.9814528 1.5001866 0.6065152 

spass documentation built on Jan. 13, 2021, 7:57 p.m.

Related to fit.nb.inar1 in spass...