Write the R code for ANOVA, using the following data set. Get the following outp
ID: 3042634 • Letter: W
Question
Write the R code for ANOVA, using the following data set.
Get the following output:
Analysis of Variance Table
Response: Admission
Df Sum Sq Mean Sq F value Pr(>F)
Month 11 455.58 41.417 7.1285 5.076e-05 ***
Moon 2 41.51 20.757 3.5726 0.04533 *
Residuals 22 127.82 5.810
(The output values may not be accurate, but I am interested in the code to get this table of results)
Thank you
Month
Moon
Value
Aug
Before
6.4
Sep
Before
7.1
Oct
Before
6.5
Nov
Before
8.6
Dec
Before
8.1
Jan
Before
10.4
Feb
Before
11.5
Mar
Before
13.8
Apr
Before
15.4
May
Before
15.7
Jun
Before
11.7
Jul
Before
15.8
Aug
During
5
Sep
During
13
Oct
During
14
Nov
During
12
Dec
During
6
Jan
During
9
Feb
During
13
Mar
During
16
Apr
During
25
May
During
14
Jun
During
14
Jul
During
20
Aug
After
5.8
Sep
After
9.2
Oct
After
7.9
Nov
After
7.7
Dec
After
11
Jan
After
12.9
Feb
After
13.5
Mar
After
13.1
Apr
After
15.8
May
After
13.3
Jun
After
12.8
Jul
After
14.5
Month
Moon
Value
Aug
Before
6.4
Sep
Before
7.1
Oct
Before
6.5
Nov
Before
8.6
Dec
Before
8.1
Jan
Before
10.4
Feb
Before
11.5
Mar
Before
13.8
Apr
Before
15.4
May
Before
15.7
Jun
Before
11.7
Jul
Before
15.8
Aug
During
5
Sep
During
13
Oct
During
14
Nov
During
12
Dec
During
6
Jan
During
9
Feb
During
13
Mar
During
16
Apr
During
25
May
During
14
Jun
During
14
Jul
During
20
Aug
After
5.8
Sep
After
9.2
Oct
After
7.9
Nov
After
7.7
Dec
After
11
Jan
After
12.9
Feb
After
13.5
Mar
After
13.1
Apr
After
15.8
May
After
13.3
Jun
After
12.8
Jul
After
14.5
Explanation / Answer
Firstly, enter the data set that you have provided above in an Excel file and then save it as a CSV file.
I have done this and saved the file with the filename "a.csv".
The R code is now pasted below (along with comment lines).
# LOADING AND VIEWING THE DATASET IN R
data=read.csv("C:\users\laptop\desktop\a.csv")
data
# GENERATING THE DESIRED ANOVA TABLE HERE
res.aov = aov(Value ~ Month + Moon, data)
summary(res.aov)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.