TABLE OF CONTENTS


makeLikelihood/mklik.spline.haz [ Functions ]

NAME

    mklik.spline.haz --- likelihood of hazard spline parameters

FUNCTION

Compute the loglikelihood of parameters spline.par for the spline component of the hazard curve.

SYNOPSIS

2286 mklik.spline.haz <- function(spline.par, hazard, frailty, regression)

INPUTS

    spline.par a vector of parameters for each of the spline basis functions
    hazard     RCurve for hazard
    frailty    RCurve for frailty
    regression RRegression structure

OUTPUTS

    lik    loglikelihood of spline.par

SOURCE

2289 {
2290     if(!hazard$hasspline) return(0)
2291     if(any(is.na(spline.par))) return(-Inf)
2292     status <- regression$status
2293     lp <- regression$lp
2294     hazard <- updatespline(hazard, spline.par)
2295     frailrep <- rep(frailty$x, regression$Ji)
2296     # point process likelihood
2297     lik <- sum(status * log(hazard$y)) 
2298     lik <- lik - sum(frailrep * hazard$ycum * exp(lp))
2299     # smoothness penalty
2300     lik <- lik - hazard$spline.penaltyfactor * smoothpen(hazard, 0)
2301     # penalize parameters that are too small
2302     lik <- lik - sum(ifelse(spline.par< hazard$spline.min, 
2303         (spline.par - hazard$spline.min)^2, 0))    
2304     lik <- as.numeric(lik)
2305     return(lik)
2306 }