Battery Life Experiment
An experimenter wanted to study the life of a battery in a the design phase.
The engineer deicides to test a=3 plate materials and b=3 temperature (15, 75, and 125) degrees F.
n=4 batteries were used
N=abn = 36
Data description
library (tidyverse)
library (gtsummary)
Lifebattery= c (130 ,155 ,74 ,180 ,150 ,188 ,126 ,159 ,138 ,110 ,168 ,160 ,34 ,40 ,75 ,80 ,136 ,122 ,106 ,115 ,174 ,120 ,150 ,139 ,82 ,20 ,70 ,58 ,25 ,70 ,58 ,45 ,96 ,104 ,60 ,82 )
MaterialType= gl (n = 3 ,k= 4 ,length = 36 ,labels = (1 : 3 ))
Temp= gl (n = 3 ,k= 12 ,length = 36 ,labels = c (15 ,70 ,125 ))
battery_data = tibble (Lifebattery,MaterialType,Temp)
## Plotting
interaction.plot (x.factor = Temp,trace.factor = MaterialType,response = Lifebattery,fun = mean)
# A tibble: 6 × 3
Lifebattery MaterialType Temp
<dbl> <fct> <fct>
1 130 1 15
2 155 1 15
3 74 1 15
4 180 1 15
5 150 2 15
6 188 2 15
battery_data %>%
ggplot (aes (x= Temp,y= Lifebattery,group= Temp)) +
geom_point ()+
stat_summary (aes (group= 1 ),
fun = mean,
geom = "line" ,
col= "red" ,
linewidth= 2 )+
stat_summary (aes (label= round (..y..,1 ),group= 1 ),
fun = mean,
geom = "text" ,
col= "blue" ,
size= 10 )+
theme_bw ()+
labs (x= "Temp" ,
y= "Battery Life (in hours)" )+
facet_wrap (~ MaterialType)
battery_data %>%
select (Lifebattery,Temp) %>%
tbl_summary (by= Temp,
statistic = list (all_continuous () ~ "{mean} ({sd})" ))
Characteristic
15 , N = 12
70 , N = 12
125 , N = 12
Lifebattery
145 (32)
108 (43)
64 (26)
ANOVA in R
Fitting
library (sjPlot)
# ANOVA one factor and one blocking factor
results= aov (Lifebattery~ MaterialType * Temp)
summary (results)
Df Sum Sq Mean Sq F value Pr(>F)
MaterialType 2 10684 5342 7.911 0.00198 **
Temp 2 39119 19559 28.968 1.91e-07 ***
MaterialType:Temp 4 9614 2403 3.560 0.01861 *
Residuals 27 18231 675
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Individual CIs
confint (results)
2.5 % 97.5 %
(Intercept) 108.09174 161.40826
MaterialType2 -16.70048 58.70048
MaterialType3 -28.45048 46.95048
Temp70 -115.20048 -39.79952
Temp125 -114.95048 -39.54952
MaterialType2:Temp70 -11.81653 94.81653
MaterialType3:Temp70 25.93347 132.56653
MaterialType2:Temp125 -82.31653 24.31653
MaterialType3:Temp125 -34.56653 72.06653
There was a significance main effect of the temperature on the battery life (p=0.00198)
There was a significance main effect of the Material Type on the battery life (p<0.001)
There was a significance interaction effect of the temperature and Material Type on the battery life (p=0.0186)
Model Adequacy
par (mfrow= c (2 ,2 ))
plot (results)
No transformation is needed.
Multiple Comparison
Considering 5% level of significance.
#Tukey Test
THSD= TukeyHSD (results,which = "MaterialType" )
plot (THSD,las= 1 )
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Lifebattery ~ MaterialType * Temp)
$MaterialType
diff lwr upr p adj
2-1 25.16667 -1.135677 51.46901 0.0627571
3-1 41.91667 15.614323 68.21901 0.0014162
3-2 16.75000 -9.552344 43.05234 0.2717815
# Fisher LSD Test
library (agricolae)
L= LSD.test (results,"MaterialType" ,console= TRUE ,group = F)
Study: results ~ "MaterialType"
LSD t Test for Lifebattery
Mean Square Error: 675.213
MaterialType, means and individual ( 95 %) CI
Lifebattery std r LCL UCL Min Max
1 83.16667 48.58888 12 67.77551 98.55782 20 180
2 108.33333 49.47237 12 92.94218 123.72449 25 188
3 125.08333 35.76555 12 109.69218 140.47449 60 174
Alpha: 0.05 ; DF Error: 27
Critical Value of t: 2.051831
Comparison between treatments means
difference pvalue signif. LCL UCL
1 - 2 -25.16667 0.0251 * -46.93305 -3.400285
1 - 3 -41.91667 0.0005 *** -63.68305 -20.150285
2 - 3 -16.75000 0.1260 -38.51638 5.016382
Conclusion :
The material 3 seems to be robust to higher and lower temperature.
The material 2 seems to be better fitted to lower temperature.
Impurity data (One cell observation)
library (additivityTests)
impurity= c (5 ,3 ,1 ,4 ,1 ,1 ,6 ,4 ,3 ,3 ,2 ,1 ,5 ,3 ,2 )
Press= gl (n = 5 ,k= 3 ,length = 15 ,labels = seq (25 ,45 ,5 ))
Temp= gl (n = 3 ,k= 1 ,length = 15 ,labels = c (100 ,125 ,150 ))
data= matrix (impurity,nrow = 3 )
# additivity Test (no-interaction)
tukey.test (data)
Tukey test on 5% alpha-level:
Test statistic: 0.3627
Critival value: 5.591
The additivity hypothesis cannot be rejected.
av= aov (impurity ~ Press + Temp)
summary (av)
Df Sum Sq Mean Sq F value Pr(>F)
Press 4 11.60 2.90 11.60 0.00206 **
Temp 2 23.33 11.67 46.67 3.88e-05 ***
Residuals 8 2.00 0.25
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Radar Scope detection
2 factors: 3x2 factorial design.
An engineer is studying methods for improving the ability to detect targets on a radar scope.
Two factors she considers to be important are the amount of background noise , or “ground clutter,” on the scope and the type of filter placed over the screen.
An experiment is designed using three levels of ground clutter and two filter types .
We will consider these as fixed‐type factors.
The experiment is performed by randomly selecting a treatment combination (ground clutter level and filter type) and then introducing a signal representing the target into the scope.
The intensity of this target is increased until the operator observes it.
The intensity level at detection is then measured as the response variable.
Blocking
Because of operator availability, it is convenient to select an operator and keep him or her at the scope until all the necessary runs have been made. Furthermore, operators differ in their skill and ability to use the scope. Consequently, it seems logical to use the operators as blocks. Four operators are randomly selected.
intensity= c (90 ,102 ,114 ,86 ,87 ,93 ,96 ,106 ,112 ,84 ,90 ,91 ,100 ,105 ,108 ,92 ,97 ,95 ,92 ,96 ,98 ,81 ,80 ,83 )
Noise= gl (n = 3 ,k= 1 ,length = 24 ,labels = (1 : 3 ))
Noise
[1] 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
Levels: 1 2 3
Fil= gl (n = 2 ,k= 3 ,length = 24 ,labels = (1 : 2 ))
Op= gl (n = 4 ,k= 6 ,length = 24 ,labels = (1 : 4 ))
av= aov (intensity ~ Noise * Fil + Op)
summary (av)
Df Sum Sq Mean Sq F value Pr(>F)
Noise 2 335.6 167.8 15.132 0.000253 ***
Fil 1 1066.7 1066.7 96.192 6.45e-08 ***
Op 3 402.2 134.1 12.089 0.000277 ***
Noise:Fil 2 77.1 38.5 3.476 0.057507 .
Residuals 15 166.3 11.1
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Random Effect
library (lme4)
avRE <- lmer (intensity ~ (1 | Op) + Noise* Fil)
summary (avRE)
Linear mixed model fit by REML ['lmerMod']
Formula: intensity ~ (1 | Op) + Noise * Fil
REML criterion at convergence: 110.2
Scaled residuals:
Min 1Q Median 3Q Max
-1.4661 -0.4704 -0.0127 0.6198 1.6870
Random effects:
Groups Name Variance Std.Dev.
Op (Intercept) 20.49 4.527
Residual 11.09 3.330
Number of obs: 24, groups: Op, 4
Fixed effects:
Estimate Std. Error t value
(Intercept) 94.500 2.810 33.630
Noise2 7.750 2.355 3.291
Noise3 13.500 2.355 5.733
Fil2 -8.750 2.355 -3.716
Noise2:Fil2 -5.000 3.330 -1.502
Noise3:Fil2 -8.750 3.330 -2.628
Correlation of Fixed Effects:
(Intr) Noise2 Noise3 Fil2 Ns2:F2
Noise2 -0.419
Noise3 -0.419 0.500
Fil2 -0.419 0.500 0.500
Noise2:Fil2 0.296 -0.707 -0.354 -0.707
Noise3:Fil2 0.296 -0.354 -0.707 -0.707 0.500
# Confidence Intervals Variance Components and Overall Mean
confint (avRE,oldNames= FALSE )
2.5 % 97.5 %
sd_(Intercept)|Op 1.989122 9.9695167
sigma 2.177544 4.0740129
(Intercept) 88.882193 100.1178095
Noise2 3.553437 11.9465629
Noise3 9.303437 17.6965629
Fil2 -12.946563 -4.5534371
Noise2:Fil2 -10.934836 0.9348361
Noise3:Fil2 -14.684836 -2.8151639