Learn R Programming

qif (version 1.5)

qif: Function to Solve a Quadratic Inference Function Model

Description

Produces an object of class "qif" which is a Quadratic Inference Function fit of the balanced longitudinal data.

Usage

qif(formula = formula(data), id = id, data = parent.frame(),
  b = NULL, tol = 1e-08, maxiter = 1000, family = gaussian,
  corstr = "independence", invfun = "finv")

Arguments

formula

a formula expression as for other regression models, of the form response ~ predictors. See the documentation of lm and formula for details.

id

a vector which identifies the clusters. The length of id should be the same as the number of observations. Data are assumed to be sorted so that observations on a cluster are contiguous rows for all entities in the formula.

data

an optional data frame in which to interpret the variables occurring in the formula, along with the id variables.

b

an initial estimate for the parameters.

tol

the tolerance used in the fitting algorithm.

maxiter

the maximum number of iterations.

family

a family object: a list of functions and expressions for defining canonical link and variance functions. Families supported in qif are gaussian, binomial, poisson, and gamma; see the glm and formula documentation. Some links are not currently available: probit link for binomial family and log link for gamma family.

corstr

a character string specifying the correlation structure. The following are permitted: "independence", "exchangeable", "AR-1" and "unstructured".

invfun

a character string specifying the matrix inverse function. The following are permitted: "finv" and "ginv".

Value

A list containing:

  • title: name of qif

  • version: the current version of qif

  • model: analysis model for link function, variance function and correlation struture

  • terms: analysis model for link function, variance function and correlation struture

  • iteration: the number of iterations

  • coefficients: beta esitmates value

  • linear.perdictors: linear predictor value

  • fitted.value: fitted value of y

  • x: the perdicted matrix

  • y: the response

  • residuals: y-mu

  • pearson.resi: pearson residuals

  • scale: the scale of fitted model

  • family: the type of distribution

  • id: model fitted value

  • max.id: max number of each steps

  • xnames: the values are X name of qif

  • statistics: The qif statistics

  • Xnames: the name X matrix in qif

  • parameter: parameter estimates

  • covariance: Covariance of coefficients

Details

qif provides two options of computing matrix inverses. The default is from Fortran math library, and the other one is generalized inverse "ginv" given in R package MASS. You can call option "ginv" through argument "invfun" in "qif()".

References

Qu A, Lindsay BG, Li B. Improving generalized estimating equations using quadratic inference functions. Biometrika 2000, 87 823-836.

Qu A, Song P X-K. Assessing robustness of generalised estimating equations and quadratic inference functions. Biometrika 2004, 91 447-459.

Qu A, Lindsay BG. Building adaptive estimating equations when inverse of covariance estimation is difficult. J. Roy. Statist. Soc. B 2003, 65, 127-142.

See Also

glm, lm, formula.

Examples

Run this code
# NOT RUN {
## Marginal log-linear model for the epileptic seizures count data
## (Diggle et al., 2002, Analysis of Longitudinal Data, 2nd Ed., Oxford Press).

# Read in the epilepsy data set:
data(epil)

# Fit the QIF model:
fit <- qif(y ~ base + trt + lage + V4, id=subject, data=epil,
                                       family=poisson, corstr="AR-1")
# }
# NOT RUN {
# Alternately, use ginv() from package MASS
fit <- qif(y ~ base + trt + lage + V4, id=subject, data=epil,
                      family=poisson, corstr="AR-1", invfun = "ginv")
# }
# NOT RUN {
# Print summary of QIF fit:
summary(fit)
# }
# NOT RUN {
## Second example: MS study
data(exacerb)

qif_BIN_IND<-qif(exacerbation ~ treatment + time + duration + time2, id=id,
                        data=exacerb, family=binomial, corstr="independence")
qif_BIN_AR1<-qif(exacerbation ~ treatment + time + duration + time2, id=id,
                        data=exacerb, family=binomial, corstr="AR-1")
qif_BIN_CS<-qif(exacerbation ~ treatment + time + duration + time2, id=id,
                        data=exacerb, family=binomial, corstr="exchangeable")
qif_BIN_UN<-qif(exacerbation ~ treatment + time + duration + time2, id=id,
                        data=exacerb, family=binomial, corstr="unstructured")

summary(qif_BIN_CS)

qif_BIN_CS$statistics

qif_BIN_CS$covariance
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab