Skip to contents

Used internally. This function generates draws from posterior, normal distributions for continuous outcomes. Technically, these posteriors use no priors (for simulation speed), corresponding to the use of improper flat priors. These posteriors correspond (and give similar results) to using normal-normal models (normally distributed outcome, conjugate normal prior) for each arm, assuming that a non-informative, flat prior is used. Thus, the posteriors directly correspond to normal distributions with each groups' mean as the mean and each groups' standard error as the standard deviation. As it is necessary to always return valid draws, in cases where < 2 patients have been randomised to an arm, posterior draws will come from an extremely wide normal distribution with mean corresponding to the mean of all included patients with outcome data and a standard deviation corresponding to the difference between the highest and lowest recorded outcomes for all patients with available outcome data multiplied by 1000.

Usage

get_draws_norm(arms, allocs, ys, control, n_draws)

Arguments

arms

character vector, currently active arms as specified in setup_trial() / setup_trial_binom() / setup_trial_norm().

allocs

character vector, allocations of all patients (including allocations to currently inactive arms).

ys

numeric vector, outcomes of all patients in the same order as alloc (including outcomes of patients in currently inactive arms).

control

unused argument in the built-in functions for setup_trial_binom() and setup_trial_norm, but required as this argument is supplied by the run_trial() function, and may be used in user-defined functions used to generate posterior draws.

n_draws

single integer, number of posterior draws.

Value

A matrix (with numeric values) with length(arms) columns and n_draws rows, with arms as column names.