@@ -63,4 +63,133 @@ plot <-
63
63
plot
64
64
```
65
65
66
+ ## For my continuous outcome, lower values are better
67
+
68
+ In some cases, for the continuous outcome, lower values might be considered better
69
+ than higher values. By default, the win odds are calculated assuming that higher
70
+ values are better. In order to calculate the correct win odds, the user can set
71
+ the ` lowerBetter ` parameter in the ` maraca() ` or ` plot.hce() ` function to ` TRUE ` .
72
+
73
+ Additionally, it is possible to display the continuous outcome on a reverse scale
74
+ using the parameter ` trans = "reverse" ` in the plotting functions.
75
+ ``` {r fig.width = 7, fig.height = 6}
76
+ Rates_A <- c(10, 15)
77
+ Rates_P <- c(12, 15)
78
+ dat <- simHCE(n = 2500, TTE_A = Rates_A, TTE_P = Rates_P,
79
+ CM_A = 6, CM_P = 10, CSD_A = 16, CSD_P = 15, fixedfy = 3, seed = 1)
80
+
81
+ plot(dat, lowerBetter = TRUE, trans = "reverse")
82
+ ```
83
+
84
+ ## Outcome axis labels are overlapping
85
+
86
+ Sometimes for some of the outcomes, only very few patients
87
+ had an event. Since the x-axis range for each endpoint is based
88
+ on the proportion of patients that had the event, this can lead
89
+ to close x-axis ticks and overlapping labels.
90
+ ``` {r fig.width = 7, fig.height = 6}
91
+ data(hce_scenario_a, package = "maraca")
92
+ data <- hce_scenario_a
93
+
94
+ column_names <- c(
95
+ outcome = "GROUP",
96
+ arm = "TRTP",
97
+ value = "AVAL0"
98
+ )
99
+ step_outcomes <- c(
100
+ "Outcome I", "Outcome II", "Outcome III", "Outcome IV"
101
+ )
102
+
103
+ last_outcome <- "Continuous outcome"
104
+
105
+ arm_levels = c(active = "Active", control = "Control")
106
+
107
+ # We will only include a few patients with outcome III
108
+ data2 <- data[data$GROUP == "Outcome II",]
109
+ data3 <- data[data$GROUP == "Outcome III",]
110
+ data <- rbind(data2[sample(1:nrow(data2),5),],
111
+ data3[sample(1:nrow(data3),5),],
112
+ data[!(data$GROUP %in% c("Outcome II","Outcome III")),])
113
+
114
+ mar <- maraca(
115
+ data, step_outcomes, last_outcome, arm_levels, column_names,
116
+ fixed_followup_days = 3*365,
117
+ compute_win_odds = TRUE
118
+ )
119
+
120
+ # Now the x-axis labels are overlapping
121
+ plot(mar)
122
+ ```
123
+
124
+ One potential workaround in this situation is to add a line break after or before
125
+ one of the outcomes in order to space them further apart.
126
+ ``` {r fig.width = 7, fig.height = 6}
127
+ data[data$GROUP == "Outcome II","GROUP"] <- "Outcome II\n"
128
+ step_outcomes <- c(
129
+ "Outcome I", "Outcome II\n", "Outcome III", "Outcome IV"
130
+ )
131
+ mar <- maraca(
132
+ data, step_outcomes, last_outcome, arm_levels, column_names,
133
+ fixed_followup_days = 3*365,
134
+ compute_win_odds = TRUE
135
+ )
136
+
137
+ plot(mar)
138
+ ```
139
+
140
+
141
+ ## I get the error "outcome [ XY] is not present in column"
142
+
143
+ The maraca package expects that for every outcome specified in the
144
+ ` step_outcomes ` parameter, at least one patient has had that event.
145
+ ``` {r error = TRUE}
146
+ data(hce_scenario_a, package = "maraca")
147
+ data <- hce_scenario_a
148
+
149
+ column_names <- c(
150
+ outcome = "GROUP",
151
+ arm = "TRTP",
152
+ value = "AVAL0"
153
+ )
154
+ step_outcomes <- c(
155
+ "Outcome I", "Outcome II", "Outcome III", "Outcome IV"
156
+ )
157
+
158
+ last_outcome <- "Continuous outcome"
159
+
160
+ arm_levels = c(active = "Active", control = "Control")
161
+
162
+ # Let's pretend no one in the study had outcome II
163
+ data <- data[data$GROUP != "Outcome II", ]
164
+
165
+ # Now we will get an error
166
+ mar <- maraca(
167
+ data, step_outcomes, last_outcome, arm_levels, column_names,
168
+ fixed_followup_days = 3*365,
169
+ compute_win_odds = TRUE
170
+ )
171
+ ```
172
+
173
+ If the outcome is not part of the data at all, it cannot be displayed
174
+ as part of the plot. The outcome has to be removed from the
175
+ ` step_outcomes ` parameter. Additionally, the user can for example
176
+ add a footnote explaining why the outcome is not included in the
177
+ plot.
178
+
179
+ ``` {r fig.width = 7, fig.height = 6}
180
+ step_outcomes <- c(
181
+ "Outcome I", "Outcome III", "Outcome IV"
182
+ )
183
+
184
+ # Now we will get an error
185
+ mar <- maraca(
186
+ data, step_outcomes, last_outcome, arm_levels, column_names,
187
+ fixed_followup_days = 3*365,
188
+ compute_win_odds = TRUE
189
+ )
190
+
191
+ plot(mar) +
192
+ labs(caption = paste("No patient experienced Outcome II",
193
+ "and it is therefore not included in the graph."))
194
+ ```
66
195
0 commit comments