Title

This is an R HTML document. When you click the Knit HTML button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

You can also embed plots, for example:

Given data

y <- c(12,14,13,15,16, 18,17,19,20,18, 10,11,9,12,8) g <- factor(rep(c(“G1”,“G2”,“G3”), each = 5))

1. Fit One-Way ANOVA model

anova_model <- aov(y ~ g)

Display ANOVA table

summary(anova_model)

4. Perform Tukey HSD Test

tukey_result <- TukeyHSD(anova_model)

Display Tukey results

tukey_result

Optional: Plot Tukey confidence intervals

plot(tukey_result) # Given data y <- c(5,6,7,8, 6,7,8,9, 10,11,12,13) A <- factor(rep(c(“A1”,“A2”,“A3”), each = 4)) B <- factor(rep(c(“B1”,“B2”), times = 6))

1. Fit Two-Way ANOVA model (without interaction)

model <- aov(y ~ A + B)

Display ANOVA table

summary(model)

2. Test factor A

(Already included in ANOVA table output)

Extract p-value for A if needed

anova_summary <- summary(model) p_value_A <- anova_summary[[1]][“A”, “Pr(>F)”]

3. Test factor B

Extract p-value for B

p_value_B <- anova_summary[[1]][“B”, “Pr(>F)”]

1. Fit model with interaction

model <- aov(y ~ A * B)

Display ANOVA table

summary(model)

2. Check significance of interaction (A:B)

anova_summary <- summary(model) p_value_interaction <- anova_summary[[1]][“A:B”, “Pr(>F)”]