TABLE OF CONTENTS


CinitRoutine/cInitLikFrailSpline [ Functions ]

NAME

    cInitLikFrailSpline --- loglikelihood of parameters for spline component of frailty curve

FUNCTION

Compute the loglikelihood of parameters of the frailty spline component, called by cmklik.spline.frail during initialization only.

SYNOPSIS

665 void cInitLikFrailSpline(double *lik, double *par, double *frailParY, double *weight, double *B,
666         double *E, double *M, double *P, int * penaltyType, double *sigma2, int *ny, int *nj)

INPUTS

    see cmklik.spline.frail

SOURCE

670 {
671     double out=0;
672     int c1=1;
673     double * epar = (double *) malloc((*nj) * sizeof(double));
674     double * eparnorm = (double *) malloc((*nj) * sizeof(double));
675     double * frailY = (double *) malloc((*ny) * sizeof(double));
676     F77_CALL(dcopy)(ny, frailParY, &c1, frailY, &c1);
677     for(int i=0; i< *nj; i++) epar[i]=exp(par[i]);
678     double  eparsum = 0;
679     for(int i=0; i< *nj; i++) eparsum+=epar[i];
680     for(int i=0; i< *nj; i++) eparnorm[i]=epar[i]/eparsum;
681     cInitMultAndWeight( frailY, B, eparnorm, weight, ny, nj);
682     for(int i=0; i<*ny; i++) out+=log(frailY[i]); 
683     double pen = 0;
684     double *penpar = ((*penaltyType==2) | (*penaltyType==3))  ? epar : par;
685     InitSmoothnessPenalty(&pen, penpar, P, penaltyType, sigma2, nj);
686     out-=pen;
687     out -= *M * pow((F77_CALL(ddot)(nj, E, &c1, epar, &c1)),2);
688     *lik = out;
689     free(epar);
690     free(eparnorm);
691     free(frailY);
692 }