| simulate_ttest | R Documentation |
Simulate a two-group design
simulate_ttest(
n_a = 50L,
n_b = 50L,
mean_a = NULL,
mean_b = NULL,
sd_a = 1,
sd_b = 1,
labels = c("A", "B"),
outcome = "outcome",
seed = NULL,
batch = NULL
)
n_a, n_b |
Group sample sizes, each defaulting to |
mean_a, mean_b |
Group means. A mean left |
sd_a, sd_b |
Positive group standard deviations. |
labels |
Two group labels. |
outcome |
Name of the outcome variable. |
seed |
Optional random seed. |
batch |
Optional single positive whole number. When given, the
simulator runs |
A simulab_sim base data.frame with one row per observation and
columns id, group and outcome (renamed by outcome). Two tidy tables
come from as.data.frame(): what = "parameters" has one row per group
with columns group, n, mean and sd; what = "effects" has a single
row with columns contrast, mean_difference, pooled_sd and cohens_d,
the population Cohen's d formed from the sample-size-weighted pooled
standard deviation.
result <- simulate_ttest(n_a = 40, n_b = 40, mean_a = 0, mean_b = 0.6, seed = 1)
head(result)
as.data.frame(result, what = "parameters")
# With no arguments, the group means are drawn and reported.
drawn <- simulate_ttest(seed = 1)
as.data.frame(drawn, what = "parameters")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.