Skip to content

Commit f922d46

Browse files
committed
clean
1 parent 21f0ee4 commit f922d46

File tree

5 files changed

+41
-39
lines changed

5 files changed

+41
-39
lines changed

R/plotBeta.R

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,27 @@ plotBetaDiff <- function(parY, # parameters of experimental arm
8686
upper = Stop_cut # Calculate probability of Stop, if difference was at most `Stop_cut`.
8787
)
8888

89-
Go_label <- paste("Probability of Go is", round(Go_auc$value * 100, digits = 2), "%")
90-
Stop_label <- paste("Probability of Stop is", round(Stop_auc$value * 100, digits = 2), "%")
91-
plot_title <- paste("According to Beta difference density", Go_label, "and", Stop_label)
92-
93-
pbetadiff_plot <- ggplot2::ggplot(data = data, mapping = aes(x = grid, y = density)) +
94-
ggplot2::geom_line(colour = "#888888") +
95-
xlab("Difference between treatment") +
96-
ggplot2::ylab(quote(f(x))) +
97-
ggplot2::ggtitle(plot_title)
89+
Go_label <- paste("probability of Go is", round(Go_auc$value * 100, digits = 2), "%")
90+
Stop_label <- paste("probability of Stop is", round(Stop_auc$value * 100, digits = 2), "%")
91+
plot_title <- paste("According to Beta difference density", Go_label, "and\n", Stop_label)
9892

9993
if (shade == TRUE) {
100-
pbetadiff_plot <- pbetadiff_plot +
101-
ggplot2::geom_area(data = data[data$Go == TRUE, ], fill = "#009E73") +
102-
ggplot2::geom_area(data = data[data$Stop == TRUE, ], fill = "#D55E00")
94+
pbetadiff_plot <- ggplot2::ggplot(data = data, aes(x = grid, y = density)) +
95+
ggplot2::geom_line(colour = "#888888") +
96+
geom_area(data = data[data$grid < Stop_cut,], fill = "#D55E00",
97+
mapping = aes(x = ifelse(grid < 0.2 & grid < 0.5, grid, 0))) +
98+
geom_area(data = data[data$grid > Go_cut,], fill = "#009E73",
99+
mapping = aes(x = ifelse(grid > 0.3, grid, 0))) +
100+
xlab("Difference between treatment") +
101+
ggplot2::ylab(quote(f(x))) +
102+
ggplot2::ggtitle(plot_title)
103+
} else {
104+
pbetadiff_plot <- ggplot2::ggplot(data = data, aes(x = grid, y = density)) +
105+
ggplot2::geom_line(colour = "#888888") +
106+
xlab("Difference between treatment") +
107+
ggplot2::ylab(quote(f(x))) +
108+
ggplot2::ggtitle(plot_title)
103109
}
104-
105110
if (note == TRUE) {
106111
pbetadiff_plot <- pbetadiff_plot +
107112
ggplot2::annotate("text", x = -0.5, y = 4.25, label = Go_label, colour = "#009E73") +

examples/myPlotDiff.R

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/plotBetaDiff.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# plotBetDiff
1+
# The beta distribution and acceptable bounds for
2+
# a meaningful improvement of 0.20 and worsening of 0.05
23
parX <- c(1, 52) # parameters of experimental arm
34
parY <- c(5.5, 20.5) # parameters of control or SOC
45
plotBetaDiff(

man/ocPredprob.Rd

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plotBetaDiff.Rd

Lines changed: 13 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)