Displaying 1 result from an estimated 1 matches for "rnos".
Did you mean:
nos
2009 Jun 07
1
Survreg function for loglogistic hazard estimation
...nction stored in bhaz
a<- 20
b <- 4
time <- 1:timeline
bhaz <- ((b/a) * (time /a) ^ (b-1))/(1+(time/a)^b)
# Event time stored in endtime. Baseline hazard function is controlled by
# dfico value with factor loading dficoeff
endtime <- numeric(samplesize)
for ( i in 1:samplesize) {
rnos <- runif(timeline)
endtime[i] <- which(rnos <= bhaz * exp(dfico[i]*dficoeff))[1]
}
# Construct data frame
raw <- data.frame(end = endtime, status = 1, fico_demean = dfico)
# Adding censorship
for( i in 1:samplesize) {
if(is.na(raw$end[i])) {raw$status[i] <- 0}
}
for( i in 1:sample...