# fit.nb.gf: Fitting Longitudinal Data from a Gamma Frailty Model with... In spass: Study Planning and Adaptation of Sample Size

## Description

`fit.nb.gf` fits data using the pseudo maximum likelihood of a Gamma frailty model

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```fit.nb.gf( dataC, dataE, trend = c("constant", "exponential"), lower, upper, method = "L-BFGS-B", start, approx = 20, rho = FALSE, H0 = FALSE, h0 = 0 ) ```

## Arguments

 `dataC` a matrix containing count data from the control group, which is to be fitted. Columns correspond to time points, rows to observations. `dataE` a matrix containing count data from the experiment group, which is to be fitted. Columns correspond to time points, rows to observations. `trend` the trend which assumed to underlying in the data. `lower` vector of lower bounds for estimated parameters `lambda`, `size` and `rho`, respectively. `upper` vector of upper bounds for estimated parameters `lambda`, `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. `approx` numer of iterations in numerical calculation of the sandwich estimator, see 'Details'. `rho` indicates whether or not to calculate the correlation coefficient of Gamma frailties. Must be TRUE or FALSE. `H0` indicates whether or not to calculate the hessian and outer gradient matrix under the null hypothesis, see 'Details'. `h0` the value against which is tested under the null

## Details

the function `fit.nb.gf` fits a Gamma frailty model as found in Fiocco (2009). The fitting function allows for incomplete follow up, but not for intermittent missingness.

When calculating the expected sandwich estimator required for the sample size, certain terms can not be computed analytically and have to be approximated numerically. The value `approx` defines how close the approximation is to the true expected sandwich estimator. High values of `approx` provide better approximations but are compuationally more expensive.

If parameter H0 is set to TRUE, the hessian and outer gradient are calculated under the assumption that `lambda` ≥q `h0` if `trend = "constant"` or `lambda` ≥q `h0` if `trend = "exponential"`.

## Value

`fit.nb.gf` returns estimates of the trend parameters `lambda`, dispersion parameter `size`, Hessian matrix `hessian`, outer gradient product matrix `ogradient` and, if inquired, correlation coefficient `rho`.

## Source

`fit.nb.gf` uses code contributed by Thomas Asendorf.

## References

Fiocco M, Putter H, Van Houwelingen JC, (2009), A new serially correlated gamma-frailty process for longitudinal count data Biostatistics Vol. 10, No. 2, pp. 245-257.

## See Also

`rnbinom.gf` for information on the Gamma frailty model, `n.nb.gf` for calculating initial sample size required when performing inference, `bssr.nb.gf` for blinded sample size reestimation within a running trial, `optim` for more information on the used minimization algorithms.

## Examples

 ```1 2 3 4``` ```#Generate data from the Gamma frailty model random<-get.groups(n=c(1000,1000), size=c(0.7, 0.7), lambda=c(0.8, -0.5), rho=c(0.6, 0.6), tp=7, trend="constant") fit.nb.gf(dataC=random[1001:2000,], dataE=random[1:1000,], trend="constant") ```

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