1 Appendix A: special cases and implementation
1.1 Special cases of the case-time-control design
Further assumptions can be made about the exposure time-trendf(t). For notational simplicity we only consider one reference period below, i.e. special cases of (5) in the main text but analogous special cases can be considered for two reference periods.
The case-crossover design: One assumes no time-trend i.e.,f(t) =constant. The controls are ignored as they do not contain any information aboutβ.
∏
i∶E01
expit(β) × ∏
i∶E10
(1−expit(β) )
The case-time-control design with linear time-trend: A linear time-trend in exposure on the logit-scale impliesf(t) = α1t. The controls are here needed as we can not distinguish the time-trend effectα1from the effect of exposure on outcome βusing just the cases.
∏
i∶E01
expit(β Ci(t0) +α1) × ∏
i∶E10
(1−expit(β Ci(t0) +α1) ) here the difference between two time periods is scaled to unit size i.e.,t0−t1=1.
The case-time-control design with non-linear time-trend: One models the time-trend using a polynomial e.g.,f(t) = α1t+α2t2. The controls are still needed as the linear part of the time-trend effectα1can not be separated from the effect of exposure on outcomeβusing just the cases.
∏
i∶E01
expit(β Ci(t0) +α1+α2(t20−t21))
× ∏
i∶E10
(1−expit(β Ci(t0) +α1+α2(t20−t21)) )
again the difference between two time periods is scaled to unit size andt0andt1are person-specific.
Also any likelihood function (5) wheref(t)is defined via regression splines constitutes a usable special case of the case- time-control design. All special cases can be extended to the two reference period setup. The difference is that we actually do not need the controls when we have two reference period as the distinction problems betweenβand a linear time-trend α1disappear. The main advantage of still using controls in a two reference setup is therefore to gain power and increase robustness against misspecification off.
1.2 Implementation
Case-time-control analysis can be implemented in SAS (version 9.2, SAS, Inc., Cary, NC) using proc logistic. Data should be organised with one record per person for each period. Exposure-status should be modelled as dependent variable and event-status and time as predictors. Finally the strata=person option ensures that it is the conditional likelihood that is being maximized. Another option is to model exposure status as a survival status at an artificial chosen dummy survival time, using e.g., the phreg procedure in SAS or the coxph function in R (version 2.12.2).
2 Appendix B: simulations
2.1 Comment on simulations
Note that a high value of the autocorrelationκin (10) implies a high probability that an exposed person remains exposed in the following period in contradiction with the the assumption of independent within-individual exposure history. So strong autocorrelationκwill increase the proportion of persons exposed as time increases as exposed persons then tend to remain exposed. High values of the individual exposure-risk deviationσamplifies this phenomenon. These increasing exposure tendencies can though be corrected by a suitably chosen value ofα0so that the overall proportion of persons exposed does not increase towards one as time increases. For each choice ofκandσin the simulations we therefore choose anα0using pre-simulations (not reported) such that in a setup with no time-effect i.e.,γ=0, approximately5%of the population will be exposed both attime=1andtime=60.
We letγtake the fixed value oflog(1.03)in all reported simulations. The proportion exposed attime=60will then differ between7%and18%(not reported) depending on the choice ofκ,σandα0in the simulation scenarios reported in Table 1.
A naive OR-estimation ofκin the data from Weeke et al.1suggests aκvalue close to 9. This value is found comparing odds for exposure at timet1given exposure at timet2with odds for exposure at timet1given non-exposure at timet2. In short
ˆ
κnaive = log(N11/N10
N01/N00)
where, e.gN11is the number of subjects exposed in both reference periods andN01is the number of controls non-exposed in the second reference period(t2)and exposed in the first reference period(t1).
This naiveκ-estimate, however, is biased upwards as it also reflects, in part, the autocorrelation induced by the random effectsAi. Again one should notice that high values ofκand the exposure-risk standard deviationσlead to an increasing proportion of exposed persons as time increases, regardless of exposure time-trend. In our simulated data we therefore choose different combinations ofκandσwhich in the simulated data lead to a naive estimate ofκclose to 9. The naive kappa values from the simulations in Table 1 are reported with relevant parameter values in Table A1 below.
Table A1.
exp(β) σ κ ˆκnaive
1.40 2 0 2.04
1.40 2 1 2.94
1.40 2 2 3.84
1.40 12 3 8.67
1.40 8 4 8.72
1.40 4 6 9.07
Finally we choose fixed values of the event risk baseline parameterβ0equal to−6and the individual event risk deviation ξ=0.5in all our simulations.
Using the three R-functions in Appendix section 2.2 in a parallel simulation frame one can obtain the estimates in Table 1.
All simulations were done using R version 2.12.2 (R Development Core Team (2008). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URL http://www.R- project.org.)
2.2 R code for simulations
##################### Person function ######################
# function which generates one persons exposure and event history at 60 time
# points if variable time is set to 80. At the beginnnig 80 time points are
# then simulated with right to exposure, but the first 20 are pre-time points
# which purpose is to ensure 5% exposed at time=20 which is then considered
# the initial time point equal to t=0.
# pre-simulations are needed to choose aa0 and a0 such that 5% are exposed both at
# time=0 and t=60 when autocorrelation is present.
##### function arguments #####
# time: number of calender periods (including 20 pre-periods).
# P: number of periods (reference+washout+index).
# kappa: autocorrelation term.
# sigma: personal exposure risk standard deviation.
# a0: baseline exposure risk parameter.
# aa0: preparameter to ensure 5% exposed to t=0. Changes with sigma.
# gamma: period parameter.
# xi: personal case risk standard deviation.
# b0: baseline event risk parameter.
# beta: effect of exposure on event risk.
##### function output: a matrix with (time-20) rows (if control) or P rows (if case)
# exposure: 0-1 indicating exposed in time-period or not
# event: 0-1 indicating if an event occurs in the specific time-period or not.
person <- function(time,P,kappa,sigma,a0,aa0,gamma,xi,b0,beta){
# personalExposureRiskParameter A <- rnorm(1,0,sigma)
exposure <- numeric(time)
prevExposure <- rbinom(1,1,expit(aa0+A)) exposure[1]<-prevExposure
for (t in 2:time){
exposureRisk <- expit(a0 + A +gamma * (t-20)*ceiling((t-20)/time) + kappa * prevExposure)
exposure[t] <- rbinom(1,1,exposureRisk) prevExposure <- exposure[t]
}
# choose new initial time point.
exposure<-exposure[21:time]
# personalCaseriskParameter B <-rnorm(1,0,xi)
caseRisk <- expit(b0+B+beta*exposure)
event <- rbinom(60,1,caseRisk) if (any(event[1:(P-1)]>0)) {
# if event occurs at time P-1 record is not useable.
out <- NULL }
else{
out <- cbind(exposure=exposure,event=event) index <- which(event==1)
if (length(index)>0){
index <- index[[1]]
out <- cbind(time=((index-P+1):index),out[(index-P+1):index,]) attr(out,"type") <- "case"
} else{
attr(out,"type") <- "control"
} } out }
# set.seed(1)
# person(time=80,P=5,kappa=2,sigma=2,a0=-4.91,aa0=-4.40,
# gamma=log(1.03),xi=0.5,b0=-6,beta=log(1.40))
##################### Population function ######################
# population function which calls the person function N times to create
# an entire simulated population of size N. Cases with too few reference
# periods (events at time t=1,..P-1) are removed hence the final population
# may be smaller than N.
##### function arguments identical to the person function.
##### function output: a matrix with P rows per subject (both cases and controls)
# time: exact timepoints for subjects.
# exposure: 0-1 indicating exposed in time-period or not
# event: 0-1 indicating if an event occurs in the specific time-period or not.
# case: 0-1 indicating case (1) or control (0)
# person.id: subject identifier
# periode: indicate reference period index-period(0) or reference period number.
getPopulation <- function(N,time,P,kappa,sigma,a0,aa0,gamma,xi,b0,beta){
population <- lapply(1:N,function(i){
person(time=time,P=P,kappa=kappa,sigma=sigma,a0=a0,aa0=aa0, gamma=gamma,xi=xi,b0=b0,beta=beta)
})
population <- population[!sapply(population,is.null)]
isCase <- sapply(population,function(x){attr(x,"type")=="case"}) sumCase<-sum(isCase)
# ensure that we will have enough cases and controls
if (sumCase<2 | length(population)-sumCase < 4*sumCase) return(NULL) cases <- do.call("rbind",population[isCase])
# Identify time point when event occurs
caseIndices <- cases[seq(5,5*sumCase,by=5),"time"]
controlIndices <- rep(caseIndices,rep(4,length(caseIndices))) controlPopulation <- population[!isCase]
controlPopulation <- controlPopulation[1:length(controlIndices)]
controls <- lapply(1:length(controlPopulation),function(i){
index <- controlIndices[i]
x <- controlPopulation[[i]]
x<-cbind(time=((index-P+1):index),x[(index-P+1):index,]) })
controls<-do.call("rbind",controls) data<-rbind(cases,controls)
data<-cbind(data,case=(rep(c(1,0),c(P*sumCase,P*4*sumCase))), person.id=rep(seq(1:I(sumCase*5)),
rep(5,I(sumCase*5))),periode=rep((4:0), I(sumCase*5)))
data }
# set.seed(1)
# getPopulation(N=100,time=80,P=5,kappa=2,sigma=2,a0=-4.91,aa0=-4.40,
# gamma=log(1.03),xi=0.5,b0=-6,beta=log(1.40))
##################### Analysis function ######################
# cox analysis of four different case-time-control models used on the simulated data.
# the parameter u is a counter for use in parallel simulation.
##### function arguments identical to the getPopulation and person functions.
##### function output a matrix with P rows per subject (both cases and controls)
## columns
# 2Ref1W: results from analysis with 2 reference periods and 1 wash-out period
# between index and first reference period.
# 2Ref2W: results from analysis with 2 reference periods and 2 wash-out period
# between index and first reference period and first and second reference period.
# 1Ref1W: results from analysis with 1 reference periods and 1 wash-out period
# between index and first reference period.
# 1Ref: results from analysis with 1 reference periods and no wash-out period.
## rows
# exp(event): exp(beta), the exposure outcome effect (OR).
# exp(invper): exp(gamma), the period effect (OR).
# se(event): standard error for beta.
# se(invper): standard error for gamma.
# n.disc: number of discordant subject controbuting to the analysis
# (unmatched not included).
# n.conc number of concordant subject controbuting to the analysis
# (unmatched not included).
# disc.cases: number of cases with discordant exposure history.
# total.cases: overall number of cases contributing to the analysis.
# kappaFake: a rough estimation of the autocorrelation kappa.
# time: exact timepoints for subjects.
# exposure: 0-1 indicating exposed in time-period or not
# event: 0-1 indicating if an event occurs in the specific time-period or not.
# case: 0-1 indicating case (1) or control (0)
# person.id: subject identifier
# periode: indication index-period(0) or reference periods.
library(survival)
analyse <- function(u,N,time,P,kappa,sigma,a0,aa0,gamma,xi,b0,beta){
set.seed(u)
data <- getPopulation(N=N,time=time,P=P,kappa=kappa,sigma=sigma,a0=a0,aa0=aa0, gamma=gamma,xi=xi,b0=b0,beta=beta)
if(is.null(data)==TRUE) NULL else {
## set warn = 2 because ’try’ needs an error message, but non-convergent
## models only return warnings if warn=0 (the default).
options(warn=2)
N.eff <- length(unique(data[,"person.id"]))
## Two reference periods and one washout: c(-,x,x,-,x) ToRefEnW <- rep(c(FALSE,TRUE,TRUE,FALSE,TRUE),)
## Two reference periods and two washout periods: c(x,-,x,-,x) ToRefToW <- rep(c(TRUE,FALSE,TRUE,FALSE,TRUE),N.eff)
## One reference period and one washout: c(-,-,x,-,x) OneRefOneW <- rep(c(FALSE,FALSE,TRUE,FALSE,TRUE),N.eff)
## One reference period and no washout: c(-,-,-,x,x) OneRef <- rep(c(FALSE,FALSE,FALSE,TRUE,TRUE),N.eff)
# for the naiv kappa estimation
per2og3<-rep(c(FALSE,TRUE,TRUE,FALSE,FALSE),N.eff)
## fit cox models in a loop over subsets
subsets <- list("2Ref1W"=ToRefEnW,"2Ref2W"=ToRefToW,"1Ref1W"=OneRefOneW,
"1Ref"=OneRef) models <- lapply(1:4,function(m){
sel <- data[subsets[[m]],]
n.periods <- ifelse((m %in% c(1,2)),3,2)
discordant <- unlist(tapply(sel[,"exposure"],sel[,"person.id"],function(e){
sume<-sum(e)
if (sum(e)==0 || sum(e)==n.periods) rep(FALSE,n.periods) else rep(TRUE,n.periods)
}))
## count discordant and concordant exposure histories n.disc <- sum(discordant)/n.periods
n.conc <- N.eff-n.disc
total.cases<-sum(sel[,4])/n.periods
## remove ids with concordant exposure history sel <- sel[discordant==TRUE,]
disc.cases<-sum(sel[,4])/n.periods if(nrow(sel)==0){
res<-c(NA,NA,NA,NA) } else {
sel<-data.frame(cbind(sel,invper=-sel[,"periode"],dummy=1))
## TO SAVE computer memory coxph is calculated with method=default
## in OneRef as ties is not a problem here.
model <- try(coxph(Surv(dummy,exposure)˜event+strata(person.id)+invper, method=ifelse((m %in% c(3,4)),"efron","exact"), data=sel),silent=TRUE)
if (class(model) == "try-error"){
res <- c(NA,NA,NA,NA) } else {
res <- c(exp(model$coef), sqrt(diag(model$var))) }
}
c(res,n.disc,n.conc,disc.cases,total.cases) })
options(warn=0)
# calculate kappa estimate, remove cases kapdata <- data[per2og3,]
sumCase<-sum(kapdata[,"case"])
kapdata<-kapdata[-(1:sumCase),"exposure"]
NRowkap<-NROW(kapdata)
tab<-table(paste("N",kapdata[seq(1,NRowkap-1,by=2)],kapdata[seq(2,NRowkap,by=2)], sep=""))
ifelse(length(tab)<4,kappaFake<-NA,kappaFake<-log((tab[4]/tab[3])/(tab[2]/tab[1])))
# make result matrix
results <- do.call("cbind",models)
results<-rbind(results,rep(kappaFake,4))
colnames(results)<-c("2Ref1W","2Ref2W","1Ref1W","1Ref")
rownames(results)<-c("exp(event)","exp(invper)","se(event)","se(invper)",
"n.disc","n.conc","disc.cases","total.cases","kappaFake") results
} }
# print(analyse(u=1,N=1000,time=80,P=5,kappa=2,sigma=2,a0=-4.91,aa0=-4.40,
# gamma=log(1.03),xi=0.5,b0=-6,beta=log(1.40)))
3 Appendix C: calculations
In the following we defineexpit(x) =exp(x)/(1+exp(x))and repeatedly use thatexpit(x)/(1−expit(x)) =exp(x).
We suppress the person-specific indexiin part of the calculations, as we e.g., writeE(t0)instead ofEi(t0)to denote the exposure status for personiin the index period belonging to this person. We use the shorthand notationS=1for being sampled to the study,Biis a person-specific effect for event andAia person-specific effect for exposure.
Finally in some parts, if needed due to lack of space we will write “case” or “control” in the formulas instead of the more formal(C(t0) =1, C(u) =0, u<t0)for a case and(C(t0) =0, C(u) =0, u<t0)for a control.
3.1 Likelihood-calculations for 1 reference period
3.1.1 Cases:
lemma 3.1.1.
(1)P(E(t0) =1, E(t1) =0∣E(t0) +E(t1) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1) = eβ+f(t0) ef(t1)+eβ+f(t0) (2)P(E(t0) =0, E(t1) =1∣E(t0) +E(t1) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1) = ef(t1)
ef(t1)+eβ+f(t0)
Proof.
P(E(t0) =1, E(t1) =0∣E(t0) +E(t1) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1)
=
P(E(t0) =1, E(t1) =0,Ai,Bi, S=1,case)
P(E(t0) =1, E(t1) =0,Ai,Bi, S=1,case) +P(E(t0) =0, E(t1) =1,Ai,Bi, S=1,case)
= (1+
P(E(t0) =0, E(t1) =1,Ai,Bi, S=1,case) P(E(t0) =1, E(t1) =0,Ai,Bi, S=1,case)
)
−1
= (1+
P(S=1∣P(E(t0) =0, E(t1) =1,Ai,Bi,case)P(E(t0) =0, E(t1) =1,Ai,Bi,case) P(S=1∣P(E(t0) =1, E(t1) =0,Ai,Bi,case)P(E(t0) =1, E(t1) =0,Ai,Bi,case))
−1
= (1+
q1P(E(t0) =0, E(t1) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi) q1P(E(t0) =1, E(t1) =0, C(t0) =1, C(u) =0, u<t0,Ai,Bi)
)
−1
= (1+
P(C(t0) =1∣E(t0) =0, E(t1) =1, C(u) =0, u<t0,Ai,Bi) P(C(t0) =1∣E(t0) =1, E(t1) =0, C(u) =0, u<t0,Ai,Bi)
×
P(E(t0) =0, E(t1) =1, C(u) =0, u<t0,Ai,Bi) P(E(t0) =1, E(t1) =0, C(u) =0, u<t0,Ai,Bi)
)
−1
= (1+
expit(β0+Bi) expit(β0+Bi+β)
P(E(t0) =0, E(t1) =1, C(u) =0, u<t0,Ai,Bi) P(E(t0) =1, E(t1) =0, C(u) =0, u<t0,Ai,Bi)
)
−1
= (1+
expit(β0+Bi) expit(β0+Bi+β)
P(E(t0) =0∣E(t1) =1, C(u) =0, u<t0,Ai,Bi) P(E(t0) =1∣E(t1) =0, C(u) =0, u<t0,Ai,Bi)
×
P(E(t1) =1, C(u) =0, u<t0,Ai,Bi) P(E(t1) =0, C(u) =0, u<t0,Ai,Bi)
)
−1
= (1+
expit(β0+Bi) expit(β0+Bi+β)
1−expit(α0+Ai+f(t0)) expit(α0+Ai+f(t0))
P(E(t1) =1, C(u) =0, u<t0,Ai,Bi) P(E(t1) =0, C(u) =0, u<t0,Ai,Bi)
)
−1
= (1+
expit(β0+Bi) expit(β0+Bi+β)
1−expit(α0+Ai+f(t0)) expit(α0+Ai+f(t0))
×
P(C(t1) =0∣E(t1) =1, C(u) =0, u<t1,Ai,Bi)P(E(t1) =1, C(u) =0, u<t1,Ai,Bi) P(C(t1) =0∣E(t1) =0, C(u) =0, u<t1,Ai,Bi)P(E(t1) =0, C(u) =0, u<t1,Ai,Bi)
)
−1
= (1+
expit(β0+Bi) expit(β0+Bi+β)
1−expit(α0+Ai+f(t0)) expit(α0+Ai+f(t0))
1−expit(β0+Bi+β) 1−expit(β0+Bi)
expit(α0+Ai+f(t1)) 1−expit(α0+Ai+f(t1))
)
−1
= (1+
1−expit(β0+Bi+β) expit(β0+Bi+β)
expit(β0+Bi) 1−expit(β0+Bi)
eα0+Ai+f(t1) eα0+Ai+f(t0) )
−1
= (1+
eβ0+Bi
eβ0+Bi+β ef(t1)−f(t0))
−1
=
eβ+f(t0) eβ+f(t0)+ef(t1)
Similarly one can show that:
P(E(t0) =0, E(t1) =1) ∣E(t0) +E(t1) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1) =
ef(t1) ef(t1)+eβ+f(t0)
3.1.2 Controls:
lemma 3.1.2.
(1)P(E(t0) =1, E(t1) =0∣E(t0) +E(t1) =1, C(t0) =0, C(u) =0, u<t0,Ai,Bi, S=1) = ef(t0) ef(t0)+ef(t1) (2)P(E(t0) =0, E(t1) =1) ∣E(t0) +E(t1) =1, C(t0) =0, C(u) =0, u<t0,Ai,Bi, S=1) = ef(t1)
ef(t0)+ef(t1) Proof. Completely analogous to the proof for the cases except that theβ-terms equals out for the controls.
3.2 Likelihood-calculations for 2 reference periods
3.2.1 Cases:
lemma 3.2.1.
1. P(E(t0) =1, E(t1) =0, E(t2) =0∣
2
∑
j=0
E(tj) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1)
=
eβ+f(t0) eβ+f(t0)+ef(t1)+ef(t2)
2. P(E(t0) =0, E(t1) =1, E(t2) =0∣
2
∑
j=0
E(tj) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1)
=
ef(t1)
eβ+f(t0)+ef(t1)+ef(t2)
3. P(E(t0) =0, E(t1) =0, E(t2) =1∣
2
∑
j=0
E(tj) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1)
=
ef(t2)
eβ+f(t0)+ef(t1)+ef(t2)
4. P(E(t0) =1, E(t1) =1, E(t2) =0∣
2
∑
j=0
E(tj) =2, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1)
=
eβ+f(t0)+f(t1)
eβ+f(t0)+f(t1)+eβ+f(t0)+f(t2)+ef(t1)+f(t2)
5. P(E(t0) =1, E(t1) =0, E(t2) =1∣
2
∑
j=0
E(tj) =2, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1)
=
eβ+f(t0)+f(t2)
eβ+f(t0)+f(t1)+eβ+f(t0)+f(t2)+ef(t1)+f(t2)
6. P(E(t0) =0, E(t1) =1, E(t2) =1∣
2
∑
j=0
E(tj) =2, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1)
=
ef(t1)+f(t2)
eβ+f(t0)+f(t1)+eβ+f(t0)+f(t2)+ef(t1)+f(t2)
Proof. The proofs for 1.-6. are similar. We outline 5. in details.
P(E(t0) =1, E(t1) =0, E(t2) =1) ∣
2
∑
j=0
E(tj) =2, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1)
= (1+
P(E(t0) =1, E(t1) =1, E(t2) =0, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1) P(E(t0) =1, E(t1) =0, E(t1) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1)
+
P(E(t0) =0, E(t1) =1, E(t2) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1) P(E(t0) =1, E(t1) =0, E(t1) =1, C(t0) =1, C(u) =0, u<t0,Ai,Bi, S=1)
)
−1
=
⎛
⎝ 1+
P(C(t0) =1∣E(t0) =1, E(t1) =1, E(t2) =0, C(u) =0, u<t0,Ai,Bi) P(C(t0) =1∣E(t0) =1, E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
×
P(E(t0) =1, E(t1) =1, E(t2) =0, C(u) =0, u<t0,Ai,Bi) P(E(t0) =1, E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
+
P(C(t0) =1∣E(t0) =0, E(t1) =1, E(t2) =1, C(u) =0, u<t0,Ai,Bi) P(C(t0) =1∣E(t0) =1, E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
×
P(E(t0) =0, E(t1) =1, E(t2) =1, C(u) =0, u<t0,Ai,Bi) P(E(t0) =1, E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
⎞
⎠
−1
=
⎛
⎝ 1+
expit(β0+Bi+β) expit(β0+Bi+β)
P(E(t0) =1, E(t1) =1, E(t2) =0, C(u) =0, u<t0,Ai,Bi) P(E(t0) =1, E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
+
expit(β0+Bi) expit(β0+Bi+β)
P(E(t0) =0, E(t1) =1, E(t2) =1, C(u) =0, u<t0,Ai,Bi) P(E(t0) =1, E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
⎞
⎠
−1
=
⎛
⎝ 1+
P(E(t0) =1∣E(t1) =1, E(t2) =0, C(u) =0, u<t0,Ai,Bi) P(E(t0) =1∣E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
×
P(E(t1) =1, E(t2) =0, C(u) =0, u<t0,Ai,Bi) P(E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi) +
expit(β0+Bi) expit(β0+Bi+β)
P(E(t0) =0∣E(t1) =1, E(t2) =1, C(u) =0, u<t0,Ai,Bi) P(E(t0) =1∣E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
×
P(E(t1) =1, E(t2) =1, C(u) =0, u<t0,Ai,Bi) P(E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
⎞
⎠
−1
=
⎛
⎝ 1+
P(E(t1) =1, E(t2) =0, C(u) =0, u<t0,Ai,Bi) P(E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
+
expit(β0+Bi) expit(β0+Bi+β)
×
1−expit(α0+Ai+f(t0)) expit(α0+Ai+f(t0))
P(E(t1) =1, E(t2) =1, C(u) =0, u<t0,Ai,Bi) P(E(t1) =0, E(t2) =1, C(u) =0, u<t0,Ai,Bi)
⎞
⎠
−1
=
⎛
⎝ 1+
P(C(t1) =0∣E(t1) =1, E(t2) =0, C(u) =0, u<t1,Ai,Bi) P(C(t1) =0∣E(t1) =0, E(t2) =1, C(u) =0, u<t1,Ai,Bi)
×
P(E(t1) =1, E(t2) =0, C(u) =0, u<t1,Ai,Bi) P(E(t1) =0, E(t2) =1, C(u) =0, u<t1,Ai,Bi)
+
expit(β0+Bi) expit(β0+Bi+β)
×
1−expit(α0+Ai+f(t0)) expit(α0+Ai+f(t0))
P(C(t1) =0∣E(t1) =1, E(t2) =1, C(u) =0, u<t1,Ai,Bi) P(C(t1) =0∣E(t1) =0, E(t2) =1, C(u) =0, u<t1,Ai,Bi)
×
P(E(t1) =1, E(t2) =1, C(u) =0, u<t1,Ai,Bi) P(E(t1) =0, E(t2) =1, C(u) =0, u<t1,Ai,Bi)
⎞
⎠
−1
=
⎛
⎝ 1+
1−expit(β0+Bi+β) 1−expit(β0+Bi)
P(E(t1) =1, E(t2) =0, C(u) =0, u<t1,Ai,Bi) P(E(t1) =0, E(t2) =1, C(u) =0, u<t1,Ai,Bi)
+
expit(β0+Bi) expit(β0+Bi+β)
1−expit(α0+Ai+f(t0)) expit(α0+Ai+f(t0))
1−expit(β0+Bi+β) 1−expit(β0+Bi)
×
P(E(t1) =1, E(t2) =1, C(u) =0, u<t1,Ai,Bi) P(E(t1) =0, E(t2) =1, C(u) =0, u<t1,Ai,Bi)
⎞
⎠
−1
=
⎛
⎝ 1+
1−expit(β0+Bi+β) 1−expit(β0+Bi)
P(E(t1) =1∣E(t2) =0, C(u) =0, u<t1,Ai,Bi) P(E(t1) =0∣E(t2) =1, C(u) =0, u<t1,Ai,Bi)
×
P(E(t2) =0, C(u) =0, u<t1,Ai,Bi) P(E(t2) =1, C(u) =0, u<t1,Ai,Bi)
+
eβ0+Bi eβ0+Bi+β
1 eα0+Ai+f(t0)
P(E(t1) =1∣E(t2) =1, C(u) =0, u<t1,Ai,Bi) P(E(t1) =0∣E(t2) =1, C(u) =0, u<t1,Ai,Bi)
×
P(E(t2) =1, C(u) =0, u<t1,Ai,Bi) P(E(t2) =1, C(u) =0, u<t1,Ai,Bi)
⎞
⎠
−1
=
⎛
⎝ 1+
1−expit(β0+Bi+β) 1−expit(β0+Bi)
expit(α0+Ai+f(t1)) 1−expit(α0+Ai+f(t1))
×
P(C(t2) =0∣E(t2) =0, C(u) =0, u<t2,Ai,Bi) P(C(t2) =0∣E(t2) =1, C(u) =0, u<t2,Ai,Bi)
P(E(t2) =0, C(u) =0, u<t2,Ai,Bi) P(E(t2) =1, C(u) =0, u<t2,Ai,Bi)
+
e−β eα0+Ai+f(t0)
expit(α0+Ai+f(t1)) 1−expit(α0+Ai+f(t1))
⎞
⎠
−1
=
⎛
⎝ 1+
1−expit(β0+Bi+β) 1−expit(β0+Bi)
eα0+Ai+f(t1) 1−expit(β0+Bi) 1−expit(β0+Bi+β)
P(E(t2) =0∣C(u) =0, u<t2,Ai,Bi) P(E(t2) =1∣C(u) =0, u<t2,Ai,Bi)
+
e−βeα0+Ai+f(t1) eα0+Ai+f(t0)
⎞
⎠
−1
=
⎛
⎝
1+ eα0+Ai+f(t1) 1−expit(α0+Ai+f(t2)) expit(α0+Ai+f(t2))
+
e−βeα0+Ai+f(t1) eα0+Ai+f(t0)
⎞
⎠
−1
=
⎛
⎝
1 +ef(t1)−f(t2) + e−β+f(t1)−f(t0)⎞
⎠
−1
eβ+f(t0)+f(t2)
eβ+f(t0)+f(t2)+eβ+f(t0)+f(t1)+ef(t1)+f(t2)
3.2.2 Controls:
lemma 3.2.2.
1. P(E(t0) =1, E(t1) =0, E(t2) =0∣
2
∑
j=0
E(tj) =1, C(t0) =0, C(u) =0, u<t0,Ai,Bi, S=1)
=
ef(t0)
ef(t0)+ef(t1)+ef(t2)
2. P(E(t0) =0, E(t1) =1, E(t2) =0∣
2
∑
j=0
E(tj) =1, C(t0) =0, C(u) =0, u<t0,Ai,Bi, S=1)
=
ef(t1)
ef(t0)+ef(t1)+ef(t2)
3. P(E(t0) =0, E(t1) =0, E(t2) =1∣
2
∑
j=0
E(tj) =1, C(t0) =0, C(u) =0, u<t0,Ai,Bi, S=1)
=
ef(t2)
ef(t0)+ef(t1)+ef(t2)
4. P(E(t0) =1, E(t1) =1, E(t2) =0∣
2
∑
j=0
E(tj) =2, C(t0) =0, C(u) =0, u<t0,Ai,Bi, S=1)
=
ef(t0)+f(t1)
ef(t0)+f(t1)+ef(t0)+f(t2)+ef(t1)+f(t2)
5. P(E(t0) =1, E(t1) =0, E(t2) =1∣
2
∑
j=0
E(tj) =2, C(t0) =0, C(u) =0, u<t0,Ai,Bi, S=1)
=
ef(t0)+f(t2)
ef(t0)+f(t1)+ef(t0)+f(t2)+ef(t1)+f(t2)
6. P(E(t0) =0, E(t1) =1, E(t2) =1∣
2
∑
j=0
E(tj) =2, C(t0) =0, C(u) =0, u<t0,Ai,Bi, S=1)
=
ef(t1)+f(t2)
ef(t0)+f(t1)+ef(t0)+f(t2)+ef(t1)+f(t2)
Proof. As with one reference period the proofs for the cases and the controls are similar, again allβ-terms disappears in the calculations for the controls.