TABLE OF CONTENTS
MetropolisHastings/mh.hazard.spline [ Functions ]
NAME
mh.hazard.spline --- MH for hazard spline parameters
FUNCTION
Metropolis-Hastings steps for spline parameters for hazard
SYNOPSIS
2724 mh.hazard.spline <- function(hazard, frailty, regression)
INPUTS
hazard RCurve for hazard frailty RCurve for frailty regression RRegression structure
OUTPUTS
hazard Rcurve with updated hazard parameters
SOURCE
2727 { 2728 if(!hazard$hasspline) return(hazard) 2729 sumacc <- 0 2730 nj <- length(hazard$spline.par) 2731 cand <- rep(0, nj) 2732 for(j in 1:nj) cand[j] <- hazard$spline.par[j] + hazard$spline.tun * 2733 rnorm(1, 0, hazard$spline.candsd[j]) 2734 baselik <- mklik.spline.haz(hazard$spline.par, hazard, frailty, regression) 2735 for(j in 1:nj){ 2736 thiscand <- hazard$spline.par 2737 thiscand[j] <- cand[j] 2738 candlik <- mklik.spline.haz(thiscand, hazard, frailty, regression) 2739 thisacc <- acceptreject(baselik, candlik, 1) 2740 if(thisacc){ 2741 baselik <- candlik 2742 hazard <- updatespline(hazard, thiscand) 2743 } 2744 sumacc <- sumacc + thisacc 2745 } 2746 hazard$spline.accept <- sumacc / nj 2747 return(hazard) 2748 }