###PubH 7450: how to specify some parameters in muhaz(); ### this is related to Problem 6.2 library(muhaz) data(ovarian) attach(ovarian) #default: fit1 <- muhaz(futime, fustat) plot(fit1) summary(fit1) Number of Observations .......... 26 Censored Observations ........... 14 Method used ..................... Local Boundary Correction Type ........ Left and Right Kernel type ..................... Epanechnikov Minimum Time .................... 0 Maximum Time .................... 744 Number of minimization points ... 51 Number of estimation points ..... 101 Pilot Bandwidth ................. 56.58 Smoothing Bandwidth ............. 282.89 Minimum IMSE .................... 1e+30 #######to get estimated hazard rates at some given time point, #######you have to specify min.time: Left bound of the time domain used in analysis. If missing, min.time is considered 0. max.time: Right bound of the time domain used in analysis. If missing, max.time is the time at which ten patients remain at risk. n.est.grid: Number of points in the estimation grid, where hazard estimates are computed. Default value is 101. #######other parameters: bw.grid: Bandwidth grid used in the MSE minimization. If bw.method="global" and bw.grid has one component only, no MSE minimization is performed. The hazard estimates are computed for the value of bw.grid. If bw.grid is missing, then a bandwidth grid of 21 components is built, having as bounds: [0.2*bw.pilot, 20*bw.pilot] bw.pilot: Pilot bandwidth used in the MSE minimization. If missing, the default value is the one recommended by Mueller and Wang (1994): bw.pilot = (max.time-min.time) / (8*nz^0.2) where nz is the number of uncensored observations bw.method: Algorithm to be used. Possible values are: "global" - same bandwidth for all grid points. The optimal bandwidth is obtained by minimizing the IMSE. "local" - different bandwidths at each grid point. The optimal bandwidth at a grid point is obtained by minimizing the local MSE. "knn" - k nearest neighbors distance bandwidth. The optimal number of neighbors is obtained by minimizing the IMSE. Default value is "local". Only the first letter needs to be given (e.g. "g", instead of "global"). kern: Boundary kernel function to be used. Possible values are: "rectangle", "epanechnikov", "biquadratic", "triquadratic". Default value is "epanechnikov". Only the first letter needs to be given (e.g. kern="b"). ##for my above data: min.time=0, max.time=744, n.est.grid=101 fit2<-muhaz(futime, fustat, min.time=0, max.time=744, n.est.grid=745, bw.method="global", bw.grid=282.89, kern="rectangle") #find hazard estimates: fit2$est.grid[1:5] #[1] 0 1 2 3 4 fit2$haz.est[1:5] #[1] 0.0004373800 0.0004433674 0.0004491685 0.0004547879 0.0004602299 #in contrast, fit1$est.grid[1:5] #[1] 0.00 7.44 14.88 22.32 29.76 fit1$haz.est[1:5] #[1] 0.0002554471 0.0002735475 0.0002927036 0.0003122007 0.0003319730 postscript("muhaz_example.ps") plot(fit2, col="red") lines(fit1) dev.off()