# NOT RUN {
# Example with unemployment data
library(Ecdat)
data(UnempDur)
# Select subsample
SubUnempDur <- UnempDur [1:100, ]
# Estimate GEE models for all events
estGEE <- compRisksGEE(datShort = SubUnempDur, dataTransform = "dataLongCompRisks",
corstr = "independence", formulaVariable =~ timeInt + age + ui + logwage * ui,
eventColumns = c("censor1", "censor2", "censor3", "censor4"), timeColumn = "spell")
# }
# NOT RUN {
# Estimate covariance matrix of estimated parameters and competing events
estCovar <- covarGEE(modelEst=estGEE)
estCovar
# Covariances of estimated parameters of one event equal the diagonal blocks
lengthParameters <- length(estGEE[[1]]$coefficients)
noCompEvents <- length(estGEE)
meanAbsError <- rep(NA, noCompEvents)
for( k in 1:noCompEvents ){
relInd <- (1 + (k-1) * lengthParameters) : (k * lengthParameters)
meanAbsError[k] <- mean(abs(estCovar[relInd, relInd] - estGEE[[k]]$geese$vbeta))
}
mean(meanAbsError)
# -> Covariance estimates within each event are equal to diagonal blocks in
# complete covariance matrix with very small differences due to numerical accuracy.
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab