Question
This is written and solved ONLY using rStudio. But if you have an easier way to do it, that works: Information: The Long Term Resource
This is written and solved ONLY using rStudio. But if you have an easier way to do it, that works:
Information:
The Long Term Resource Monitoring (LTRM) project has been conducting research and monitoring on the Upper Mississippi River System since 1986.
Here is a bit about the LTRM from their website: "Fishes of the Upper Mississippi River System have recreational and commercial value, conservation potential, and can be used to assess the ecological integrity of the aquatic ecosystem.
The objective of the standardized monitoring is to quantify the status and trends of fish populations and communities and identify relations with various other ecological attributes. The findings can be used to address fisheries management concerns.
The Long Term Resource Monitoring element uses a multigear and multihabitat sampling design to collect fish data in six study pools/reaches."
The file fish_data.rda is available at the bottom of the page, It contains length and weight measurements for a sample of 50 fish of four difference species of interest:
BHMW = Bullhead minnow,
BKCP = Black crappie,
BLGL = Bluegill,
BWFN = Bowfin.
Additionally, the file includes the date that the fish was observed.
Load packages
library(tidyverse) library(broom) library(car)
Question 1 (2 pts)
It is standard practice to plot and model the relationship between fish weight and length using a logarithm transformation on both variables. To see the reason for the use of these transformations, we are going to start by fitting a model without any transformation.
Fit a model for predicting weight based on length and species. Include the length by species interaction term. Create and inspect the 4-pack of model diagnostic plots.
What conditions fail based on the 4-pack of plots? Select all that apply.
Group of answer choices
L = Linear
I = Independent errors
N = Normally distributed errors
E = Equal variance of errors
Question 2 (2 pts)
Refit the model from question 1 with a log-transformation applied to both weight and length. Include the log(length) by species interaction term. Again, inspect the diagnostic plots. Call this model fit MOD_interact as we will refer to it later.
Have model conditions improved in comparison to the model based on non-transformed data?
a. Yes, all plots look ideal
b. Yes, there is improvement but there are still some concerns with normality and outliers
c. No, the model conditions look to be violated to the same degree as without the transformations
d. No, the model conditions look to be much worse with the transformations applied
Question 3 (2 pts)
Extract the residuals from your fit model using the residuals() function. Create a scatter plot of your model residuals (y) over time (x=fdate) to assess the assumed independence of model errors. Distinct patterns in the residuals over time (e.g.residuals trending upward over time) suggest a violation of the assumption of independent errors in linear regression.
Do you see any clear patterns in your plot of the residuals over time?
Yes / No
Question 4 (2 pts)
Make a plot that visualizes the interaction - weight on the y-axis (log-scale), length on the x-axis (log-scale), and fishcode showing the categorical predictor variable with a separate line fit for each category. You can do this with geom_abline or with geom_smooth with color/group set in the aes.
What best describes the nature of this interaction?
Group of answer choices
a. The four species seem to have the same slopes (no interaction)
b. The slopes are notably steeper for BLGL and BWFN than for BHMW and BKCP (interaction present)
c. The slope for BWFN is slightly shallower than for the other 3 species (interaction present)
Question 5 (2 pts)
Fit the model with no interaction term. Call this model MOD_additive.
Based on AIC values, which model is better?
Group of answer choices
a. MOD_interact
b. MOD_additive
c. Essentially no difference between the two models (AIC is identical to 3 decimal places)
Question 6 (2 pts)
Based on adjusted R2 values, which model is better?
Group of answer choices
a. MOD_interact
b. MOD_additive
c. Essentially no difference between the two models (adjusted R2 is identical to 3 decimal places)
Question 7 (2 pts)
Carry out a comparative ANOVA test H0: MOD_additive versus H1: MOD_interact. What is the associated p-value? (Fill in the blank, 4 decimal places)
p-value =
Question 8 (2 pts)
Using the interaction model, what is the predicted weight of a blue gill (BLGL) with a length of 100? Be mindful of the log transformation that the model has applied to length and weight. (Fill in the blank, 4 decimal places)
Predicted weight =
Here is the fish_data used in this exercise:
length | weight | fishcode | fdate |
74 | 4 | BHMW | 2020-07-23 |
66 | 3 | BHMW | 2020-10-06 |
63 | 2 | BHMW | 2020-09-29 |
42 | 0.67 | BHMW | 2020-07-14 |
66 | 3 | BHMW | 2019-08-28 |
42 | 0.67 | BHMW | 2020-07-14 |
64 | 2 | BHMW | 2019-10-25 |
39 | 0.53 | BHMW | 2020-07-14 |
73 | 5 | BHMW | 2019-07-24 |
69 | 3 | BHMW | 2020-08-25 |
53 | 1 | BHMW | 2020-08-25 |
55 | 2 | BHMW | 2020-06-26 |
48 | 1.07 | BHMW | 2020-07-14 |
48 | 1 | BHMW | 2020-07-23 |
67 | 3 | BHMW | 2019-09-10 |
37 | 0.43 | BHMW | 2020-07-14 |
51 | 1 | BHMW | 2018-08-14 |
43 | 0.67 | BHMW | 2020-07-14 |
55 | 2 | BHMW | 2019-08-28 |
55 | 1 | BHMW | 2018-08-14 |
41 | 0.59 | BHMW | 2020-07-14 |
43 | 0.68 | BHMW | 2020-07-14 |
55 | 2 | BHMW | 2019-07-24 |
38 | 0.5 | BHMW | 2020-07-14 |
58 | 2 | BHMW | 2020-08-25 |
53 | 1 | BHMW | 2020-08-25 |
66 | 3 | BHMW | 2020-08-25 |
52 | 1 | BHMW | 2020-08-25 |
54 | 2 | BHMW | 2019-07-24 |
70 | 3 | BHMW | 2020-08-25 |
55 | 2 | BHMW | 2020-08-25 |
76 | 5 | BHMW | 2020-08-25 |
58 | 2 | BHMW | 2018-09-06 |
49 | 1 | BHMW | 2018-08-14 |
59 | 1 | BHMW | 2018-09-06 |
60 | 2 | BHMW | 2020-09-22 |
54 | 1 | BHMW | 2018-07-24 |
42 | 0.67 | BHMW | 2020-07-14 |
34 | 0.3 | BHMW | 2020-08-25 |
67 | 3 | BHMW | 2018-09-06 |
261 | 296 | BKCP | 2011-10-17 |
187 | 105 | BKCP | 1999-09-28 |
218 | 144 | BKCP | 2007-10-04 |
77 | 6 | BKCP | 2010-10-15 |
232 | 210 | BKCP | 1997-09-18 |
69 | 3 | BKCP | 1999-09-23 |
165 | 70 | BKCP | 1999-09-22 |
270 | 330 | BKCP | 1992-10-21 |
254 | 263 | BKCP | 2006-09-22 |
139 | 36 | BKCP | 2009-09-23 |
144 | 36 | BKCP | 2007-10-09 |
245 | 275 | BKCP | 1994-09-29 |
128 | 26 | BKCP | 2016-09-30 |
302 | 436 | BKCP | 1993-09-24 |
149 | 48 | BKCP | 1999-09-21 |
302 | 479 | BKCP | 2020-09-29 |
270 | 344 | BKCP | 1997-10-08 |
92 | 11 | BKCP | 1997-09-19 |
69 | 5 | BKCP | 2013-09-26 |
123 | 35 | BKCP | 1993-09-30 |
256 | 249 | BKCP | 2012-09-21 |
223 | 173 | BKCP | 1996-09-25 |
285 | 391 | BKCP | 2009-09-17 |
159 | 55 | BKCP | 1999-10-20 |
66 | 3 | BKCP | 2007-10-04 |
166 | 67 | BKCP | 2001-09-19 |
140 | 39 | BKCP | 2016-09-30 |
97 | 12 | BKCP | 2007-09-17 |
209 | 135 | BKCP | 2000-09-21 |
84 | 7 | BKCP | 2009-09-24 |
154 | 59 | BKCP | 1995-09-19 |
103 | 14 | BKCP | 2001-10-23 |
176 | 78 | BKCP | 2011-09-22 |
243 | 232 | BKCP | 2004-10-07 |
298 | 449 | BKCP | 2019-10-08 |
89 | 9 | BKCP | 2018-09-25 |
253 | 294 | BKCP | 2001-10-29 |
281 | 440 | BKCP | 2008-09-17 |
177 | 82 | BKCP | 1996-10-08 |
117 | 20 | BKCP | 2014-10-08 |
52 | 2 | BLGL | 2019-09-06 |
125 | 41 | BLGL | 2012-09-25 |
157 | 102 | BLGL | 2016-09-30 |
50 | 2 | BLGL | 2011-10-11 |
230 | 263 | BLGL | 2013-10-16 |
65 | 5 | BLGL | 2010-10-19 |
130 | 50 | BLGL | 2008-10-30 |
138 | 47 | BLGL | 2001-09-18 |
90 | 8 | BLGL | 2009-09-24 |
191 | 160 | BLGL | 2012-09-21 |
88 | 12 | BLGL | 2016-10-24 |
94 | 16 | BLGL | 2020-10-06 |
53 | 4 | BLGL | 2014-10-15 |
136 | 47 | BLGL | 2015-10-20 |
173 | 120 | BLGL | 2001-09-20 |
49 | 2 | BLGL | 2013-09-20 |
50 | 2 | BLGL | 2019-10-08 |
192 | 173 | BLGL | 2016-09-30 |
115 | 29 | BLGL | 2006-10-25 |
112 | 30 | BLGL | 2011-09-22 |
175 | 123 | BLGL | 2009-09-17 |
81 | 10 | BLGL | 1995-10-03 |
115 | 47 | BLGL | 2012-09-25 |
129 | 45 | BLGL | 2019-09-24 |
93 | 14 | BLGL | 2015-10-22 |
52 | 2 | BLGL | 2011-10-03 |
130 | 45 | BLGL | 2018-10-02 |
175 | 130 | BLGL | 2019-09-05 |
116 | 38 | BLGL | 2005-10-12 |
95 | 15 | BLGL | 2006-09-26 |
93 | 15 | BLGL | 2007-09-17 |
201 | 210 | BLGL | 2018-08-28 |
153 | 80 | BLGL | 2003-09-18 |
96 | 17 | BLGL | 2007-10-04 |
182 | 134 | BLGL | 2008-10-01 |
66 | 2 | BLGL | 2005-10-12 |
68 | 5 | BLGL | 2009-10-22 |
131 | 48 | BLGL | 2001-09-18 |
145 | 62 | BLGL | 2012-09-20 |
233 | 331 | BLGL | 2019-09-24 |
636 | 2428 | BWFN | 2020-09-02 |
204 | 84 | BWFN | 2019-08-22 |
474 | 1108 | BWFN | 2020-08-25 |
562 | 1449 | BWFN | 2019-07-09 |
568 | 2588 | BWFN | 2020-06-23 |
516 | 1298 | BWFN | 2020-08-18 |
608 | 1965 | BWFN | 2020-08-19 |
504 | 1246 | BWFN | 2019-08-22 |
500 | 1083 | BWFN | 2020-08-25 |
547 | 1404 | BWFN | 2020-10-02 |
633 | 2110 | BWFN | 2020-07-14 |
617 | 1760 | BWFN | 2020-09-29 |
632 | 2138 | BWFN | 2019-07-03 |
598 | 2042 | BWFN | 2020-07-07 |
554 | 1529 | BWFN | 2020-08-25 |
583 | 1766 | BWFN | 2019-09-24 |
585 | 1887 | BWFN | 2020-07-22 |
541 | 1602 | BWFN | 2019-08-22 |
545 | 1412 | BWFN | 2020-10-02 |
582 | 1697 | BWFN | 2020-10-02 |
629 | 2152 | BWFN | 2019-07-03 |
501 | 1048 | BWFN | 2020-10-02 |
572 | 1572 | BWFN | 2020-10-02 |
523 | 1117 | BWFN | 2020-09-29 |
603 | 1924 | BWFN | 2019-07-03 |
512 | 1202 | BWFN | 2020-08-25 |
558 | 1552 | BWFN | 2020-10-06 |
592 | 1908 | BWFN | 2020-10-02 |
222 | 119 | BWFN | 2019-08-22 |
637 | 2563 | BWFN | 2020-09-22 |
656 | 2496 | BWFN | 2020-07-07 |
559 | 1516 | BWFN | 2020-07-07 |
518 | 1225 | BWFN | 2020-10-02 |
712 | 3260 | BWFN | 2020-10-02 |
628 | 2438 | BWFN | 2020-07-23 |
531 | 1418 | BWFN | 2020-07-07 |
625 | 1946 | BWFN | 2020-08-25 |
582 | 1623 | BWFN | 2019-08-22 |
577 | 1729 | BWFN | 2020-10-02 |
517 | 1330 | BWFN | 2019-07-03 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started