Skip to contents

Converts a result of qdm_find_n to a data frame with one row: the chosen sample sizes, the probabilities of meeting the criteria with them, the targets and the smallest sample sizes from which all larger candidates meet the targets. The probabilities for all candidates are in the element curve of the result, which is a data frame.

Usage

# S3 method for class 'qdm_n_search'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

An object of class "qdm_n_search".

row.names

NULL (the default) or the name of the row.

optional

Not used.

...

Not used.

Value

A data frame with one row and the columns n_t, n_c, prob_go, target_go, prob_nogo, target_nogo, n_t_stable and n_c_stable (see qdm_find_n).

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)
)
res <- qdm_find_n(des, data.frame(pi_t = 0.4, pi_c = 0.4),
                  data.frame(pi_t = 0.7, pi_c = 0.4), target_go = 0.1,
                  target_nogo = 0.1, n_t = seq(6, 20, by = 2))
as.data.frame(res)
#>   n_t n_c    prob_go target_go  prob_nogo target_nogo n_t_stable n_c_stable
#> 1  20  20 0.07267047       0.1 0.01676229         0.1         20         20