This dataset includes recent hygiene inspection data for public and private school cafeterias located in New York City.
We will conduct data analysis to see if there are differences in hygiene scores between the five boroughs (ANOVA), if there are differences according to the type of school (t-test), and analyze through regression equations that explain hygiene scores.
Df Sum Sq Mean Sq F value Pr(>F)
Borough 4 92 23.078 6.615 2.6e-05 ***
Residuals 9524 33228 3.489
According to the ANOVA analysis, there are differences between the boroughs.
Brooklyn-Bronx 0.267108714 0.09079207 0.44342536 0.0003478
Manhattan-Bronx 0.101223872 -0.10397898 0.30642672 0.6624186
Queens-Bronx 0.109774695 -0.08535033 0.30489972 0.5396546
Staten Island-Bronx -1.016831683 -4.62387414 2.59021078 0.9394793
Manhattan-Brooklyn -0.165884842 -0.31343097 -0.01833872 0.0184248
Queens-Brooklyn -0.157334019 -0.29050843 -0.02415961 0.0111397
Staten Island-Brooklyn -1.283940397 -4.88816250 2.32028171 0.8679018
Queens-Manhattan 0.008550822 -0.16102534 0.17812699 0.9999195
Staten Island-Manhattan -1.118055556 -4.72380619 2.48769508 0.9161659
Staten Island-Queens -1.126606378 -4.73179752 2.47858477 0.9139457
There is a difference of 0.267108714 between these two groups. This indicates that the average of the Brooklyn group is higher than that of the Bronx group. This difference is statistically significant (p-value 0.0003478), so there is indeed a difference between these two groups.
Manhattan and Brooklyn: There is a difference of -0.165884842 between these two groups. This indicates that the average of the Manhattan group is lower than that of the Brooklyn group. This difference is statistically significant (p-value 0.0184248), so there is indeed a difference between these two groups.
Welch Two Sample t-test
data: group1 and group2 t = 9.1517, df = 9220.3, p-value \< 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval: 0.2758294 0.4261983 sample estimates:
mean of x mean of y
3.377571 3.026558
This shows that the average difference in the ‘Level’ value between “FSE (Private School Cafeteria)” and “FSE (Public School Cafeteria)” is statistically significant. The difference is expected to be between approximately 0.2758294 and 0.4261983.
Call:
lm(formula = Level \~ LATITUDE + LONGITUDE + CENSUSTRACT + group, data = myData)
Residuals:\
Min 1Q Median 3Q Max -2.520 -1.295 -1.029 2.568 3.153\
Coefficients:\
Estimate Std. Error t value Pr(\>\|t\|)\
(Intercept) 7.621e+00 3.277e+01 0.233 0.8161\
LATITUDE -8.202e-01 2.887e-01 -2.841 0.0045 \*\*\
LONGITUDE -3.932e-01 3.562e-01 -1.104 0.2696\
CENSUSTRACT 1.594e-06 7.075e-07 2.253 0.0243 \*\
group -3.340e-01 3.908e-02 -8.548 \<2e-16 \*\*\* --- Signif. codes: 0 '***'** 0.001 **'**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\
Residual standard error: 1.86 on 9524 degrees of freedom Multiple R-squared: 0.01126, Adjusted R-squared: 0.01085\
F-statistic: 27.12 on 4 and 9524 DF, p-value: \< 2.2e-16
According to the results of the regression analysis, the independent variables ‘LATITUDE’, ‘CENSUSTRACT’, and ‘group’ appear to have a statistically significant impact on the dependent variable ‘Level’.
‘LATITUDE’ appears to decrease the ‘Level’ by approximately -0.8202 on average with every unit increase. This indicates a tendency for the ‘Level’ to decrease as latitude increases.
The dummy variable ‘group’ differentiates between ‘FSE (Public School Cafeteria)’ and ‘FSE (Private School Cafeteria)’, and the ‘Level’ of ‘FSE (Private School Cafeteria)’ is on average about -0.3340 lower than ‘FSE (Public School Cafeteria)’. This means that the ‘Level’ measured at the ‘FSE (Private School Cafeteria)’ is on average about -0.3340 lower than the ‘FSE (Public School Cafeteria)’.