View source: R/statistics.R View source: R/zzz-r4vn-inference.R
| ttesti | R Documentation |
ttesti() calculates one- or two-sample t tests from summary statistics.
ttest() performs the same analysis from variables and reports group
sample size, mean, standard error, standard deviation, and confidence interval.
ttest(..., effect = TRUE) additionally reports Cohen's d and Hedges' g.
With by = vars(province, sex, treatment), province and sex are nested
strata and treatment is the innermost two-group comparison.
ttesti(
n1,
mean1,
sd1,
n2 = NULL,
mean2 = NULL,
sd2 = NULL,
mu = 0,
equal = FALSE,
paired = FALSE,
r = NULL,
alternative = c("two.sided", "less", "greater"),
level = 0.95,
digits = 3,
p_digits = 3,
show = TRUE,
console = FALSE
)
ttesti(
n1, mean1, sd1, n2 = NULL, mean2 = NULL, sd2 = NULL, mu = 0, equal = FALSE,
paired = FALSE, r = NULL, alternative = c("two.sided", "less", "greater"),
level = 0.95, digits = 3, p_digits = 3, show = TRUE, console = FALSE
)
ttest(
x, y = NULL, by = NULL, data = NULL, mu = 0, equal = FALSE, paired = FALSE,
alternative = c("two.sided", "less", "greater"), level = 0.95,
effect = FALSE, digits = 3, p_digits = 3, show = TRUE, console = FALSE
)
ttest(
x,
y = NULL,
by = NULL,
data = NULL,
mu = 0,
equal = FALSE,
paired = FALSE,
alternative = c("two.sided", "less", "greater"),
level = 0.95,
effect = FALSE,
digits = 3,
p_digits = 3,
show = TRUE,
console = FALSE
)
n1, mean1, sd1 |
Sample size, mean, and standard deviation for group 1. |
n2, mean2, sd2 |
Optional sample size, mean, and standard deviation for group 2. |
mu |
Null mean or null mean difference. |
equal |
Use the equal-variance two-sample t test. |
paired |
Perform a paired analysis. |
r |
Correlation between paired measurements when only summaries are available. |
alternative |
Alternative hypothesis: |
level |
Confidence level as a proportion. |
digits, p_digits |
Decimal places for estimates and p-values. |
show |
Logical; open the formatted result in the Viewer. Default |
console |
Logical; also print the traditional text result in the Console. Default |
x, y |
Numeric variables. |
by |
Optional two-level grouping variable. |
data |
Data frame. If |
effect |
Logical; for |
Invisibly returns an object of class r4vn_stat.
ttesti(40, 12, 3, mu = 10)
ttesti(40, 12, 3, 35, 14, 4)
d <- data.frame(score = c(10,12,11,18,17,20,9,13,12,19,21,18),
treatment = rep(c("Control","Intervention"), each = 6),
province = rep(c("A","B"), each = 3, times = 2))
ttest(score, by = treatment, data = d, effect = TRUE)
ttest(score, by = vars(province, treatment), data = d, effect = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.