This table is data of MentalHealth. Build a table and save as .csv file. Month M
ID: 3313020 • Letter: T
Question
This table is data of MentalHealth. Build a table and save as .csv file.
Month Moon Admission 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 For this project, you will need the data set MentalHealth in the Stat2Data package. This data set is from a study of the phases of the moon (before the full moon, during the full moon, and after the full moon) to see if there is a relationship between hospital admissions and moon phase The month of the year was also recorded to see if there were any seasonal effects You are expected to build three models for this project: A One-Way ANOVA and two Two-Way ANOVAs. But before you can do that, you will need to subset and edit your data This dataset is for all 12 months of the year. I would like you to focus on only six: 3 months of winter (December, January, and February) & 3 months of fall (September, October, and November) You will need to create a new variable, season, which contains the names of the two seasons All analysis must be done on your subsetted data. Model 1: Perform a One-Way ANOVA to see if there is a difference in hospital admissions for the different phases of the moon. Be sure to outline all steps (4 points: 1 point for choosing ANOVA or the Kruskall-Wallace test, 1 point for fitting the model in R 1 point for doing diagnostics I point for reaching conclusion - whether there is a difference or not If you start with ANOVA and switch to Kruskall-Wallace after checking assumptions, that's fine. If you decide to remove an outlier, you need to prove it with the Cook's Distance or the 1.5 × IQR test.) If there is a difference, use Tukey's HSD to figure out which phase(s) of the moon have MORE hospital admissions (1 point: If you found a difference, you should discuss which phase had If you did not find a significant difference in your conclusion, you should NOT do Tukey's HSD.) Model 2: Perform a Two-Way ANOVA to control for the month of the year (1 point for creating the model Note: As we did not learn a non-parametric method for data with two predictors, you may presume that the data satisfies the ANOVA assumptions and use the regular Two-Way ANOV Can you include an interaction term? Why or why not? (2 points: 1 point for decision, 1 point for explanation) For your model, explain how the month variable is functioning in your model (1 point for describing how "Month" works as the block in the model)Explanation / Answer
#importing the data set saved .csv file
> data1=read.csv(file.choose(),header=T)
> attach(data1)
MODEL 1:
> model=aov(Admission~Moon)
> summary(model)
Df Sum Sq Mean Sq F value Pr(>F)
Moon 2 41.5 20.76 1.174 0.322
Residuals 33 583.4 17.68
Since p-value > 0.05, we accept the null hypothesis and conclude that mean of the no. of the admissions for different phases of moon are not significantly unequal.
> TukeyHSD(model)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Admission ~ Moon)
$Moon
diff lwr upr p adj
Before-After -0.5416667 -4.753680 3.670347 0.9466776
During-After 1.9583333 -2.253680 6.170347 0.4963163
During-Before 2.5000000 -1.712013 6.712013 0.3245984
No difference is significant as we can clearly observe from the p-values.
MODEL 2:
> model=aov(Admission~Moon+Month)
> summary(model)
Df Sum Sq Mean Sq F value Pr(>F)
Moon 2 41.5 20.76 3.573 0.0453 *
Month 11 455.6 41.42 7.129 5.08e-05 ***
Residuals 22 127.8 5.81
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Since p-values are < 0.05, we reject the null hypothesis and conclude that the different phases of moon and the months have a significant effect on the hospital admissions.
No interaction effect included.
> TukeyHSD(model)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Admission ~ Moon + Month)
$Moon
diff lwr upr p adj
Before-After -0.5416667 -3.01363015 1.930297 0.8473143
During-After 1.9583333 -0.51363015 4.430297 0.1382640
During-Before 2.5000000 0.02803652 4.971963 0.0471250
$Month
diff lwr upr p adj
Aug-Apr -13.00000000 -20.15903984 -5.8409602 0.0000631
Dec-Apr -10.36666667 -17.52570650 -3.2076268 0.0012994
Feb-Apr -6.06666667 -13.22570650 1.0923732 0.1496863
Jan-Apr -7.96666667 -15.12570650 -0.8076268 0.0206959
Jul-Apr -1.96666667 -9.12570650 5.1923732 0.9960667
Jun-Apr -5.90000000 -13.05903984 1.2590398 0.1745228
Mar-Apr -4.43333333 -11.59237317 2.7257065 0.5330487
May-Apr -4.40000000 -11.55903984 2.7590398 0.5434969
Nov-Apr -9.30000000 -16.45903984 -2.1409602 0.0045044
Oct-Apr -9.26666667 -16.42570650 -2.1076268 0.0046821
Sep-Apr -8.96666667 -16.12570650 -1.8076268 0.0066267
Dec-Aug 2.63333333 -4.52570650 9.7923732 0.9640031
Feb-Aug 6.93333333 -0.22570650 14.0923732 0.0633963
Jan-Aug 5.03333333 -2.12570650 12.1923732 0.3576853
Jul-Aug 11.03333333 3.87429350 18.1923732 0.0005980
Jun-Aug 7.10000000 -0.05903984 14.2590398 0.0532271
Mar-Aug 8.56666667 1.40762683 15.7257065 0.0104953
May-Aug 8.60000000 1.44096016 15.7590398 0.0101025
Nov-Aug 3.70000000 -3.45903984 10.8590398 0.7588977
Oct-Aug 3.73333333 -3.42570650 10.8923732 0.7493888
Sep-Aug 4.03333333 -3.12570650 11.1923732 0.6590633
Feb-Dec 4.30000000 -2.85903984 11.4590398 0.5750210
Jan-Dec 2.40000000 -4.75903984 9.5590398 0.9812654
Jul-Dec 8.40000000 1.24096016 15.5590398 0.0126928
Jun-Dec 4.46666667 -2.69237317 11.6257065 0.5226421
Mar-Dec 5.93333333 -1.22570650 13.0923732 0.1693053
May-Dec 5.96666667 -1.19237317 13.1257065 0.1642146
Nov-Dec 1.06666667 -6.09237317 8.2257065 0.9999872
Oct-Dec 1.10000000 -6.05903984 8.2590398 0.9999825
Sep-Dec 1.40000000 -5.75903984 8.5590398 0.9998138
Jan-Feb -1.90000000 -9.05903984 5.2590398 0.9970559
Jul-Feb 4.10000000 -3.05903984 11.2590398 0.6381994
Jun-Feb 0.16666667 -6.99237317 7.3257065 1.0000000
Mar-Feb 1.63333333 -5.52570650 8.7923732 0.9992191
May-Feb 1.66666667 -5.49237317 8.8257065 0.9990631
Nov-Feb -3.23333333 -10.39237317 3.9257065 0.8747334
Oct-Feb -3.20000000 -10.35903984 3.9590398 0.8815456
Sep-Feb -2.90000000 -10.05903984 4.2590398 0.9329667
Jul-Jan 6.00000000 -1.15903984 13.1590398 0.1592489
Jun-Jan 2.06666667 -5.09237317 9.2257065 0.9940896
Mar-Jan 3.53333333 -3.62570650 10.6923732 0.8042662
May-Jan 3.56666667 -3.59237317 10.7257065 0.7955069
Nov-Jan -1.33333333 -8.49237317 5.8257065 0.9998834
Oct-Jan -1.30000000 -8.45903984 5.8590398 0.9999087
Sep-Jan -1.00000000 -8.15903984 6.1590398 0.9999933
Jun-Jul -3.93333333 -11.09237317 3.2257065 0.6899464
Mar-Jul -2.46666667 -9.62570650 4.6923732 0.9771591
May-Jul -2.43333333 -9.59237317 4.7257065 0.9792886
Nov-Jul -7.33333333 -14.49237317 -0.1742935 0.0414981
Oct-Jul -7.30000000 -14.45903984 -0.1409602 0.0430122
Sep-Jul -7.00000000 -14.15903984 0.1590398 0.0591328
Mar-Jun 1.46666667 -5.69237317 8.6257065 0.9997108
May-Jun 1.50000000 -5.65903984 8.6590398 0.9996431
Nov-Jun -3.40000000 -10.55903984 3.7590398 0.8375341
Oct-Jun -3.36666667 -10.52570650 3.7923732 0.8453798
Sep-Jun -3.06666667 -10.22570650 4.0923732 0.9066121
May-Mar 0.03333333 -7.12570650 7.1923732 1.0000000
Nov-Mar -4.86666667 -12.02570650 2.2923732 0.4032190
Oct-Mar -4.83333333 -11.99237317 2.3257065 0.4126699
Sep-Mar -4.53333333 -11.69237317 2.6257065 0.5019803
Nov-May -4.90000000 -12.05903984 2.2590398 0.3938784
Oct-May -4.86666667 -12.02570650 2.2923732 0.4032190
Sep-May -4.56666667 -11.72570650 2.5923732 0.4917380
Oct-Nov 0.03333333 -7.12570650 7.1923732 1.0000000
Sep-Nov 0.33333333 -6.82570650 7.4923732 1.0000000
Sep-Oct 0.30000000 -6.85903984 7.4590398 1.0000000
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.