@@ -72,12 +72,12 @@ plot.Distribution <- function(x, fun=c('pdf','cdf'), npoints = 3000,
72
72
if (any(is.na(fun )))
73
73
stop(" Function unrecognised, should be one of: " , paste0(plotFuns ,collapse = " ," ))
74
74
75
- if (" cdf" %in% fun & ! x $ isCdf ){
75
+ if (any(c( " cdf" , " survival " , " hazard " , " cumhazard " ) %in% fun ) & ! x $ isCdf ){
76
76
message(" This distribution does not have a cdf expression. Use the FunctionImputation decorator to impute a numerical cdf." )
77
77
fun = fun [! (fun %in% c(" cdf" , " survival" , " hazard" ," cumhazard" ))]
78
78
}
79
79
80
- if (" pdf" %in% fun & ! x $ isPdf ){
80
+ if (any(c( " pdf" , " hazard " ) %in% fun ) & ! x $ isPdf ){
81
81
message(" This distribution does not have a pdf expression. Use the FunctionImputation decorator to impute a numerical pdf." )
82
82
fun = fun [! (fun %in% c(" pdf" , " hazard" ))]
83
83
}
@@ -114,10 +114,10 @@ plot.Distribution <- function(x, fun=c('pdf','cdf'), npoints = 3000,
114
114
plotStructure <- stats :: aggregate(cdf ~ points , plotStructure , max )
115
115
}
116
116
117
- if (" cdf" %in% fun & ! (" cdf" %in% colnames(plotStructure ))) {
117
+ if (any(c( " cdf" , " survival " , " hazard " , " cumhazard " ) %in% fun ) & ! (" cdf" %in% colnames(plotStructure ))) {
118
118
plotStructure $ cdf <- x $ cdf(plotStructure $ points )
119
119
}
120
- if (" pdf" %in% fun ) {
120
+ if (any(c( " pdf" , " hazard " ) %in% fun ) %in% fun ) {
121
121
plotStructure $ pdf <- x $ pdf(plotStructure $ points )
122
122
}
123
123
0 commit comments