# NOT RUN {
## t Tests
res <- t.test(1:10, y = c(7:20), var.equal = TRUE)
t_to_d(t = res$statistic, res$parameter)
t_to_r(t = res$statistic, res$parameter)
res <- with(sleep, t.test(extra[group == 1], extra[group == 2], paired = TRUE))
t_to_d(t = res$statistic, res$parameter, paired = TRUE)
t_to_r(t = res$statistic, res$parameter)
# }
# NOT RUN {
## Linear Regression
model <- lm(rating ~ complaints + critical, data = attitude)
library(parameters)
(param_tab <- parameters(model))
(rs <- t_to_r(param_tab$t[2:3], param_tab$df_error[2:3]))
if (require(see)) plot(rs)
# How does this compare to actual partial correlations?
if (require("correlation")) {
correlation::correlation(attitude[, c(1, 2, 6)], partial = TRUE)[1:2, c(2, 3, 7, 8)]
}
## Use with emmeans based contrasts (see also t_to_eta2)
if (require(emmeans)) {
warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
# Also see emmeans::eff_size()
em_tension <- emmeans(warp.lm, ~tension) #'
diff_tension <- summary(pairs(em_tension))
t_to_d(diff_tension$t.ratio, diff_tension$df)
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab