TABLE OF CONTENTS


curveUpdate/updatehistory [ Functions ]

NAME

    updatehistory --- update RHistory structure

FUNCTION

Store the state of the chain at the current iteration in the RHistory structure.

SYNOPSIS

1068 updatehistory <- function(history, i, hazard, frailty, regression)

INPUTS

    history        an RHistory structure
    i              integer, current iteration
    hazard         a hazard RCurve
    frailty        a frailty RCurve
    regression     a RRegression structure

OUTPUTS

    history        updated Rhistory

SOURCE

1071 {
1072     # store frailties and coefficients
1073     history$frailty[i, ] <- frailty$x
1074     history$coefficients[i, ] <- regression$coefficients
1075     # store spline knots and parameters
1076     if(hazard$hasspline) {
1077         history$hazard.spline.par[i, 1:length(hazard$spline.par)] <- hazard$spline.par
1078         history$hazard.spline.knots[i, 1:length(hazard$spline.knots)] <- hazard$spline.knots
1079     }
1080     if(frailty$hasspline) {
1081         history$frailty.spline.par[i, 1:length(frailty$spline.par)] <- frailty$spline.par
1082         history$frailty.spline.knots[i, 1:length(frailty$spline.knots)] <- frailty$spline.knots
1083         history$frailty.spline.fvar[i] <- frailty$spline.fvar
1084     }
1085     # store parametric components and weights
1086     if(hazard$haspar) history$hazard.param.par[i, ] <- hazard$param.par
1087     if(frailty$haspar) history$frailty.param.par[i, ] <- frailty$param.par
1088     if(hazard$hasspline & hazard$haspar) history$hazard.weight[i] <- hazard$weight
1089     if(frailty$hasspline & frailty$haspar) history$frailty.weight[i] <- frailty$weight
1090     # store prior variance terms
1091     history$priorvar[i, ] <- c(regression$priorvar, hazard$spline.priorvar, frailty$spline.priorvar,
1092         hazard$param.priorvar, frailty$param.priorvar, hazard$weight.priorvar, frailty$weight.priorvar)
1093     # store acceptance history
1094     history$accept[i, ] <- c(regression$accept, hazard$spline.accept, frailty$spline.accept,
1095         hazard$param.accept, frailty$param.accept, hazard$weight.accept, frailty$weight.accept, frailty$accept)
1096 
1097     return(history)
1098 }