- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find the critical value of F for one-way ANOVA in R?
To find the critical value of F for one-way ANOVA in R, we can follow the below steps −
- First of all, create a data frame with one categorical and one numerical column.
- Then, use aov function to find the anova table.
- After that, use qf function to find the critical value of F for one-way ANOVA.
Create the data frame
Let's create a data frame as shown below −
Grp<-sample(LETTERS[1:4],20,replace=TRUE) Score<-rnorm(20) df<-data.frame(Grp,Score) df
On executing, the above script generates the below output(this output will vary on your system due to randomization) −
Grp Score 1 B 1.75508031 2 D -1.43867197 3 B -0.18409783 4 C -1.72435769 5 C -0.95996448 6 B 0.19776077 7 B 0.52247374 8 C -1.28337249 9 C -0.63236147 10 B 0.93966870 11 B 0.23925102 12 B 0.86565239 13 B 0.07353123 14 A -0.62096596 15 A -1.76680335 16 A 0.12203536 17 B 0.66276852 18 D -0.50199349 19 A -1.30960082 20 D -1.32413279
Create the anova table
Using aov function and summary function to find the anova table −
Grp<-sample(LETTERS[1:4],20,replace=TRUE) Score<-rnorm(20) df<-data.frame(Grp,Score) ANOVA<-aov(Score~Grp,data=df) ANOVA<-summary(ANOVA) ANOVA
Output
Df Sum Sq Mean Sq F value Pr(>F) Grp 3 12.870 4.29 11.6 0.000274 *** Residuals 16 5.917 0.37 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Find the critical value of F for one-way ANOVA
Using qf function to find the critical value of F for one-way ANOVA −
Grp<-sample(LETTERS[1:4],20,replace=TRUE) Score<-rnorm(20) df<-data.frame(Grp,Score) ANOVA<-aov(Score~Grp,data=df) ANOVA<-summary(ANOVA) qf(1-0.05,ANOVA[[1]][1,1],ANOVA[[1]][2,1])
Output
[1] 3.238872
Advertisements