Converts a result of qdm_decide to a data frame with one
row, so that the decisions for several data sets (for example for
subgroups, or for the prior distributions of a sensitivity analysis) can
be combined with rbind() and written to a file.
Usage
# S3 method for class 'qdm_decision'
as.data.frame(x, row.names = NULL, optional = FALSE, ..., posterior = FALSE)Arguments
- x
An object of class
"qdm_decision".- row.names
NULL(the default) or the name of the row.- optional
Not used.
- ...
Not used.
- posterior
TRUEto add the parameters of the posterior distributions (seeqdm_decide) in columns namedpost_t_andpost_c_followed by the names of the parameters, for examplepost_t_aandpost_t_b.
Details
The columns are decision; prob_go, gamma_go and
met_go (the probability of the Go criterion, its threshold and
whether the criterion is met); and prob_nogo, gamma_nogo
and met_nogo for the NoGo criterion. For two endpoints with a
marginal rule (rule = "and" or "or"), the probabilities and
the thresholds have one column per endpoint (prob_go1,
prob_go2, gamma_go1, gamma_go2, and so on), and
met_go and met_nogo combine the endpoints by the rule. For
two endpoints, the probabilities of the regions follow, in the columns
R1 to R9 (R1 to R4 for a predictive
criterion; see qdm_regions).
Examples
des <- design_binary(
n_t = 12, n_c = 12,
prior_t = prior_beta(0.5, 0.5), prior_c = prior_beta(0.5, 0.5),
criterion = criterion_posterior(theta_tv = 0.2, theta_mav = 0.1,
gamma_go = 0.5, gamma_nogo = 0.8)
)
dec1 <- qdm_decide(des, data_t = data_binary(12, 9),
data_c = data_binary(12, 4))
dec2 <- qdm_decide(des, data_t = data_binary(12, 6),
data_c = data_binary(12, 5))
rbind(as.data.frame(dec1), as.data.frame(dec2))
#> decision prob_go gamma_go met_go prob_nogo gamma_nogo met_nogo
#> 1 Go 0.8517334 0.5 TRUE 0.0593461 0.8 FALSE
#> 2 Gray 0.2623753 0.5 FALSE 0.5440745 0.8 FALSE
as.data.frame(dec1, posterior = TRUE)
#> decision prob_go gamma_go met_go prob_nogo gamma_nogo met_nogo post_t_a
#> 1 Go 0.8517334 0.5 TRUE 0.0593461 0.8 FALSE 9.5
#> post_t_b post_c_a post_c_b
#> 1 3.5 4.5 8.5
