TABLE OF CONTENTS


ZZdebug/makealphars2 [ Functions ]

NAME

    makealphars2 --- make baseline hazard

FUNCTION

Compute the MLEs for the baseline hazard parameters alphars, given estimates of regression parameters andf frailties, for a single recurrent event process.

This is never called, and is for debugging purposes only. See fmkalphars2 and the Fortran implementation.

SYNOPSIS

273 makealphars2 <- function(m, Ji, datamat, betahat, as, Uijmat)

SOURCE

276 {
277     # Allocate storage space
278     alphars <- matrix(0, dim(as)[1], dim(as)[2])
279     # drs will contain the numerator, Srs the denominator
280     drs <- alphars
281     Srs <- alphars
282     
283     for(ind in 1:dim(datamat)[1]){
284         i <- datamat[ind, "i"]
285         j <- datamat[ind, "j"]
286         k <- datamat[ind, "k"]
287         smin <- datamat[ind, "smin"]
288         smax <- datamat[ind, "smax"]
289         r <- datamat[ind, "r"]
290         time <- datamat[ind, "time"]
291         Z <- datamat[ind, -(1:8)]
292         # the numerator is just the sum of the event indicators
293         drs[r, smax] <- drs[r, smax] + datamat[ind, "delta"]
294         # Computing the denominator requires looping over all at - risk intervals
295         for(s in smin:smax) 
296             Srs[r, s] <- Srs[r, s] + Uijmat[i, j] * 
297             exp(as.matrix(Z)%*%as.matrix(betahat)) * A(time, as, r, s)
298     }
299     alphars <- drs / Srs
300     alphars[is.nan(alphars)] <- 100 # Not needed since bugs fixed!
301     return(alphars)  
302 }