plotHazSurv: Graphic Display of Hazard and Survival Function

Description Usage Arguments Value Examples

View source: R/oxy-plotHazSurv.R View source: R/plotHazSurv.R

Description

Plot the hazard and survival function of the of control group (from weibull or loglogistic distribution) and treatment group (derived from an arbitrary hazard ratio function)

Usage

1
2
3
4
5
6
7
8
9
plotHazSurv(
  bsl_dist = c("weibull", "loglogistic"),
  param = c(1.2, 0.03),
  fun_list,
  end,
  tit = c("Hazard Function", "Survival Function"),
  pos = c(1, 2),
  hlegend.loc = "bottomleft"
)

Arguments

bsl_dist

a text must be one of ("weibull", "loglogistic") distribution, specified for the control group

param

a vector of length 2, specifying the shape and rate (1/scale) parameter of the bsl_dist distribution, Default: c(1.2, 0.03)

fun_list

a list of hazard ratio functions comparing treatment group and control group

end

a value specifying the duration of the curve

tit

a vector specifying the titles of each graph, Default: c("Hazard Function", "Survival Function")

pos

a graphic parameter in the form of c(nr,nc). Subsequent figures will be drawn in an nr-by-nc array, Default: c(1, 2)

hlegend.loc

a text indicating the position of legend for the hazard plot. Default: "bottomleft"

Value

graphics of hazard and survival functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# proportional hazards
plotHazSurv(
 bsl_dist=c("weibull")
 ,param=c(1.2,1/30)
 ,fun_list=list(function(x){x^0*0.7})
 ,40
 ,tit= c("Hazard Function","Survival Function")
 ,pos=c(1,2)
)
# crossing hazards
plotHazSurv(
 bsl_dist=c("weibull")
 ,param=c(1.2,1/30)
 ,fun_list=list(function(x){1.3*(x<10)+(x>=10)*0.7})
 ,40
 ,tit= c("Hazard Function","Survival Function")
 ,pos=c(1,2)
)

nphPower documentation built on Dec. 1, 2021, 5:06 p.m.