TABLE OF CONTENTS


CcurveUpdate/EvalSpline [ Functions ]

NAME

    EvalSpline --- evaluate spline component

FUNCTION

Evaluate the spline component if the spline parameters have been changed. This function assumes the basis is correctly specified, and only the spline parameters (theta) have changed.

The only components of the curve that are changed are SplineY and SplineYcum; The function ReweightCurve is called at the end to update Y and Ycum.

SYNOPSIS

1228 void EvalSpline(curveP theCurve, int i)

INPUTS

    theCurve      CCurve structure whose SplinePar and SplineEPar have changed
    i             index of observation to update, or -1 for all

OUTPUTS

    theCurve      CCurve with Y and Ycum updated

SOURCE

1232 {
1233     if(!theCurve->hasSpline) return;
1234     if(i>=0){
1235         // evaluate a single observation
1236         int c1=1;
1237         theCurve->SplineY[i] = F77_CALL(ddot)(&(theCurve->nj), theCurve->SplineBasis + i,
1238                 &(theCurve->nx), theCurve->SplineEPar, &c1);
1239         // normalize frailty density
1240         if(!theCurve->isHazard) theCurve->SplineY[i] /= theCurve->SplineEParSum;
1241         // compute cumulative hazard
1242         if(theCurve->isHazard)
1243             theCurve->SplineYcum[i] = F77_CALL(ddot)(&(theCurve->nj), theCurve->SplineBasisCum + i,
1244                 &(theCurve->nx), theCurve->SplineEPar, &c1);
1245     }else{
1246         // evaluate entire curve
1247         int c1 = 1;
1248         double c0 = 0;
1249         char trans = 'N';
1250         double scaler = theCurve->isHazard ? 1.0 : 1.0/theCurve->SplineEParSum;
1251         // set splineY = basis * splinepar + 0*splineY
1252         F77_CALL(dgemv)(&trans, &(theCurve->nx), &(theCurve->nj), &scaler, theCurve->SplineBasis,
1253                 &(theCurve->nx), theCurve->SplineEPar, &c1, &c0, theCurve->SplineY, &c1);
1254         if(theCurve->isHazard)
1255             F77_CALL(dgemv)(&trans, &(theCurve->nx), &(theCurve->nj), &scaler, theCurve->SplineBasisCum,
1256                     &(theCurve->nx), theCurve->SplineEPar, &c1, &c0, theCurve->SplineYcum, &c1);
1257     }
1258     ReweightCurve(theCurve, i);
1259 }