Please answer the following question using the R software. I need the R CODE!! Y
ID: 3326884 • Letter: P
Question
Please answer the following question using the R software. I need the R CODE!! You dont need to solve part a,b! I need help with c,d,e,f! Please dont answer unless you can provide the correct R code. I will give good rating. Thank You.
4. Math 1054 has four sections. All the sections use the same final exam. The following table is the summary of the results on final exam Section # of students | Class average | Class SD 20 25 18 24 78 84 80 81 6.7 7.3 6.5 5.5 2 4 a). Find the average score of all students in these four sections. b). Find SSG, the sum of square from groups (or, sum of square between) c). Find SSE, the sum of square of Error (or, sum of square within) d). Find the F-value e). Find P-value f). Can we believe there is significant difference in students' performance among theExplanation / Answer
The R code, along with comment lines, have been provided underneath.
# sample sizes
n1 = 20; n2 = 25; n3 = 18; n4 = 24
# sample means
x1_bar = 78
x2_bar = 84
x3_bar = 80
x4_bar = 81
# sample sd
s1 = 6.7
s2 = 7.3
s3 = 6.5
s4 = 5.5
num1 = (n1 * x1_bar) + (n2 * x2_bar) + (n3 * x3_bar) + (n4 * x4_bar)
den1 = n1 + n2 + n3 + n4
x_bar = num1/den1
x_bar
## part (a) avg score of all students
SSG = (n1 * (x1_bar - x_bar)^2) + (n2 * (x2_bar - x_bar)^2) + (n3 * (x3_bar - x_bar)^2) + (n4 * (x4_bar - x_bar)^2)
SSG
## part (b) SSG
SSE = (n1 * s1^2) + (n2 * s2^2) + (n3 * s3^2) + (n4 * s4^2)
SSE
## part (c) SSE
n = n1 + n2 + n3 + n4
k = 4
F = (SSG/(k-1)) / (SSE/(n-k))
F
## part (d) F value
pf(F,k-1,n-k,lower.tail=F)
## part (e) p-value
Since the p-value is coming out to be greater than alpha = 0.05, we fail to reject the null hypothesis and conclude that the difference in students' performance among the 4 sections is not significant enough. The performances are almost similar.