This webpage contains two packages of R source code for Win 32 (.zip file) and
R source code for Win 64 OS (.tar.gz file), which have been recently recompiled at R 3.1.1., for the QIF
that we developed for the estimation of regression coefficients in longitudinal
marginal models using quadratic inference functions. The first, qif_1.0-5.zip, works for Win 32 OS and the second, qif_1.0-5.tar.gz (the same), suits for Win 64 OS.
This R program is translated from the original SAS Macro QIF code. Visit site for related materials, including
the lecturenotes of a short course on QIF at the 2009 JSM and the dataset used in the following example.
Install QIF R Package
To install the downloaded qif package, follow the following 5 steps:
- Step 0: Save the zip file in your computer.
- Step 1: Start the R software (version 2.9.0 or newer).
- Step 2: Click on the tab "packages" from the menu bar.
- Step 3: Click on "Install package(s) from local zip files ...".
- Step 4: Find the downloaded qif package from the opened dialogue window in step 3,
and open the downloaded qif package zip file. R should then automatically install it, and the qif package
is ready to be loaded after the installation is finished.
Run QIF R Package
-
To load the R package, simply type "library(qif)" and "library(MASS)" into the R command window,
the qif package is ready for use after this step.
-
The qif package works for several types of links: identity, log and logit; and it accommodates popular
covariance structures such as independence, AR-1, compound symmetry and unstructured.
-
The qif function outputs: estimates of the model parameters; asymptotic covariance matrix; standard errors
and p-values for coefficients; model selection criteria AIC and BIC; number of iterations it takes for algorithm
to converge; fitted values as well as residuals.
- The current version qif R package only supports equal cluster sized and equally spaced data type.
Examples
The marginal logistic model for Multiple Sclerosis Trial data. Trying four different types of covariance structures:
-
out.ind <- qif(exacerbation ~ edss + treatment + time + duration + time2, id=id, data=exacerb, family=binomial, corstr="independence")
-
out.ar1 <-qif(exacerbation ~ treatment + time + duration + time2, id=id, data=exacerb, family=binomial, corstr="AR-1")
-
out.cs <- qif(exacerbation ~ treatment + time + duration + time2, id=id, data=exacerb, family=binomial, corstr="exchangeable")
-
out.un <- qif(exacerbation ~ treatment + time + duration + time2, id=id, data=exacerb, family=binomial, corstr="unstructured")
Important Note: Matrix Inverse Function in QIF
The R package QIF provides two options of computing matrix inverse. The default is from Fortran math library, and the other one is
generalized inverse "ginv" given in R library MASS. You can call option "ginv" through argument "invfun" in "qif()".
For example,
out.cs <- qif(exacerbation ~ treatment + time + duration + time2, id=id, data=exacerb, family=binomial, corstr="exchangeable", invfun="ginv")
If this option is not specified, the default will be used.
To see the full list of output options, use "names(CS)".