TABLE OF CONTENTS


curveUpdate/evalspline [ Functions ]

NAME

    evalspline --- evaluate the spline component of a curve

FUNCTION

Evaluate the spline component of a curve with a new set of component weights, either at all observations, or at a single index.

SYNOPSIS

1991 evalspline <- function(curve, i = 0, quick = FALSE)

INPUTS

    curve      an RCurve structure
    i          index of the observation that should be evaluated (0=all) 
    quick      for hazard curve, whether the cumulative basis integrals should be computed

OUTPUTS

    curve      the curve, with x[i] evaluated at the new curve$spline.par parameters

SOURCE

1994 {
1995     if(!curve$hasspline) return(curve)
1996     # extract observations and parameters
1997     if(i == 0) {
1998                 ind <- 1:length(curve$x)
1999                 curve$spline.y <- NULL
2000         }else{ind <- i}
2001     spline.par <- curve$spline.par
2002     #   normalize the frailty spline parameters
2003     if(curve$name == "frailty") spline.par <- spline.par - log(sum(exp(spline.par)))
2004     # Evaluate the spline component
2005     curve$spline.y[ind] <- drop(curve$spline.basis[ind, ,drop = FALSE]%*%exp(spline.par))
2006     if(curve$name == "hazard" & !quick)
2007         # for the hazard, evaluate the spline integrals
2008         curve$spline.ycum[ind] <- drop(curve$spline.basiscum[ind, ,drop = FALSE]%*%exp(spline.par))
2009     else
2010         curve$spline.ycum <- NULL
2011     if(curve$haspar) {
2012         # Reweight the curve
2013         curve <- weightcurve(curve, i)
2014     }else{
2015         curve$y[ind] <- curve$spline.y[ind]
2016         curve$ycum[ind] <- curve$spline.ycum[ind]
2017     }
2018     return(curve)
2019 }