TABLE OF CONTENTS


CcurveUpdate/UpdateSplineBasis [ Functions ]

NAME

    UpdateSplineBasis --- recompute basis if one of the X values changes

FUNCTION

Re-evaluates the spline basis at its X values. This is called indirectly by MH_Frail, as well as during the Birth-Death-Move steps in MH_BDM.

The function can evaluate only a subset of spline basis functions (as needed when changing the knot set), or evaluate at a single observation (as when changing one frailty).

SYNOPSIS

1078 void UpdateSplineBasis(curveP theCurve, int i, int startj, int endj)

INPUTS

    theCurve      CCurve structure to be re-evaluated
    i             index of the observation to evaluate, or -1 for all
    startj        start index of the basis functions to evaluate
    endj          stop index of the basis functions to evaluate

OUTPUTS

SOURCE

1082 {
1083     if(!theCurve->hasSpline) return;
1084     if(i<0)
1085         // evaluate every row separately
1086         for(int ind=0; ind<theCurve->nx; ind++) UpdateSplineBasis(theCurve, ind, startj, endj);
1087     else{
1088         for(int j=startj; j<endj; j++){
1089             // evaluate the basis at entry [i,j]
1090             theCurve->SplineBasis[i + j * theCurve->nx] = csplineeval(theCurve->X[i], j,
1091                     theCurve->SplineOrd, theCurve->SplineKnots, theCurve->SplineOrd, theCurve->nj);
1092             if(!theCurve->isHazard) 
1093                 theCurve->SplineBasis[i+j * theCurve->nx] /= theCurve->SplineBasisInt[j];
1094         }
1095         // for the hazard, also evaluate cumulative hazards
1096         if(theCurve->isHazard) 
1097             cevalCinte2(theCurve->SplineBasisCum, theCurve->X, theCurve->nx, theCurve->SplineKnots,
1098                 theCurve->nj, theCurve->SplineOrd, theCurve->SplineBasisInt, i, startj, endj);
1099     }
1100 }