TABLE OF CONTENTS


makeLikelihood/mklik.spline.frail [ Functions ]

NAME

    mklik.spline.frail --- likelihood of frailty spline parameters

FUNCTION

Compute loglikelihood of spline.par for a frailty spline curve.

SYNOPSIS

2395 mklik.spline.frail <- 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

2398 {
2399     if(!frailty$hasspline) return(0)
2400     if(any(is.na(spline.par))) return(-Inf)
2401     frailty <- updatespline(frailty, spline.par)
2402     M <- frailty$spline.meanpenalty
2403     lik <- sum(log(frailty$y))
2404     lik <- lik - frailty$spline.penaltyfactor * smoothpen(frailty, 0)
2405     lik <- lik - sum(ifelse(spline.par< frailty$spline.min,
2406         (spline.par - frailty$spline.min)^2, 0))    
2407     if(any(spline.par > 20)) lik<- -Inf #needed for numerics
2408     lik <- as.numeric(lik)
2409     return(lik)
2410 }