iiwgee: Fit an inverse-intensity weighted GEE.

Description Usage Arguments Details Value References See Also Examples

View source: R/IIWcode.R

Description

Implements inverse-intensity weighted GEEs as first described by Lin, Scharfstein and Rosenheck (2004). A Cox proportional hazards model is applied to the visit intensities, and the hazard multipliers are used to compute inverse-intensity weights. Using the approach described by Buzkova and Lumley (2007) avoids the need to compute the baseline hazard.

Usage

1
2
iiwgee(formulagee, formulaph, formulanull = NULL, data, id, time, event,
  family = gaussian, lagvars, invariant, maxfu, lagfirst = NA, first)

Arguments

formulagee

the formula for the GEE model to be fit. The syntax used is the same as in geeglm

formulaph

the formula for the proportional hazards model for the visit intensity that will be used to derive inverse-intensity weights. The formula should usually use the counting process format (i.e. Surv(start,stop,event))

formulanull

if stabilised weights are to be used, the formula for the null model used to stabilise the weights

data

data frame containing the variables in the model

id

character string indicating which column of the data identifies subjects

time

character string indicating which column of the data contains the time at which the visit occurred

event

character string indicating which column of the data indicates whether or not a visit occurred. If every row corresponds to a visit, then this column will consist entirely of ones

family

family to be used in the GEE fit. See geeglm for documentation

lagvars

a vector of variable names corresponding to variables which need to be lagged by one visit to fit the visit intensity model. Typically time will be one of these variables. The function will internally add columns to the data containing the values of the lagged variables from the previous visit. Values of lagged variables for a subject's first visit will be set to NA. To access these variables in specifying the proportional hazards formulae, add ".lag" to the variable you wish to lag. For example, if time is the variable for time, time.lag is the time of the previous visit

invariant

a vector of variable names corresponding to variables in data that are time-invariant. It is not necessary to list every such variable, just those that are invariant and also included in the proportional hazards model

maxfu

the maximum follow-up time(s). If everyone is followed for the same length of time, this can be given as a single value. If individuals have different follow-up times, maxfu should have the same number of elements as there are rows of data

lagfirst

The value of the lagged variable for the first time within each subject. This is helpful if, for example, time is the variable to be lagged and you know that all subjects entered the study at time zero

first

logical variable. If TRUE, the first observation for each individual is assigned an intensity of 1. This is appropriate if the first visit is a baseline visit at which recruitment to the study occurred; in this case the baseline visit is observed with probability 1.

Details

Let the outcome of interest be Y and suppose that subject i has j^{th} observation at T_{ij}. Let N_i(t) be a counting process for the number of observations for subject i up to and including time t. Suppose that N_i has intensity λ given by

λ_i(t)=λ0(t)exp(Z_i(t)γ).

Then the inverse-intensity weights are

exp(-Z_i(t)γ).

If Y_i is the vector of observations for subject i, to be regressed onto X_i (i.e. E(Y_i|X_i)=μ(X_i;β) with g(μ(X_i;beta)=X_iβ, then the inverse-intensity weighted GEE equations are

∑_i \frac{\partialμ_i}{\partialβ}V_i^{-1}Δ_i(Y_i X_iβ)=0

, where Δ_i is a diagonal matrix with j^{th} entry equal to \exp(-Z_i(T_{ij})γ) and $V_i$ is the working variance matrix. Warning: Due to the way some gee functions incorporate weights, if using inverse-intensity weighting you should use working independence.

Value

a list, with the following elements:

geefit

the fitted GEE, see documentation for geeglm for details

phfit

the fitted proportional hazards model, see documentation for coxph for details

References

See Also

Other iiw: iiw.weights, iiw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(nlme)
data(Phenobarb)
library(survival)
library(geepack)
Phenobarb$id <- as.numeric(Phenobarb$Subject)
Phenobarb$event <- as.numeric(is.finite(Phenobarb$conc))
Phenobarb.conc <- Phenobarb[is.finite(Phenobarb$conc),]
miiwgee <- iiwgee(conc ~ time*log(time),
Surv(time.lag,time,event)~I(conc.lag>0) + conc.lag + cluster(id),
formulanull=NULL,id="id",time="time",event="event",data=Phenobarb.conc,invariant="id",
lagvars=c("time","conc"),maxfu=NULL,lagfirst=0,first=TRUE)
summary(miiwgee$geefit)
summary(miiwgee$phfit)

# compare to results without weighting
m <- geeglm(conc ~ time*log(time) , id=Subject, data=Phenobarb); print(summary(m))
time <- (1:200)
unweighted <- cbind(rep(1,200),time,log(time),time*log(time))%*%m$coefficients
weighted <- cbind(rep(1,200),time,log(time),time*log(time))%*%miiwgee$geefit$coefficients
plot(Phenobarb$time,Phenobarb$conc,xlim=c(0,200),pch=16)
lines(time,unweighted,type="l")
lines(time,weighted,col=2)
legend (0,60,legend=c("Unweighted","Inverse-intensity weighted"),col=1:2,bty="n",lty=1)

IrregLong documentation built on May 2, 2019, 8:30 a.m.