TABLE OF CONTENTS


makeLikelihood/mklik.spline.frail.init [ Functions ]

NAME

    mklik.spline.frail.init --- likelihood of frailty spline parameters (initialization)

FUNCTION

This is a variant of mklik.spline.frail for use during initialization. It differs in that spline.par does not contain the fixed index, and hence repairfrailtypar must be called to add it back in. Moreover, it produces a frailty mean close to 1 by penalizing the distance.

SYNOPSIS

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

2363 {
2364     if(any(is.na(spline.par))) return(-Inf)
2365     spline.par <- repairfrailtypar(spline.par, frailty$spline.fixedind)
2366     frailty <- updatespline(frailty, spline.par)
2367     M <- frailty$spline.meanpenalty
2368     # base likeihood and smoothness penalty
2369     lik <- sum(log(frailty$y)) - frailty$spline.penaltyfactor * smoothpen(frailty, 0)
2370     # penalty for being far from mean 1
2371     lik <- lik - M * (frailty$spline.basisexp%*%exp(frailty$spline.par))^2
2372     # penalty for having too small parameters
2373     lik <- lik - sum(ifelse(spline.par< frailty$spline.min, 
2374         (spline.par - frailty$spline.min)^2, 0))    
2375     # do not allow too large parameters
2376     if(any(spline.par > 20)) lik<- -Inf #needed for numerics
2377     lik <- as.numeric(lik)
2378     return(lik)
2379 }