| analyze | R Documentation |
Master Analysis Function - Auto-detects and runs the right test
analyze(
x = NULL,
y = NULL,
data = NULL,
formula = NULL,
mu = 0,
paired = FALSE,
nonparam = FALSE,
conf.level = 0.95,
var_name = "Variable",
var1_name = "Variable 1",
var2_name = "Variable 2",
method = "pearson"
)
x |
A numeric vector (required always) |
y |
A numeric vector, factor, or character group variable (optional) |
data |
A data frame (required if using a formula) |
formula |
A formula of the form outcome ~ predictor or outcome ~ group1 * group2 or cbind(y1, y2) ~ group (optional) |
mu |
Hypothesised mean for one-sample t-test. Default 0. |
paired |
Logical. TRUE for paired t-test. Default FALSE. |
nonparam |
Logical. TRUE to use non-parametric tests. Default FALSE. |
conf.level |
Confidence level. Default 0.95. |
var_name |
Optional label for the report. |
var1_name |
Optional name for first variable in correlation. |
var2_name |
Optional name for second variable in correlation. |
method |
Correlation method: "pearson", "spearman", or "kendall". Default "pearson". |
A printed analysis report from the appropriate test
# Descriptive only
analyze(x = c(23, 45, 12, 67, 34))
# Auto t-test
analyze(x = c(23,45,12,67,34), y = c(19,38,22,51,29))
# Auto Mann-Whitney (non-parametric)
analyze(x = c(23,45,12,67,34), y = c(19,38,22,51,29),
nonparam = TRUE)
# Auto correlation
analyze(x = c(23,45,12,67,34), y = c(19,38,22,51,29),
var1_name = "Scores", var2_name = "Hours")
# Auto One-Way ANOVA
df <- data.frame(
score = c(23,45,12,67,34,89,56,43,78,90,11,34),
group = rep(c("A","B","C"), each = 4)
)
analyze(formula = score ~ group, data = df)
# Auto Kruskal-Wallis (non-parametric)
analyze(formula = score ~ group, data = df, nonparam = TRUE)
# Auto Two-Way ANOVA
df2 <- data.frame(
score = c(23,45,12,67,34,89,56,43,78,90,11,34),
method = rep(c("Online","Traditional"), each = 6),
gender = rep(c("Male","Female"), times = 6)
)
analyze(formula = score ~ method * gender, data = df2)
# Auto Regression
df3 <- data.frame(
exam_score = c(23,45,12,67,34,89,56,43,78,90),
study_hours = c(2,5,1,7,3,9,6,4,8,10)
)
analyze(formula = exam_score ~ study_hours, data = df3)
# Auto Multiple Regression
df4 <- data.frame(
exam_score = c(23,45,12,67,34,89,56,43,78,90),
study_hours = c(2,5,1,7,3,9,6,4,8,10),
attendance = c(60,80,50,90,70,95,85,75,88,92)
)
analyze(formula = exam_score ~ study_hours + attendance, data = df4)
# Auto MANOVA
df5 <- data.frame(
math = c(23,45,12,67,34,89,56,43,78,90,11,34),
english = c(34,56,23,78,45,90,67,54,89,95,22,45),
group = rep(c("A","B","C"), each = 4)
)
analyze(formula = cbind(math, english) ~ group, data = df5)
# Chi-square
analyze(
x = c("Yes","No","Yes","Yes","No"),
y = c("Male","Female","Male","Female","Male")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.