Description Usage Format Source Examples
Engineers manipulated three factors (with 3, 2, and 4 levels each) in the construction and operation of printer rods, to see if they influenced the magnetic force around the rod.
1 |
A data frame with 44 observations on the following 14 variables.
the magnetic force at each of the equally-spaces positions 1, 2, ..., 11 on the printer rod
electric current passing through the rod, with
three levels "0"
, "250"
and "500"
(milliamperes)
a factor identifying the configuration, with
two levels "0"
and "1"
a factor identifying the type of metal from
which the rod was made, with four levels
"1"
, "2"
, "3"
and "4"
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 71 72 73 74 75 76 77 78 | str(case1701)
attach(case1701)
## EXPLORATION
MagneticForces <- cbind(L1,L2,L3,L4,L5,L6,L7,L8,L9,L10,L11)
mfCor <- cor(MagneticForces)
round(mfCor,2) # Show correlations, rounded to two digits
mfPca <- prcomp(MagneticForces) # principal components
summary(mfPca) # Show the proportion of variance explained by each PC
plot(mfPca) # Graph proportion of variances explained by each PC (Scree Plot)
mfCoefs <- mfPca$rotation # Extract the coefficients
dim(mfCoefs) # #11 rows and 11 columns
round(mfCoefs[,1:3],3) # Show the first 3 columns of the score matrix, rounded
# Explore a possible meaningful linear combination suggested by first PC
round(mfCoefs[,1],1) # Show coefficients of 1st pc, rounded to 1 digit
# Coefficients are all very similar, suggesting a constant coefficient; use 1/11
mfAve <- (L1 + L2 + L3 + L4 + L5 + L6 + L7 + L8 + L9 + L10 + L11)/11
mfScores <- mfPca$x
pc1 <- mfScores[,1] #Values for first principal component of MagneticForces
cor(mfAve,pc1) # correlation of the average and the first PC (=0.999567)
plot(pc1 ~ mfAve)
# Explore a possible meningful linear combination suggested by second PC
round(mfCoefs[,2],1) # Show coefficients of 2nd pc, rounded to 1 digit
# Second set of coefficients are negative on the left end of the rod and
# positive on the right end. Try Ave(L9 + L10 + L11) - Ave(L1 + L2 + L3).
mfEnds <- (L9 + L10 + L11)/3 - (L1 + L2 + L3)/3
pc2 <- mfScores[,2]
residualEnds <- lm(mfEnds ~ mfAve)$residual # Ends with average effect removed
plot(pc2 ~ residualEnds)
cor(residualEnds, pc2) # 0.973
# Explore a possible meaningful linear combination suggested by third PC
round(mfCoefs[,3],1) # Show doefficients of 3rd pc, rounded to 1 digit
# Try a contrast between the first 4 positions and the 6th position
mfPeak <- (L1 + L2 + L3 + L4)/4 - L6
pc3 <- mfScores[,3]
residualPeak <- lm(mfPeak ~ mfAve + mfEnds)$residual
plot(pc3 ~ residualPeak)
cor(residualPeak,pc3) # 0.971
# Note: the variation explained by the third PC seems to be due almost entirely
# to one printer rod. (Keep this in mind.)
## INFERENCE: ANALYSIS OF EXPERIMENTAL FACTORS ON 3-DIMENSIONAL RESPONSE
myResponse <- cbind(mfAve, mfEnds, mfPeak)
cor(myResponse)
myLm1 <- lm(myResponse ~ Current + Config + Material)
anova(myLm1) # Noticeable effect of Current but not Config or Material
plot(mfAve ~ Current)
myLm2 <- lm(mfAve ~ Current)
abline(myLm2)
summary(myLm2) # No evidence of an effect of current on average magnetic force
plot(mfEnds ~ Current)
myLm3 <- lm(mfEnds ~ Current)
abline(myLm3)
summary(myLm3) # Evidence that Current effects the difference in MF at the ends
plot(mfPeak ~ Current)
myLm4 <- lm(mfPeak ~ Current)
abline(myLm4)
summary(myLm4) # No evidence of an effect of Current on peak MF in the center
## GRAPHICAL DISPLAY FOR PRESENTATION
plot(mfEnds ~ jitter(Current,.1),
xlab="Electrical Current Used in Printer Rod Manufacture (milliamperes)" ,
ylab="Magnetic Force at Positions 9-11 Minus Magnetic Force at Positions 1-3",
main="Effect of Electrical Current on Magnetic Force Surrounding Printer Rod",
col="black", pch=21, lwd=2, bg="green", cex=2 )
abline(myLm3,
lwd=2)
detach(case1701)
|
'data.frame': 44 obs. of 14 variables:
$ L1 : int 136 639 673 471 578 120 542 597 615 487 ...
$ L2 : int 142 723 709 501 617 124 578 632 641 486 ...
$ L3 : int 139 782 709 521 650 110 583 631 634 485 ...
$ L4 : int 131 756 719 519 625 110 598 655 649 489 ...
$ L5 : int 122 804 682 528 632 101 587 659 648 488 ...
$ L6 : int 118 804 681 521 634 104 618 699 699 487 ...
$ L7 : int 134 909 759 540 677 126 654 792 809 491 ...
$ L8 : int 138 962 912 523 695 140 696 890 892 490 ...
$ L9 : int 148 1042 1122 548 733 158 737 972 975 500 ...
$ L10 : int 149 1058 1121 525 735 164 726 960 974 483 ...
$ L11 : int 171 1022 900 513 747 182 752 953 968 471 ...
$ Current : int 0 250 500 0 250 500 0 250 500 0 ...
$ Config : int 0 0 0 1 1 1 0 0 0 1 ...
$ Material: int 1 1 1 2 2 2 3 3 3 4 ...
L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 L11
L1 1.00 1.00 0.99 0.99 0.99 0.95 0.97 0.95 0.92 0.92 0.92
L2 1.00 1.00 1.00 1.00 0.99 0.95 0.98 0.96 0.94 0.93 0.93
L3 0.99 1.00 1.00 1.00 0.99 0.95 0.98 0.96 0.94 0.93 0.93
L4 0.99 1.00 1.00 1.00 1.00 0.95 0.98 0.96 0.94 0.94 0.94
L5 0.99 0.99 0.99 1.00 1.00 0.97 0.99 0.96 0.94 0.93 0.94
L6 0.95 0.95 0.95 0.95 0.97 1.00 0.97 0.93 0.90 0.90 0.91
L7 0.97 0.98 0.98 0.98 0.99 0.97 1.00 0.99 0.97 0.97 0.98
L8 0.95 0.96 0.96 0.96 0.96 0.93 0.99 1.00 1.00 0.99 0.99
L9 0.92 0.94 0.94 0.94 0.94 0.90 0.97 1.00 1.00 1.00 0.99
L10 0.92 0.93 0.93 0.94 0.93 0.90 0.97 0.99 1.00 1.00 0.99
L11 0.92 0.93 0.93 0.94 0.94 0.91 0.98 0.99 0.99 0.99 1.00
Importance of components%s:
PC1 PC2 PC3 PC4 PC5 PC6
Standard deviation 804.3310 131.32740 68.43947 30.12473 21.21056 15.55544
Proportion of Variance 0.9646 0.02572 0.00698 0.00135 0.00067 0.00036
Cumulative Proportion 0.9646 0.99032 0.99730 0.99866 0.99933 0.99969
PC7 PC8 PC9 PC10 PC11
Standard deviation 9.64689 7.88855 5.20657 3.94252 3.48679
Proportion of Variance 0.00014 0.00009 0.00004 0.00002 0.00002
Cumulative Proportion 0.99983 0.99992 0.99996 0.99998 1.00000
[1] 11 11
PC1 PC2 PC3
L1 0.223 -0.304 0.259
L2 0.233 -0.265 0.270
L3 0.239 -0.260 0.291
L4 0.249 -0.264 0.293
L5 0.263 -0.307 0.067
L6 0.290 -0.388 -0.791
L7 0.309 -0.083 -0.201
L8 0.336 0.179 0.078
L9 0.377 0.370 0.055
L10 0.379 0.404 0.000
L11 0.360 0.342 -0.100
L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 L11
0.2 0.2 0.2 0.2 0.3 0.3 0.3 0.3 0.4 0.4 0.4
[1] 0.999567
L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 L11
-0.3 -0.3 -0.3 -0.3 -0.3 -0.4 -0.1 0.2 0.4 0.4 0.3
[1] 0.9730712
L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 L11
0.3 0.3 0.3 0.3 0.1 -0.8 -0.2 0.1 0.1 0.0 -0.1
[1] 0.9717567
mfAve mfEnds mfPeak
mfAve 1.0000000 0.7726682 -0.5037948
mfEnds 0.7726682 1.0000000 -0.4116658
mfPeak -0.5037948 -0.4116658 1.0000000
Analysis of Variance Table
Df Pillai approx F num Df den Df Pr(>F)
(Intercept) 1 0.88189 94.576 3 38 < 2e-16 ***
Current 1 0.23052 3.795 3 38 0.01786 *
Config 1 0.04622 0.614 3 38 0.61022
Material 1 0.02652 0.345 3 38 0.79284
Residuals 40
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Call:
lm(formula = mfAve ~ Current)
Residuals:
Min 1Q Median 3Q Max
-474.62 -59.77 73.03 176.88 327.25
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 533.4768 55.2215 9.661 3.11e-12 ***
Current 0.1345 0.1751 0.768 0.447
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 239.4 on 42 degrees of freedom
Multiple R-squared: 0.01384, Adjusted R-squared: -0.009638
F-statistic: 0.5895 on 1 and 42 DF, p-value: 0.4469
Call:
lm(formula = mfEnds ~ Current)
Residuals:
Min 1Q Median 3Q Max
-243.617 -104.590 -1.599 118.596 249.567
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 109.24823 31.04194 3.519 0.00105 **
Current 0.25140 0.09844 2.554 0.01437 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 134.6 on 42 degrees of freedom
Multiple R-squared: 0.1344, Adjusted R-squared: 0.1138
F-statistic: 6.522 on 1 and 42 DF, p-value: 0.01437
Call:
lm(formula = mfPeak ~ Current)
Residuals:
Min 1Q Median 3Q Max
-490.40 -23.05 18.10 44.04 69.10
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -50.10372 20.21298 -2.479 0.0173 *
Current 0.02151 0.06410 0.336 0.7389
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 87.64 on 42 degrees of freedom
Multiple R-squared: 0.002673, Adjusted R-squared: -0.02107
F-statistic: 0.1126 on 1 and 42 DF, p-value: 0.7389
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.