Learn R Programming

NBDesign (version 2.0.0)

negint2: A utility functon to calculate the mean exposure under different scenarios

Description

This will calculate the mean exposure under different scenarios: 2: fixed follow-up with drop-out, 3: variable follow-up with a maximum (maxfu), 4: variable follow-up with a maximum and drop-out

Usage

negint2(ux=0.5,fixedfu=1,type=2,u=c(0.5,0.5,1),ut=c(0.5,1.0,1.5),
  tfix=ut[length(ut)]+0.5,maxfu=10.0,tchange=c(0,0.5,1),
  ratec=c(0.15,0.15,0.15),eps=1.0e-03)

Arguments

ux

the parameter a in (a*t)/(1+a*t)

fixedfu

the minimum follow-up time

type

follow-up type, type=2: fixed fu with fu time fixedfu but subject to censoring; type=3: depending on entry time, minimum fu is fixedfu and maximum fu is maxfu; type=4: same as 3 but subject to censoring

u

recruitment rate

ut

recruitment interval, must have the same length as u

tfix

fixed study duration, often equals to recruitment time plus minimum follow-up

maxfu

maximum follow-up time, should not be greater than tfix

tchange

a strictly increasing sequence of time points starting from zero at which the drop-out rate changes. The first element of tchange must be zero. The above rates and tchange must have the same length.

ratec

piecewise constant drop-out rate

eps

error tolerance for the numerical intergration

Value

mt

mean of (a*t)/(1+a*t)

tt

mean of t

vt

variance of t

Details

Let \(\tau_{min}\) and \(\tau_{max}\) correspond to the minimum follow-up time taumin and the maximum follow-up time taumax. Let \(T_f\), \(C\), \(E\) and \(R\) be the follow-up time, the drop-out time, the study entry time and the total recruitment period(\(R\) is the last element of ut). For type 2 follow-up \(T_f=min(C,\tau_{min})\). For type 3 follow-up, \(T_f=min(R+\tau_{min}-E,\tau_{max})\). For type 4 follow-up, \(T_f=min(R+\tau_{min}-E,\tau_{max},C)\). Let \(f\) be the density of \(T_f\). We calculate $$\int_0^{\infty} t f(t)dt$$ and $$\int_0^{\infty} \frac{a t}{1+a t} f(t)dt$$ where \(a\) is the ux.

Examples

Run this code
# NOT RUN {
##calculating the exposure for type 4 follow-up
exp4=negint2(ux=0.5,fixedfu=1,type=2,u=c(0.5,0.5,1),ut=c(0.5,1.0,1.5),
  tfix=2.0,maxfu=1.0,tchange=c(0,0.5,1),
  ratec=c(0.15,0.15,0.15),eps=1.0e-03)
#mean exposure            
meanexp=exp4$tt
#var exposure
varexp=exp4$vt
c(meanexp,sqrt(varexp))
#mean of (ux*t)/(1+ux*t)
meanuxt=exp4$mt
# }

Run the code above in your browser using DataLab