TABLE OF CONTENTS


estimation/smoothalpha [ Functions ]

NAME

    smoothalpha --- smooth hazard estimates

FUNCTION

Applies a spline smoother to the baseline hazard estimates. This was sometimes found to improve stability.

SYNOPSIS

381 smoothalpha <- function(alphars, as)

INPUTS

    alphars    matrix of baseline hazard parameters 
    as         matrix of discretization breakpoints for each stratum

OUTPUTS

    alphars    matrix of baseline hazard parameters

SOURCE

384 {
385      for(r in 1:dim(as)[1]){
386         idx <- which(alphars[r, ] != 100)
387         idx <- c(idx, idx[length(idx)] + 1)
388         xs <- (as[r, idx[ - 1]] + as[r, idx[ - length(idx)]]) / 2
389         if(length(xs) > 50) nk <- 50 else nk <- NULL
390         # Apply a spline smoother to the hazards
391         out <- smooth.spline(xs, alphars[r, idx[ - length(idx)]], 
392             w = diff(as[r, idx]), nknots = nk)
393         alphars[r, idx] <- c(out$y, 100)
394      }
395      return(alphars)
396 }