TABLE OF CONTENTS
CmiscUtils/UpdateHistory [ Functions ]
NAME
UpdateHistory --- update history of parameters
FUNCTION
Store the state of the chain at the current iteration in the CHistory structure
SYNOPSIS
2648 void UpdateHistory(curveP hazard, curveP frailty, regressionP regression, historyP history, int iter)
INPUTS
hazard CCurve for the hazard frailty CCurve for the frailty regression CRegression structure history a CHistory structure iter the current iteration counter
SOURCE
2652 { 2653 int c1=1; 2654 int ny = history->ny; 2655 // store frailties 2656 F77_CALL(dcopy)(&(frailty->nx), frailty->X, &c1, history->frailty + iter-1, &(history->ny)); 2657 // store regression coefficients 2658 F77_CALL(dcopy)(&(regression->p), regression->coefficients, &c1, history->coefficients + iter-1, 2659 &(history->ny)); 2660 2661 if(frailty->hasSpline){ 2662 // store frailty spline knots and parameters 2663 int lknots = frailty->SplineNknots + 2*frailty->SplineOrd; 2664 F77_CALL(dcopy)(&(frailty->nj), frailty->SplinePar, &c1, history->FrailtySplinePar + iter-1, 2665 &(history->ny)); 2666 F77_CALL(dcopy)(&(lknots), frailty->SplineKnots, &c1, history->FrailtySplineKnots + iter-1, 2667 &(history->ny)); 2668 history->FrailtySplineFvar[iter-1] = frailty->SplineFvar; 2669 } 2670 if(hazard->hasSpline){ 2671 // store hazard spline knots and parameters 2672 int lknots = hazard->SplineNknots + 2*hazard->SplineOrd; 2673 F77_CALL(dcopy)(&(hazard->nj), hazard->SplinePar, &c1, history->HazardSplinePar + iter-1, 2674 &(history->ny)); 2675 F77_CALL(dcopy)(&(lknots), hazard->SplineKnots, &c1, history->HazardSplineKnots + iter-1, 2676 &(history->ny)); 2677 } 2678 // store parametric component parameters 2679 if(frailty->hasPar) 2680 F77_CALL(dcopy)(&(frailty->np), frailty->ParamPar, &c1, history->FrailtyParamPar + iter-1, 2681 &(history->ny)); 2682 if(hazard->hasPar) 2683 F77_CALL(dcopy)(&(hazard->np), hazard->ParamPar, &c1, history->HazardParamPar + iter-1, 2684 &(history->ny)); 2685 // store weights 2686 if(hazard->hasPar & hazard->hasSpline) 2687 history->HazardWeight[iter-1] = hazard->Weight[0]; 2688 if(frailty->hasPar & frailty->hasSpline) 2689 history->FrailtyWeight[iter-1] = frailty->Weight[0]; 2690 2691 // store prior variances 2692 history->priorvar[iter-1 + ny*0] = regression->priorvar[0]; 2693 history->priorvar[iter-1 + ny*1] = hazard->SplinePriorvar[0]; 2694 history->priorvar[iter-1 + ny*2] = frailty->SplinePriorvar[0]; 2695 history->priorvar[iter-1 + ny*3] = hazard->ParamPriorvar[0]; 2696 history->priorvar[iter-1 + ny*4] = frailty->ParamPriorvar[0]; 2697 history->priorvar[iter-1 + ny*5] = hazard->WeightPriorvar[0]; 2698 history->priorvar[iter-1 + ny*6] = frailty->WeightPriorvar[0]; 2699 2700 // store acceptance rates 2701 history->accept[iter-1 + ny*0] = regression->Accept[0]; 2702 history->accept[iter-1 + ny*1] = hazard->SplineAccept[0]; 2703 history->accept[iter-1 + ny*2] = frailty->SplineAccept[0]; 2704 history->accept[iter-1 + ny*3] = hazard->ParamAccept[0]; 2705 history->accept[iter-1 + ny*4] = frailty->ParamAccept[0]; 2706 history->accept[iter-1 + ny*5] = hazard->WeightAccept[0]; 2707 history->accept[iter-1 + ny*6] = frailty->WeightAccept[0]; 2708 history->accept[iter-1 + ny*7] = frailty->Accept[0]; 2709 }