Last data update: 2014.03.03

R: Mouse Litters
littersR Documentation

Mouse Litters

Description

Data on the body and brain weights of 20 mice, together with the size of the litter. Two mice were taken from each litter size.

Usage

litters

Format

This data frame contains the following columns:

lsize

litter size

bodywt

body weight

brainwt

brain weight

Source

Wainright P, Pelkman C and Wahlsten D 1989. The quantitative relationship between nutritional effects on preweaning growth and behavioral development in mice. Developmental Psychobiology 22: 183-193.

Examples

print("Multiple Regression - Example 6.2")

pairs(litters, labels=c("lsize\n\n(litter size)", "bodywt\n\n(Body Weight)",
                        "brainwt\n\n(Brain Weight)"))
  # pairs(litters) gives a scatterplot matrix with less adequate labeling

mice1.lm <- lm(brainwt ~ lsize, data = litters) # Regress on lsize
mice2.lm <- lm(brainwt ~ bodywt, data = litters) #Regress on bodywt
mice12.lm <- lm(brainwt ~ lsize + bodywt, data = litters) # Regress on lsize & bodywt

summary(mice1.lm)$coef # Similarly for other coefficients.
# results are consistent with the biological concept of brain sparing

pause()

hat(model.matrix(mice12.lm))  # hat diagonal
pause()

plot(lm.influence(mice12.lm)$hat, residuals(mice12.lm))

print("Diagnostics - Example 6.3")

mice12.lm <- lm(brainwt ~ bodywt+lsize, data=litters)
oldpar <-par(mfrow = c(1,2))
bx <- mice12.lm$coef[2]; bz <- mice12.lm$coef[3]
res <- residuals(mice12.lm)
plot(litters$bodywt, bx*litters$bodywt+res, xlab="Body weight",
  ylab="Component + Residual")
panel.smooth(litters$bodywt, bx*litters$bodywt+res) # Overlay
plot(litters$lsize, bz*litters$lsize+res, xlab="Litter size", 
  ylab="Component + Residual")
panel.smooth(litters$lsize, bz*litters$lsize+res)
par(oldpar)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(DAAG)
Loading required package: lattice
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DAAG/litters.Rd_%03d_medium.png", width=480, height=480)
> ### Name: litters
> ### Title: Mouse Litters
> ### Aliases: litters
> ### Keywords: datasets
> 
> ### ** Examples
> 
> print("Multiple Regression - Example 6.2")
[1] "Multiple Regression - Example 6.2"
> 
> pairs(litters, labels=c("lsize\n\n(litter size)", "bodywt\n\n(Body Weight)",
+                         "brainwt\n\n(Brain Weight)"))
>   # pairs(litters) gives a scatterplot matrix with less adequate labeling
> 
> mice1.lm <- lm(brainwt ~ lsize, data = litters) # Regress on lsize
> mice2.lm <- lm(brainwt ~ bodywt, data = litters) #Regress on bodywt
> mice12.lm <- lm(brainwt ~ lsize + bodywt, data = litters) # Regress on lsize & bodywt
> 
> summary(mice1.lm)$coef # Similarly for other coefficients.
                Estimate  Std. Error   t value     Pr(>|t|)
(Intercept)  0.447000000 0.009624762 46.442707 3.391193e-20
lsize       -0.004033333 0.001198423 -3.365534 3.444524e-03
> # results are consistent with the biological concept of brain sparing
> 
> pause()
> 
> hat(model.matrix(mice12.lm))  # hat diagonal
 [1] 0.19909923 0.17342736 0.13029307 0.15735137 0.08787909 0.27318075
 [7] 0.06765524 0.06934443 0.15549909 0.09469559 0.12792400 0.07573376
[13] 0.13967323 0.07334975 0.12506629 0.08791076 0.43260877 0.12585659
[19] 0.20416791 0.19928375
> pause()
> 
> plot(lm.influence(mice12.lm)$hat, residuals(mice12.lm))
> 
> print("Diagnostics - Example 6.3")
[1] "Diagnostics - Example 6.3"
> 
> mice12.lm <- lm(brainwt ~ bodywt+lsize, data=litters)
> oldpar <-par(mfrow = c(1,2))
> bx <- mice12.lm$coef[2]; bz <- mice12.lm$coef[3]
> res <- residuals(mice12.lm)
> plot(litters$bodywt, bx*litters$bodywt+res, xlab="Body weight",
+   ylab="Component + Residual")
> panel.smooth(litters$bodywt, bx*litters$bodywt+res) # Overlay
> plot(litters$lsize, bz*litters$lsize+res, xlab="Litter size", 
+   ylab="Component + Residual")
> panel.smooth(litters$lsize, bz*litters$lsize+res)
> par(oldpar)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>