weight age.years lat site
1 12615.13 41 2.690077 Site 1
2 12539.55 50 2.974857 Site 2
3 13753.97 21 -4.868759 Site 1
4 17269.26 50 -28.437431 Site 2
5 16945.27 16 -26.414605 Site 1
6 14723.24 39 -11.392111 Site 2
Variable Combinations
Data

Questions
1. What model syntax allows for the effect of age.years to be different at each level of site?
first = glm(weight ~ age.years + site + age.years:site
second = glm(weight ~ age.years + site)
third = glm(weight ~ age.years * site)
fourth = glm(weight ~ poly(age.years,2) + site2. Draw an x-y plot showing the relationship b/w weight and the additive effect of site and age.years. Assume a negative slope of age.years with weight and two levels of the variable site. Assume the intercept mle is 13000 and the estimated effect of siteSite2 = -2000. Label axes and slopes for each site.
glm(weight ~ age.years + site)3. Looking at the data table above, write out the design matrix for the two models below.
4. When might it be good to assume an additive effect b/w a categorical and continuous variable over an interaction?
5. Define what each coefficient means. Make sure to make clear the units.
Call:
glm(formula = weight ~ age.yeras.sc * site, data = dat)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 14574.8 241.9 60.245 < 2e-16 ***
age.yeras.sc -706.4 263.3 -2.682 0.00861 **
siteSite 2 -188.1 342.0 -0.550 0.58367
age.yeras.sc:siteSite 2 1173.1 347.5 3.375 0.00107 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for gaussian family taken to be 2908337)
Null deviance: 313494594 on 99 degrees of freedom
Residual deviance: 279200364 on 96 degrees of freedom
AIC: 1778
Number of Fisher Scoring iterations: 2