Description Usage Format Source See Also Examples
The human brain is protected from bacteria and toxins, which course through the blood–stream, by a single layer of cells called the blood–brain barrier. These data come from an experiment (on rats, which process a similar barrier) to study a method of disrupting the barrier by infusing a solution of concentrated sugars.
1 |
A data frame with 34 observations on the following 9 variables.
Brain tumor count (per gm)
Liver count (per gm)
Sacrifice time (in hours)
Treatment received
Days post inoculation
Sex of the rat
Initial weight (in grams)
Weight loss (in grams)
Tumor weight (in 10^(-4) grams)
Ramsey, F.L. and Schafer, D.W. (2013). The Statistical Sleuth: A Course in Methods of Data Analysis (3rd ed), Cengage Learning.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | str(case1102)
attach(case1102)
## EXPLORATION
logRatio <- log(Brain/Liver)
logTime <- log(Time)
myMatrix <- cbind (logRatio, Days, Weight, Loss, Tumor, logTime)
if(require(car)){ # Use the car library
scatterplotMatrix(myMatrix,groups=Treatment,
smooth=FALSE, diagonal="histogram", col=c("green","blue"), pch=c(16,17), cex=1.5)
}
myLm1 <- lm(logRatio ~ Treatment + logTime + Days + Sex + Weight + Loss + Tumor)
plot(myLm1, which=1)
if(require(car)){ # Use the car library
crPlots(myLm1) # Draw partial resdual plots.
}
myLm2 <- lm(logRatio ~ Treatment + factor(Time) +
Days + Sex + Weight + Loss + Tumor) # Include Time as a factor.
anova(myLm1,myLm2)
if(require(car)){ # Use the car library
crPlots(myLm2) # Draw partial resdual plots.
}
summary(myLm2) # Use backard elimination
myLm3 <- update(myLm2, ~ . - Days)
summary(myLm3)
myLm4 <- update(myLm3, ~ . - Sex)
summary(myLm4)
myLm5 <- update(myLm4, ~ . - Weight)
summary(myLm5)
myLm6 <- update(myLm5, ~ . - Tumor)
summary(myLm6)
myLm7 <- update(myLm6, ~ . - Loss)
summary(myLm7) # Final model for inference
## INFERENCE AND INTERPRETATION
myTreatment <- factor(Treatment,levels=c("NS","BD")) # Change level ordering
myLm7a <- lm(logRatio ~ factor(Time) + myTreatment)
summary(myLm7a)
beta <- myLm7a$coef
exp(beta[5])
exp(confint(myLm7a,5))
# Interpetation: The median ratio of brain to liver tumor counts for barrier-
# disrupted rats is estimated to be 2.2 times the median ratio for control rats
# (95% CI: 1.5 times to 3.2 times as large).
## DISPLAY FOR PRESENTATION
ratio <- Brain/Liver
jTime <- exp(jitter(logTime,.2)) # Back-transform a jittered version of logTime
plot(ratio ~ jTime, log="xy",
xlab="Sacrifice Time (Hours), jittered; Log Scale",
ylab="Effectiveness: Brain Tumor Count Relative To Liver Tumor Count; Log Scale",
main="Blood Brain Barrier Disruption Effectiveness in 34 Rats",
pch= ifelse(Treatment=="BD",21,24), bg=ifelse(Treatment=="BD","green","orange"),
lwd=2, cex=2)
dummyTime <- c(0.5, 3, 24, 72)
controlTerm <- beta[1] + beta[2]*(dummyTime==3) +
beta[3]*(dummyTime==24) + beta[4]*(dummyTime==72)
controlCurve <- exp(controlTerm)
lines(controlCurve ~ dummyTime, lty=1,lwd=2)
BDTerm <- controlTerm + beta[5]
BDCurve <- exp(BDTerm)
lines(BDCurve ~ dummyTime,lty=2,lwd=2)
legend(0.5,10,c("Barrier disruption","Saline control"),pch=c(21,22),
pt.bg=c("green","orange"),pt.lwd=c(2,2),pt.cex=c(2,2), lty=c(2,1),lwd=c(2,2))
detach(case1102)
|
'data.frame': 34 obs. of 9 variables:
$ Brain : int 41081 44286 102926 25927 42643 31342 22815 16629 22315 77961 ...
$ Liver : int 1456164 1602171 1601936 1776411 1351184 1790863 1633386 1618757 1567602 1060057 ...
$ Time : num 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 3 ...
$ Treatment: Factor w/ 2 levels "BD","NS": 1 1 1 1 1 2 2 2 2 1 ...
$ Days : int 10 10 10 10 10 10 10 10 10 10 ...
$ Sex : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 1 1 1 ...
$ Weight : int 239 225 224 184 250 196 200 273 216 267 ...
$ Loss : num 5.9 4 -4.9 9.8 6 7.7 0.5 4 2.8 2.6 ...
$ Tumor : int 221 246 61 168 164 260 27 308 93 73 ...
Loading required package: car
Loading required package: carData
Warning message:
In applyDefaults(diagonal, defaults = list(method = "adaptiveDensity"), :
unnamed diag arguments, will be ignored
Analysis of Variance Table
Model 1: logRatio ~ Treatment + logTime + Days + Sex + Weight + Loss +
Tumor
Model 2: logRatio ~ Treatment + factor(Time) + Days + Sex + Weight + Loss +
Tumor
Res.Df RSS Df Sum of Sq F Pr(>F)
1 26 9.5127
2 24 7.1831 2 2.3295 3.8916 0.03437 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Call:
lm(formula = logRatio ~ Treatment + factor(Time) + Days + Sex +
Weight + Loss + Tumor)
Residuals:
Min 1Q Median 3Q Max
-1.58034 -0.20482 -0.04134 0.17296 0.96182
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -4.063527 3.144780 -1.292 0.208609
TreatmentNS -0.830930 0.197544 -4.206 0.000312 ***
factor(Time)3 1.089380 0.294004 3.705 0.001106 **
factor(Time)24 4.113695 0.337234 12.198 8.90e-12 ***
factor(Time)72 5.136627 0.340967 15.065 9.88e-14 ***
Days 0.019350 0.282007 0.069 0.945864
SexMale -0.035751 0.357884 -0.100 0.921257
Weight 0.001502 0.004740 0.317 0.754079
Loss -0.048216 0.027653 -1.744 0.094032 .
Tumor 0.001379 0.001160 1.189 0.246065
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5471 on 24 degrees of freedom
Multiple R-squared: 0.9569, Adjusted R-squared: 0.9408
F-statistic: 59.26 on 9 and 24 DF, p-value: 3.287e-14
Call:
lm(formula = logRatio ~ Treatment + factor(Time) + Sex + Weight +
Loss + Tumor)
Residuals:
Min 1Q Median 3Q Max
-1.5888 -0.2022 -0.0435 0.1765 0.9628
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3.860768 1.054273 -3.662 0.001174 **
TreatmentNS -0.831894 0.193082 -4.308 0.000224 ***
factor(Time)3 1.083469 0.275448 3.933 0.000588 ***
factor(Time)24 4.123335 0.300412 13.726 3.83e-13 ***
factor(Time)72 5.147192 0.298106 17.266 2.10e-15 ***
SexMale -0.044372 0.328369 -0.135 0.893593
Weight 0.001464 0.004612 0.317 0.753601
Loss -0.048542 0.026694 -1.818 0.081001 .
Tumor 0.001384 0.001134 1.221 0.233420
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5361 on 25 degrees of freedom
Multiple R-squared: 0.9569, Adjusted R-squared: 0.9431
F-statistic: 69.43 on 8 and 25 DF, p-value: 3.786e-15
Call:
lm(formula = logRatio ~ Treatment + factor(Time) + Weight + Loss +
Tumor)
Residuals:
Min 1Q Median 3Q Max
-1.57401 -0.19807 -0.04482 0.16600 0.95240
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3.782356 0.863426 -4.381 0.000172 ***
TreatmentNS -0.831705 0.189397 -4.391 0.000168 ***
factor(Time)3 1.090050 0.265941 4.099 0.000361 ***
factor(Time)24 4.113242 0.285432 14.411 6.56e-14 ***
factor(Time)72 5.135271 0.279327 18.384 < 2e-16 ***
Weight 0.001125 0.003798 0.296 0.769397
Loss -0.047682 0.025432 -1.875 0.072077 .
Tumor 0.001348 0.001079 1.249 0.222958
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5259 on 26 degrees of freedom
Multiple R-squared: 0.9569, Adjusted R-squared: 0.9453
F-statistic: 82.46 on 7 and 26 DF, p-value: 4.014e-16
Call:
lm(formula = logRatio ~ Treatment + factor(Time) + Loss + Tumor)
Residuals:
Min 1Q Median 3Q Max
-1.58559 -0.19289 -0.03901 0.19174 0.96590
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3.536771 0.237291 -14.905 1.50e-14 ***
TreatmentNS -0.837443 0.185194 -4.522 0.000110 ***
factor(Time)3 1.114831 0.248141 4.493 0.000119 ***
factor(Time)24 4.146020 0.258631 16.031 2.55e-15 ***
factor(Time)72 5.166075 0.254835 20.272 < 2e-16 ***
Loss -0.046465 0.024670 -1.883 0.070448 .
Tumor 0.001365 0.001059 1.289 0.208474
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5169 on 27 degrees of freedom
Multiple R-squared: 0.9568, Adjusted R-squared: 0.9471
F-statistic: 99.55 on 6 and 27 DF, p-value: < 2.2e-16
Call:
lm(formula = logRatio ~ Treatment + factor(Time) + Loss)
Residuals:
Min 1Q Median 3Q Max
-1.71130 -0.19563 -0.02871 0.24420 1.22384
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3.38562 0.20869 -16.223 9.05e-16 ***
TreatmentNS -0.77410 0.18064 -4.285 0.000195 ***
factor(Time)3 1.08321 0.24982 4.336 0.000170 ***
factor(Time)24 4.21525 0.25596 16.469 6.18e-16 ***
factor(Time)72 5.20088 0.25637 20.287 < 2e-16 ***
Loss -0.03252 0.02243 -1.450 0.158206
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.523 on 28 degrees of freedom
Multiple R-squared: 0.9541, Adjusted R-squared: 0.9459
F-statistic: 116.4 on 5 and 28 DF, p-value: < 2.2e-16
Call:
lm(formula = logRatio ~ Treatment + factor(Time))
Residuals:
Min 1Q Median 3Q Max
-1.74019 -0.17548 -0.01782 0.24772 1.05512
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3.5049 0.1954 -17.937 < 2e-16 ***
TreatmentNS -0.7968 0.1834 -4.346 0.000155 ***
factor(Time)3 1.1341 0.2520 4.501 0.000101 ***
factor(Time)24 4.2573 0.2591 16.431 3.13e-16 ***
factor(Time)72 5.1539 0.2591 19.892 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5328 on 29 degrees of freedom
Multiple R-squared: 0.9506, Adjusted R-squared: 0.9438
F-statistic: 139.6 on 4 and 29 DF, p-value: < 2.2e-16
Call:
lm(formula = logRatio ~ factor(Time) + myTreatment)
Residuals:
Min 1Q Median 3Q Max
-1.74019 -0.17548 -0.01782 0.24772 1.05512
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -4.3017 0.2047 -21.010 < 2e-16 ***
factor(Time)3 1.1341 0.2520 4.501 0.000101 ***
factor(Time)24 4.2573 0.2591 16.431 3.13e-16 ***
factor(Time)72 5.1539 0.2591 19.892 < 2e-16 ***
myTreatmentBD 0.7968 0.1834 4.346 0.000155 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5328 on 29 degrees of freedom
Multiple R-squared: 0.9506, Adjusted R-squared: 0.9438
F-statistic: 139.6 on 4 and 29 DF, p-value: < 2.2e-16
myTreatmentBD
2.218421
2.5 % 97.5 %
myTreatmentBD 1.524703 3.227771
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.