R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("muhaz-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('muhaz') Loading required package: survival Loading required package: splines > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "kphaz.fit" > > ### * kphaz.fit > > flush(stderr()); flush(stdout()) > > ### Name: kphaz.fit > ### Title: kphaz.fit > ### Aliases: kphaz.fit > ### Keywords: survival > > ### ** Examples > > time <- 1:10 > status <- rep(1,10) > kphaz.fit(time,status) Warning in return(time, haz, var) : multi-argument returns are deprecated $time [1] 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 $haz [1] 0.1111111 0.1250000 0.1428571 0.1666667 0.2000000 0.2500000 0.3333333 [8] 0.5000000 1.0000000 $var [1] 0.01234568 0.01562500 0.02040816 0.02777778 0.04000000 0.06250000 0.11111111 [8] 0.25000000 1.00000000 > > > > cleanEx(); ..nameEx <- "kphaz.plot" > > ### * kphaz.plot > > flush(stderr()); flush(stdout()) > > ### Name: kphaz.plot > ### Title: kphaz.plot > ### Aliases: kphaz.plot > ### Keywords: survival > > ### ** Examples > > # Use "kphaz.fit" to generate a hazard estimate > data(ovarian) > attach(ovarian) > kpfit <- kphaz.fit(futime, fustat) Warning in return(time, haz, var) : multi-argument returns are deprecated > # Use "kphaz.plot" to plot the estimate > kphaz.plot(kpfit) > > > > cleanEx(); ..nameEx <- "muhaz" > > ### * muhaz > > flush(stderr()); flush(stdout()) > > ### Name: muhaz > ### Title: Estimate hazard function from right-censored data. > ### Aliases: muhaz > ### Keywords: survival smooth > > ### ** Examples > > # to compute a locally optimal estimate > data(ovarian) > attach(ovarian) > 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 compute a globally optimal estimate > fit2 <- muhaz(futime, fustat, bw.method="g") > # to compute an estimate with global bandwidth set to 5 > fit3 <- muhaz(futime, fustat, bw.method="g", bw.grid=5) > > > > cleanEx(); ..nameEx <- "pehaz" > > ### * pehaz > > flush(stderr()); flush(stdout()) > > ### Name: pehaz > ### Title: Estimates piecewise exponential hazard function from > ### right-censored data. > ### Aliases: pehaz > ### Keywords: survival > > ### ** Examples > > data(ovarian) > attach(ovarian) > fit <- pehaz(futime, fustat) max.time= 1227 width= 93.30788 nbins= 14 > plot(fit) > > > > cleanEx(); ..nameEx <- "plot.pehaz" > > ### * plot.pehaz > > flush(stderr()); flush(stdout()) > > ### Name: plot.pehaz > ### Title: Plot a pehaz object. > ### Aliases: plot.pehaz lines.pehaz > ### Keywords: survival > > ### ** Examples > > data(ovarian) > attach(ovarian) > fit <- pehaz(futime, fustat) max.time= 1227 width= 93.30788 nbins= 14 > plot(fit) > > > > cleanEx(); ..nameEx <- "summary.muhaz" > > ### * summary.muhaz > > flush(stderr()); flush(stdout()) > > ### Name: summary.muhaz > ### Title: Display the most important input parameters used in calling the > ### `muhaz' function. > ### Aliases: summary.muhaz > ### Keywords: survival > > ### ** Examples > > data(ovarian) > attach(ovarian) > fit <- muhaz(futime, fustat) > summary(fit) 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 > > > > ### *