TABLE OF CONTENTS


CinitRoutine/cInitLikHazSpline [ Functions ]

NAME

    cInitLikHazSpline --- spline hazard likelihood for initialization

FUNCTION

Compute the loglikelihood of parameters of the hazard spline components. Called by cmklik.spline.haz during initialization.

SYNOPSIS

583 void cInitLikHazSpline(double *lik, double *par, double *status, double *lp, double *frailrep,
584     double *hazParY, double *hazParYcum, double *weight, double *B, double *C,
585     double *P, int *penaltyType, double *sigma2, int *ny, int *nj)

INPUTS

    see cmklik.spline.haz for inputs and outputs

SOURCE

589 {
590     double * epar = (double *) malloc((*nj) * sizeof(double));
591     double * hazY = (double *) malloc((*ny) * sizeof(double));
592     double * hazYcum = (double *) malloc((*ny) * sizeof(double));
593     const int c1 = 1;
594     F77_CALL(dcopy)(ny, hazParY, &c1, hazY, &c1);
595     F77_CALL(dcopy)(ny, hazParYcum, &c1, hazYcum, &c1);
596     for(int i=0; i< *nj; i++) epar[i]=exp(par[i]);
597     cInitMultAndWeight( hazY, B, epar, weight, ny, nj);
598     cInitMultAndWeight( hazYcum, C, epar, weight, ny, nj);
599     double out=0;
600     for(int i=0; i< *ny; i++) hazY[i]=log(hazY[i]);
601     out += F77_CALL(ddot)(ny,status,&c1,hazY,&c1);
602     for(int i=0; i< *ny; i++)
603         out -= frailrep[i]*hazYcum[i]*exp(lp[i]);
604     double pen = 0;
605     double *penpar = ((*penaltyType==2) | (*penaltyType==3))  ? epar : par;
606     InitSmoothnessPenalty(&pen, penpar, P, penaltyType, sigma2, nj);
607     out-=pen;
608     *lik = out;
609     free(epar);
610     free(hazY);
611     free(hazYcum);
612 }