# HENV 665Q - Quantitative Research Methods Assignment 3
# Juan Buzzetti ID 9485651
# Part 1
# Importing dataset:
wce <- read.csv("/Users/Buzz/Desktop/HENV665Q/Lab8/wced.csv", header = T)
attach(wce)
wce3r <- subset(wce, Region != "S. America" & Region != "Africa")
names(wce3r)
## [1] "City" "Year" "Population"
## [4] "Emission_total" "Emissions_percapita" "Region"
attach(wce3r)
## The following object(s) are masked from 'wce':
##
## City, Emission_total, Emissions_percapita, Population, Region,
## Year
View(wce3r)
# * * * QUESTION 1 * * *
kruskal.test(Emission_total ~ Region)
##
## Kruskal-Wallis rank sum test
##
## data: Emission_total by Region
## Kruskal-Wallis chi-squared = 12.11, df = 2, p-value = 0.002343
# Comparing the Kruskal-Wallis test to ANOVA it can be seen that the
# values of P differ. ANOVA yielded a P-Value of 0,0000942, while
# Krusal's was 0.0061. Both values of tests indicate that Region has a
# signficant effect on CO2 total emissions, however, the non-parametric
# test shows a less significant impact of regions over CO2 emissions.
# * * * QUESTION 2 * * *
logET <- log(Emission_total)
logmodel <- lm(logET ~ Population + Region + Population:Region)
summary.lm(logmodel)
##
## Call:
## lm(formula = logET ~ Population + Region + Population:Region)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.0960 -0.3292 0.0576 0.3284 1.0199
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.19e+00 7.52e-01 4.25 0.00023 ***
## Population 1.09e-07 5.84e-08 1.87 0.07260 .
## RegionEurope -1.20e+00 7.74e-01 -1.55 0.13209
## RegionN. America -8.83e-01 8.63e-01 -1.02 0.31502
## Population:RegionEurope 1.68e-07 7.48e-08 2.24 0.03347 *
## Population:RegionN. America 1.65e-07 9.03e-08 1.83 0.07877 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.576 on 27 degrees of freedom
## Multiple R-squared: 0.788, Adjusted R-squared: 0.749
## F-statistic: 20.1 on 5 and 27 DF, p-value: 2.39e-08
# The previous model had shown that there were some signficant effects
# between CO2 emissions and population (P-value = 6.13e-11) with the
# interaction term showing a marginal effect of European population over
# C0 total emissions. The new model ratifies both indicators, showing
# again that population has a significant effect over total CO2 emissions,
# and with a marginal interaction between European population and total
# emissions. If in this model we consider a level of significance of 0.1
# we will find that populations of North America and Asia have more
# significant effects over total emissions with Europe as the exception to
# the rule. This differs from what ANOVA yielded if we set the level of
# significance at 0.1 in the previous model, for all regions but N.America
# and interaction terms have effects on C02 total emissions.
# * * * QUESTION 3 * * *
SqET <- sqrt(Emission_total)
Sqmodel <- lm(SqET ~ Population + Region + Population:Region)
summary.lm(Sqmodel)
##
## Call:
## lm(formula = SqET ~ Population + Region + Population:Region)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.4667 -0.7872 -0.0558 1.0616 2.1633
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.06e+00 1.76e+00 1.74 0.09365 .
## Population 5.70e-07 1.37e-07 4.16 0.00029 ***
## RegionEurope -4.13e-01 1.81e+00 -0.23 0.82154
## RegionN. America -1.69e-01 2.02e+00 -0.08 0.93419
## Population:RegionEurope 7.10e-08 1.75e-07 0.40 0.68885
## Population:RegionN. America 2.74e-07 2.12e-07 1.29 0.20682
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.35 on 27 degrees of freedom
## Multiple R-squared: 0.858, Adjusted R-squared: 0.831
## F-statistic: 32.5 on 5 and 27 DF, p-value: 1.28e-10
# This transformation produced a different set of values. Under the Log
# model we found that population and the interaction term
# Population:RegionEurope had significant effects on CO2 total emissions,
# Square-root tranformation, though, lowered the significance of
# population and eliminated that of the interaction term. Also, in this
# model the R-Square increased from 0.793 to 0.861 denoting that it
# explains 86% of the variance in the data.
# * * * QUESTION 4 * * *
par(mfrow = c(2, 2))
original <- lm(Emission_total ~ Region + Population + Region + Population:Region)
hist(original$residuals, xlab = "Residuals", main = "Original Model")
hist(logmodel$residuals, xlab = "Residuals", main = "Log-transformed Model")
hist(Sqmodel$residuals, xlab = "Residuals", main = "Square-root-transformed Model")
# I think that the model that best satisfies the assumptions is the
# logarithmic model. The residuals histogram of the logarithmic model
# corresponds clearly to a bell-shaped curve and also the residuals range
# is smaller, going -1.5 to +1.5 which would indicate more constancy.
# * * * QUESTION 5 * * *
glmmodel <- glm(Emission_total ~ Population + Region + Population:Region, family = Gamma)
summary(glmmodel)
##
## Call:
## glm(formula = Emission_total ~ Population + Region + Population:Region,
## family = Gamma)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.253 -0.530 -0.192 0.390 0.998
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.47e-02 1.10e-02 2.24 0.0333 *
## Population -1.11e-09 6.87e-10 -1.61 0.1191
## RegionEurope 3.89e-02 1.49e-02 2.62 0.0143 *
## RegionN. America 3.29e-02 2.52e-02 1.30 0.2037
## Population:RegionEurope -3.66e-09 1.27e-09 -2.88 0.0077 **
## Population:RegionN. America -4.25e-09 2.60e-09 -1.63 0.1139
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for Gamma family taken to be 0.4569)
##
## Null deviance: 37.854 on 32 degrees of freedom
## Residual deviance: 13.434 on 27 degrees of freedom
## AIC: 293.7
##
## Number of Fisher Scoring iterations: 6
hist(glmmodel$residuals, xlab = "Residuals", main = "GLM with Gamma Transformation")
# GA GA GA GA GAMMA
# * * * QUESTION 6 * * *
# All models show that in different degrees, either tranforming the data
# or not, population have a significant impact on CO2 total emissions.
# Furthermore, both original model and log-tranformed models yielded that
# in population in Europe has a greter impact on CO2 total emissions than
# population in other regions.
# * * * QUESTION 7 * * *
tiger <- read.table("/Users/Buzz/Desktop/HENV665Q/Lab8/tiger.txt", header = TRUE)
names(tiger)
## [1] "MUM_ID" "Birth_year" "LRS" "Birth_loc" "longevity"
attach(tiger)
View(tiger)
tigerMR <- lm(LRS ~ Birth_year + Birth_loc + longevity + Birth_year:longevity)
summary(tigerMR)
##
## Call:
## lm(formula = LRS ~ Birth_year + Birth_loc + longevity + Birth_year:longevity)
##
## Residuals:
## Min 1Q Median 3Q Max
## -11.17 -4.31 -1.67 2.60 19.82
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -809.8521 1073.8280 -0.75 0.45
## Birth_year 0.4107 0.5427 0.76 0.45
## Birth_loczoo_2 -0.1527 2.9816 -0.05 0.96
## Birth_loczoo_3 0.6771 3.0690 0.22 0.83
## Birth_loczoo_4 -2.2137 3.0516 -0.73 0.47
## longevity 104.3113 80.3638 1.30 0.20
## Birth_year:longevity -0.0525 0.0406 -1.29 0.20
##
## Residual standard error: 7.41 on 47 degrees of freedom
## Multiple R-squared: 0.181, Adjusted R-squared: 0.0764
## F-statistic: 1.73 on 6 and 47 DF, p-value: 0.135
tigerGLM <- glm(formula = LRS ~ Birth_year + Birth_loc + longevity + Birth_year:longevity,
family = poisson)
summary(tigerGLM)
##
## Call:
## glm(formula = LRS ~ Birth_year + Birth_loc + longevity + Birth_year:longevity,
## family = poisson)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -4.069 -1.479 -0.716 0.846 4.680
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -54.43941 49.31873 -1.10 0.270
## Birth_year 0.02830 0.02493 1.14 0.256
## Birth_loczoo_2 -0.01853 0.12093 -0.15 0.878
## Birth_loczoo_3 0.06924 0.12297 0.56 0.573
## Birth_loczoo_4 -0.20098 0.12649 -1.59 0.112
## longevity 8.30399 3.57549 2.32 0.020 *
## Birth_year:longevity -0.00417 0.00181 -2.31 0.021 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 283.32 on 53 degrees of freedom
## Residual deviance: 229.68 on 47 degrees of freedom
## AIC: 456.2
##
## Number of Fisher Scoring iterations: 5
par(mfrow = c(1, 2))
hist(tigerMR$residuals, xlab = "Residuals", main = "Multiple Regression Model")
hist(tigerGLM$residuals, xlab = "Residuals", main = "GLM with Poisson Error")
# When comparing the histograms it is evident that in the GLM model,
# values are skwed to the left, responding to a poisson distribution.
# Model summary for shows that residual deviance is greater than degrees
# of freedon, indicating that in the model there is overdispersion in
# values.
# * * * QUESTION 8 * * *
tigerQP <- glm(formula = LRS ~ Birth_year + Birth_loc + longevity + Birth_year:longevity,
family = quasipoisson)
summary(tigerQP)
##
## Call:
## glm(formula = LRS ~ Birth_year + Birth_loc + longevity + Birth_year:longevity,
## family = quasipoisson)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -4.069 -1.479 -0.716 0.846 4.680
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -54.43941 114.24897 -0.48 0.64
## Birth_year 0.02830 0.05775 0.49 0.63
## Birth_loczoo_2 -0.01853 0.28013 -0.07 0.95
## Birth_loczoo_3 0.06924 0.28486 0.24 0.81
## Birth_loczoo_4 -0.20098 0.29302 -0.69 0.50
## longevity 8.30399 8.28279 1.00 0.32
## Birth_year:longevity -0.00417 0.00419 -1.00 0.32
##
## (Dispersion parameter for quasipoisson family taken to be 5.366)
##
## Null deviance: 283.32 on 53 degrees of freedom
## Residual deviance: 229.68 on 47 degrees of freedom
## AIC: NA
##
## Number of Fisher Scoring iterations: 5
# Removing interaction term
upd_minusINT <- update(tigerQP, . ~ . - Birth_year:longevity)
summary(upd_minusINT)
##
## Call:
## glm(formula = LRS ~ Birth_year + Birth_loc + longevity, family = quasipoisson)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.920 -1.579 -0.413 0.642 4.786
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 56.3914 28.4045 1.99 0.053 .
## Birth_year -0.0277 0.0144 -1.93 0.060 .
## Birth_loczoo_2 0.0391 0.2783 0.14 0.889
## Birth_loczoo_3 0.0890 0.2874 0.31 0.758
## Birth_loczoo_4 -0.1786 0.2971 -0.60 0.551
## longevity 0.0532 0.0270 1.97 0.054 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for quasipoisson family taken to be 5.486)
##
## Null deviance: 283.32 on 53 degrees of freedom
## Residual deviance: 235.00 on 48 degrees of freedom
## AIC: NA
##
## Number of Fisher Scoring iterations: 5
anova(tigerQP, upd_minusINT, test = "F")
## Analysis of Deviance Table
##
## Model 1: LRS ~ Birth_year + Birth_loc + longevity + Birth_year:longevity
## Model 2: LRS ~ Birth_year + Birth_loc + longevity
## Resid. Df Resid. Dev Df Deviance F Pr(>F)
## 1 47 230
## 2 48 235 -1 -5.33 0.99 0.32
# Removing variable Birth_loc
upd_minusBL <- update(upd_minusINT, . ~ . - Birth_loc)
summary(upd_minusBL)
##
## Call:
## glm(formula = LRS ~ Birth_year + longevity, family = quasipoisson)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -4.340 -1.521 -0.464 0.774 4.917
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 55.0850 26.6036 2.07 0.043 *
## Birth_year -0.0270 0.0135 -2.01 0.050 *
## longevity 0.0494 0.0256 1.93 0.060 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for quasipoisson family taken to be 5.121)
##
## Null deviance: 283.32 on 53 degrees of freedom
## Residual deviance: 240.36 on 51 degrees of freedom
## AIC: NA
##
## Number of Fisher Scoring iterations: 5
anova(upd_minusINT, upd_minusBL, test = "F")
## Analysis of Deviance Table
##
## Model 1: LRS ~ Birth_year + Birth_loc + longevity
## Model 2: LRS ~ Birth_year + longevity
## Resid. Df Resid. Dev Df Deviance F Pr(>F)
## 1 48 235
## 2 51 240 -3 -5.35 0.33 0.81
# Removing variable Longevity
upd_minusLong <- update(upd_minusBL, . ~ . - longevity)
summary(upd_minusLong)
##
## Call:
## glm(formula = LRS ~ Birth_year, family = quasipoisson)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -3.982 -1.951 -0.926 1.223 5.381
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 56.3054 25.9617 2.17 0.035 *
## Birth_year -0.0273 0.0131 -2.08 0.043 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for quasipoisson family taken to be 5.293)
##
## Null deviance: 283.32 on 53 degrees of freedom
## Residual deviance: 260.19 on 52 degrees of freedom
## AIC: NA
##
## Number of Fisher Scoring iterations: 5
anova(upd_minusBL, upd_minusLong, test = "F")
## Analysis of Deviance Table
##
## Model 1: LRS ~ Birth_year + longevity
## Model 2: LRS ~ Birth_year
## Resid. Df Resid. Dev Df Deviance F Pr(>F)
## 1 51 240
## 2 52 260 -1 -19.8 3.87 0.054 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# According to GLM, quasipoisson family, the best model is upd_minusBL
# (LRS ~ Birth_year) since it provides the lowest p-value, although
# marginally below the 0.05 confidence level.
# * * * QUESTION 9 * * *
# The result of our analysis show that depending on the analysis method
# chosen, factors influencing LRS vary greatly. In the linear model the
# analysis showed no significant effects of year of birth, location, or
# longevity over life reproductive success. However, in the linear model
# analysis, we did not take into account that the data was not normally
# distributed; therefore, other analysis methods needed to be implemented
# in order to ratify or rectify our assumptions. Our first attempt was to
# evaluate the model using a generalized linear model with the family
# Poisson. Still, this test yielded marginal lower p-values, indicating no
# significant effects of explanatory variables variables over response
# variable. But Poisson demonstrated that the were some overdispersion in
# the data; in consequence, it was necessary to deal with tha
# overdispersion using the Quasipoisson family in GLM. After comparing the
# results of different models and comparing the effects of interacion term
# and explanatory variables, we arrived to the conclusion that tigers' LRS
# is only influenced by year of birth.
# * * * QUESTION 10 * * *
plot(LRS ~ Birth_year, pch = 18, xlab = "Birth of year", ylab = " Life Reproductive Success",
main = "Sumatra Female Tigers LRS")
d <- seq(1960, 2000)
pred <- predict(upd_minusLong, list(Birth_year = d), type = "response")
lines(d, pred)
# * # * # * # * # * # * # * # * # * # * # * # * # * # * # * # * #
# Part 2
sheep <- read.table("/Users/Buzz/Desktop/HENV665Q/Lab8/sheep.txt", header = T)
attach(sheep)
names(sheep)
## [1] "ID" "Age" "sex" "yr" "date" "yrbirth" "wt"
## [8] "rtHl" "rtHb" "lHl" "lHb"
View(sheep)
# * * * QUESTION 1 * * *
# The independent experimental unit are samples taken on sheeps at a
# different times over their lifetime, including different samples on a
# same sheep.
# * * * QUESTION 2 * * *
# The problem we had with the treatemend with made on this dataset was
# that we treated values as if they were independent of each other. As we
# were not dealing with a set of different individuals, with the linear
# model we did not take into consideration that some female sheeps might
# have been pregnant at the moment of the subsquent samplings, influencing
# our results considerably. The linear regression model assumed
# significant effects of explanatory variables over response variables
# that might have been less meaningfull. This makes the linear regression
# model more powerful than it is. This is called pseude-replication.
# * * * QUESTION 3 * * *
# There are two problems with averaging. First, averaging reduces the
# number of observations and, therefore, the degrees of freedom of our
# model. Second, when averaging, much of the variation among values is
# removed, which may conduct to incorrect assumptions on the results.
# * * * QUESTION 4 * * *
osheep <- lm(wt ~ sex + date + sex:date)
summary(osheep)
##
## Call:
## lm(formula = wt ~ sex + date + sex:date)
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.764 -2.964 0.042 2.523 11.886
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 20.60638 2.03875 10.11 < 2e-16 ***
## sex 4.70396 1.36915 3.44 0.00073 ***
## date 0.13690 0.03024 4.53 1.1e-05 ***
## sex:date 0.00639 0.02065 0.31 0.75745
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.51 on 179 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.585, Adjusted R-squared: 0.578
## F-statistic: 83.9 on 3 and 179 DF, p-value: <2e-16
library(nlme)
mxsheep1 <- lme(wt ~ sex + date + sex:date, random = ~date | ID, na.action = na.exclude,
method = "ML")
summary(mxsheep1)
## Linear mixed-effects model fit by maximum likelihood
## Data: NULL
## AIC BIC logLik
## 927.3 953 -455.7
##
## Random effects:
## Formula: ~date | ID
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 4.15476 (Intr)
## date 0.03939 -0.247
## Residual 1.25847
##
## Fixed effects: wt ~ sex + date + sex:date
## Value Std.Error DF t-value p-value
## (Intercept) 20.438 1.6710 111 12.231 0.0000
## sex 4.488 1.1337 68 3.958 0.0002
## date 0.132 0.0183 111 7.242 0.0000
## sex:date 0.013 0.0124 111 1.023 0.3084
## Correlation:
## (Intr) sex date
## sex -0.944
## date -0.404 0.380
## sex:date 0.379 -0.400 -0.944
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -1.96912 -0.45710 -0.06186 0.40647 1.96440
##
## Number of Observations: 183
## Number of Groups: 70
mxsheep2 <- lme(wt ~ sex + date + sex:date, random = ~sex | ID, na.action = na.exclude,
method = "ML")
summary(mxsheep2)
## Linear mixed-effects model fit by maximum likelihood
## Data: NULL
## AIC BIC logLik
## 951 976.6 -467.5
##
## Random effects:
## Formula: ~sex | ID
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 4.509 (Intr)
## sex 1.436 -0.471
## Residual 1.954
##
## Fixed effects: wt ~ sex + date + sex:date
## Value Std.Error DF t-value p-value
## (Intercept) 19.706 1.7561 111 11.222 0.0000
## sex 4.888 1.1891 68 4.111 0.0001
## date 0.142 0.0143 111 9.928 0.0000
## sex:date 0.008 0.0096 111 0.860 0.3914
## Correlation:
## (Intr) sex date
## sex -0.944
## date -0.473 0.440
## sex:date 0.441 -0.461 -0.944
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -2.98993 -0.55052 0.06132 0.48476 2.28583
##
## Number of Observations: 183
## Number of Groups: 70
mxsheep3 <- lme(wt ~ sex + date, random = ~date | ID, na.action = na.exclude,
method = "ML")
summary(mxsheep3)
## Linear mixed-effects model fit by maximum likelihood
## Data: NULL
## AIC BIC logLik
## 926.4 948.9 -456.2
##
## Random effects:
## Formula: ~date | ID
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 4.16536 (Intr)
## date 0.03972 -0.257
## Residual 1.26222
##
## Fixed effects: wt ~ sex + date
## Value Std.Error DF t-value p-value
## (Intercept) 19.784 1.5418 112 12.832 0
## sex 4.956 1.0357 68 4.785 0
## date 0.150 0.0061 112 24.689 0
## Correlation:
## (Intr) sex
## sex -0.933
## date -0.153 0.007
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -1.9923 -0.4458 -0.0717 0.4054 1.9445
##
## Number of Observations: 183
## Number of Groups: 70
mxsheep4 <- lme(wt ~ sex + date, random = ~sex | ID, na.action = na.exclude,
method = "ML")
summary(mxsheep4)
## Linear mixed-effects model fit by maximum likelihood
## Data: NULL
## AIC BIC logLik
## 949.7 972.2 -467.9
##
## Random effects:
## Formula: ~sex | ID
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 4.530 (Intr)
## sex 1.442 -0.482
## Residual 1.961
##
## Fixed effects: wt ~ sex + date
## Value Std.Error DF t-value p-value
## (Intercept) 19.041 1.5713 112 12.12 0
## sex 5.359 1.0508 68 5.10 0
## date 0.153 0.0047 112 32.45 0
## Correlation:
## (Intr) sex
## sex -0.930
## date -0.192 0.019
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.0343 -0.5510 0.0282 0.4768 2.2248
##
## Number of Observations: 183
## Number of Groups: 70
mxsheep5 <- lme(wt ~ sex + date + sex:date, random = ~yr | ID, na.action = na.exclude,
method = "ML")
summary(mxsheep5)
## Linear mixed-effects model fit by maximum likelihood
## Data: NULL
## AIC BIC logLik
## 951 976.6 -467.5
##
## Random effects:
## Formula: ~yr | ID
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 4.039e+00 (Intr)
## yr 5.817e-05 0
## Residual 1.954e+00
##
## Fixed effects: wt ~ sex + date + sex:date
## Value Std.Error DF t-value p-value
## (Intercept) 19.706 1.7564 111 11.220 0.0000
## sex 4.888 1.1886 68 4.113 0.0001
## date 0.142 0.0143 111 9.928 0.0000
## sex:date 0.008 0.0096 111 0.860 0.3916
## Correlation:
## (Intr) sex date
## sex -0.944
## date -0.473 0.441
## sex:date 0.441 -0.461 -0.944
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -2.99007 -0.55052 0.06067 0.48468 2.28506
##
## Number of Observations: 183
## Number of Groups: 70
anova(mxsheep1, mxsheep2, mxsheep3, mxsheep4, mxsheep5)
## Model df AIC BIC logLik Test L.Ratio p-value
## mxsheep1 1 8 927.3 953.0 -455.7
## mxsheep2 2 8 951.0 976.6 -467.5
## mxsheep3 3 7 926.4 948.9 -456.2 2 vs 3 22.570 <.0001
## mxsheep4 4 7 949.7 972.2 -467.9
## mxsheep5 5 8 951.0 976.6 -467.5 4 vs 5 0.753 0.3855