study_dta_none <- function(data = generate_data(seed=1337),
contrast = define_contrast("raw"),
benchmark = 0.5,
alpha = 0.05,
alternative = "greater",
analysis = "co-primary",
transformation = "none",
regu = FALSE,
pars = list()
){
stats <- data2stats(data, contrast=contrast, regu = regu)
cv <- cv_uni(alpha, alternative)
## output
stats %>%
stats2results(
cv=cv, pval_fun=pval_uni, benchmark,
alternative, transformation
) %>%
setattr(
n = sapply(stats, function(x) x$n), m=ncol(data[[1]]),
alpha=alpha, alpha_adj=alpha, cv=cv
) %>%
return()
}
# Helper functions ----------------------------------------------------------------------------
cv_uni <- function(alpha = 0.05,
alternative = "two.sided",
...) {
c(switch(
alternative,
two.sided = stats::qnorm(alpha / 2),
less = -Inf,
greater = stats::qnorm(alpha)
),
switch(
alternative,
two.sided = stats::qnorm(1 - alpha / 2),
less = stats::qnorm(1 - alpha),
greater = Inf
)
)
}
pval_uni <- function(tstat, alternative = "two.sided"){
switch(
alternative,
two.sided = stats::pnorm(abs(tstat), lower.tail = FALSE),
less = stats::pnorm(-tstat, lower.tail = FALSE),
greater = stats::pnorm(tstat, lower.tail = FALSE)
)
}
# TODO: pval_uni - check correctness
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.