-
Notifications
You must be signed in to change notification settings - Fork 7
/
37-Correlation.Rmd
565 lines (405 loc) · 23.3 KB
/
37-Correlation.Rmd
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
# (PART) Correlational RQs: correlation and regression {-}
# Correlation {#Correlation}
<!-- Introductions; easier to separate by format -->
```{r, child = if (knitr::is_html_output()) {'./introductions/37-Correlation-HTML.Rmd'} else {'./introductions/37-Correlation-LaTeX.Rmd'}}
```
<!-- Define colours as appropriate -->
```{r, child = if (knitr::is_html_output()) {'./children/coloursHTML.Rmd'} else {'./children/coloursLaTeX.Rmd'}}
```
## Introduction: red deer {#Chap33-Intro}
\index{Correlation}
So far, RQs about single variables (descriptive RQs) and RQs for comparisons (relational and repeated-measures RQs) have been studied.
In this chapter (and the next), the relationship between two quantitative variables is studied *when that relationship is approximately linear* (correlational RQs).
Consider the age and the weight of the molars of $n = 78$ male red-deer [@data:Holgate1965:StraightLine], as seen in Chap.\ \@ref(TwoQuant)
`r if( knitr::is_latex_output() ) {
'(and Table\\ \\@ref(tab:RedDeerData)).'
} else {
'(and the data in that section).'
}`
The data comprises two quantitative variables, and the scatter plot is repeated in Fig.\ \@ref(fig:RedDeerScatter2).
```{r RedDeerScatter2, fig.width=5.5, out.width='65%', fig.align='center', fig.height=3.5, fig.cap="Molar weight verses age for the red deer data"}
data(RedDeer)
plot(Weight ~ Age,
data = RedDeer,
las = 1,
pch = 19,
ylim = c(0, 5.5),
xlim = c(4, 15),
cex = 0.8,
main = "Molar weight and age\nof male red deer",
xlab = "Age (in years)",
ylab = "Molar weight (in g)")
```
A relationship between the variables seems evident.
That is, knowing the age of the deer seems to provide some information about the weight of the molars.
Furthermore, the relationship seems somewhat *linear*, and in Sect.\ \@ref(CorrCoefficients) the *correlation coefficient* was found to be $r = -0.584$.
However, only one of the countless possible samples of deer have been studied, so potentially that relationship may not actually be present in the population.
That is, perhaps the *population* correlation coefficient $\rho$ is actually 0, and the *sample* correlation coefficient is non-zero simply due to *sampling variation*.
<div style="float:right; width: 222x; border: 1px; padding:10px">
<img src="Illustrations/diana-parkhouse-Qf4eZXC3t2Y-unsplash.jpg" width="200px"/>
</div>
## Statistical hypotheses and the hypothesis test {#CorrelationTesting}
\index{Hypothesis testing!correlation coefficient}
A correlational RQ can be asked about the relationship between the variables in the *population*, as measured by the unknown *population* correlation coefficient:
> In the population, is there a linear relationship between the value of $y$ and the value of $x$?
In the context of the red-deer data, the RQ is:
> In male red deer, is there a linear relationship between molar weight and age?
More specifically, we could ask a *one-tailed* research question, since it seems reasonable that teeth get lighter (worn down) as deer age:
> In male red deer, does molar weight *decrease* linearly as age increases?
This is a *one-tailed* RQ, about the population parameter $\rho$.
Clearly, the *sample* correlation coefficient $r$ for the red-deer data is not zero, and the RQ is effectively asking if sampling variation is the reason for this.
The null hypotheses is:
* $H_0$: $\rho = 0$.
The parameter is $\rho$, the *population* correlation coefficient.
This null hypothesis is the 'no relationship' position, which proposes that the population correlation coefficient is zero, and the sample correlation coefficient is not zero due to sampling variation.
The alternative hypothesis is:
* $H_1$: $\rho < 0$ \quad (*one-tailed* test, based on the RQ).
As usual, initially *assume* that $\rho = 0$ (from $H_0$), then describe what values of $r$ could be *expected* using the *sampling distribution*, under that assumption, across all possible samples (sampling variation).
Then the *observed* value of $r$ is compared to the expected values to determine if the value of $r$ supports or contradicts the assumption.
For a correlation coefficient, the sampling distribution of $r$ does not have a normal distribution^[For those interested: the value of $r$ only varies between $-1$ and $1$, so cannot have a normal distribution. A transformation of $r$ *does* exist that has an approximate normal distribution and *standard error*.], and the software output does not provide a standard error, so we will not discuss CIs for the correlation coefficient.
The output (Fig.\ \@ref(fig:RedDeerCorrelationjamovi2)) contains the relevant $P$-value for the $t$-test.
The *two*-tailed $P$-value for the test is less than $0.001$, so the *one*-tailed $P$ value will be less than $0.001/2 = 0.0005$.
*Very strong evidence* exists to support $H_1$ (that the correlation in the population is less than zero).
We write:
> The sample presents very strong evidence (one-tailed $P < 0.0005$) that the molar weight decreases as the age of the male red deer increases ($r = -0.584$; $n = 78$) in the population.
Notice the three features of writing conclusions again:
An *answer to the RQ*; evidence to support the conclusion ('one-tailed $P < 0.0005$'; here no value for the test statistic is given in the output); and some *sample summary information* ('$r = -0.584$; $n = 78$').
```{r RedDeerCorrelationjamovi2, fig.cap="jamovi output for the red-deer data", fig.align="center", out.width='45%'}
knitr::include_graphics("jamovi/RedDeer/RedDeer-Correlation.png")
```
::: {.tipBox .tip data-latex="{iconmonstr-info-6-240.png}"}
The evidence suggests that the correlation coefficient is *not zero* (in the population).
However, a *non-zero* correlation doesn't necessarily mean a *strong* correlation exists.
The correlation may be weak in the population (as estimated by the value of $r$), but evidence exists that the correlation is *not zero* in the *population*.
That is, the test is about statistical significance, not practical importance.\index{Practical importance}
:::
## Statistical validity conditions {#ValidityCorrelation}
\index{Statistical validity!correlation coefficient}
As usual, these results hold under certain conditions.
The conditions for which the test is statistically valid are:
1. The relationship is approximately linear.
1. The variation in the response variable is approximately constant for all values of the explanatory variable.
1. The sample size is at least $25$.
The sample size of $25$ is a rough figure; some books give other values.
The units of analysis are also assumed to be *independent* (e.g., from a simple random sample).
::: {.example #StatisticalValidityDeer name="Statistical validity"}
For the red-deer data, the scatterplot (Fig.\ \@ref(fig:RedDeerScatter2)) shows that the relationship is approximately linear, so using a correlation coefficient is appropriate.
For the hypothesis test, the variation in molar weights doesn't seem to be obviously getting larger or smaller for older deer, and the sample size is also greater than $25$.
The test in Sect.\ \@ref(CorrelationTesting) is statistically valid.
:::
<iframe src="https://learningapps.org/watch?v=pd07ft8ec22" style="border:0px;width:100%;height:500px" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
## Example: removal efficiency {#Removal-Efficiency}
<div style="float:right; width: 222x; border: 1px; padding:10px">
<img src="Illustrations/pexels-lisa-fotios-3264779.jpg" width="200px"/>
</div>
In wastewater treatment facilities, air from biofiltration is passed through a membrane and dissolved in water, and is transformed into harmless byproducts.
The removal efficiency $y$ (in %) may depend on the inlet temperature (in $^\circ$C; $x$).
@chitwood2001treatment asked:
> In treating biofiltation wastewater, is the removal efficiency linearly associated with the inlet temperature?
The population parameter is $\rho$, the correlation between the removal efficiency and inlet temperature.
A scatterplot of $n = 32$ observations (Fig.\ \@ref(fig:CorrelationRemovalEfficiency), left panel) suggests an approximately linear relationship [@DevoreBerk2007].
The output (Fig.\ \@ref(fig:CorrelationRemovalEfficiency), right panel) shows that the sample correlation coefficient is $r = 0.891$, and so $R^2 = (0.891)^2 = 79.4$%.
This means that about $79.4$% of the variation in removal efficiency can be explained by knowing the inlet temperature.
```{r CorrelationRemovalEfficiency, fig.cap="The relationship between removal efficiency and inlet temperature. Left: scatterplot. Right: jamovi output.", fig.align="center", fig.width=5, fig.height=3.25, out.width=c("52%", "5%", "38%"), fig.show="hold"}
data(Removal)
plot(Removal ~ Temp,
data = Removal,
main = "Removal efficiency",
xlab = "Temperature (degrees C)",
ylab = "Removal efficiency (%)",
pch = 19,
ylim = c(97.5, 99.0),
xlim = c(5, 18),
las = 1
)
knitr::include_graphics("OtherImages/SPACER.png")
knitr::include_graphics("jamovi/Removal/RemovalCorrelation.png")
```
To test if a relationship exists in the population, write:
$$
\text{$H_0$: } \rho = 0;\quad\text{and}\quad \text{$H_1$: } \rho \ne 0,
$$
where $\rho$ is the population correlation coefficient.
The alternative hypothesis is two-tailed (as implied by the RQ).
The software output (Fig.\ \@ref(fig:CorrelationRemovalEfficiency), right panel) shows that $P < 0.001$.
We conclude:
> The sample presents very strong evidence (two-tailed $P < 0.001$) that removal efficiency depends on the inlet temperature ($r = 0.891$; $n = 32$) in the population.
The relationship is approximately linear, there is no obvious non-constant variation in the removal efficiency, and the sample size is larger than $25$, so the hypothesis test results is statistically valid.
## Chapter summary {#Chap34-Summary}
To test a hypothesis about a correlation between two variables, $\rho$:
* Write the null hypothesis ($H_0$) and the alternative hypothesis ($H_1$).
* Initially *assume* the value of $\rho$ in the null hypothesis to be true (usually zero).
* Software output provides the $P$-value for the test, but no test statistic or confidence interval.
`r if (knitr::is_html_output()){
'The following short video may help explain some of these concepts:'
}`
<div style="text-align:center;">
<iframe width="560" height="315" src="https://www.youtube.com/embed/ZHwFJkpokMk" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture"></iframe>
</div>
## Quick review questions {#Chap38-QuickReview}
::: {.webex-check .webex-box}
A study of Chinese paediatric patients [@wong2018correlation] studied the relationship between the $6$-minute walk distance ($6$MWD) and maximum oxygen uptake (VO$2$~max~) for $n = 29$ patients.
The correlation coefficient is reported as $r = 0.457$, and the corresponding $P$-value as $P = 0.013$.
1. What is the $x$-variable? \tightlist
`r if( knitr::is_html_output() ) {
longmcq( c(
answer = "6-minute walk distance",
"Maximum oxygen uptake"
) )}`
1. True or false: Since the $P$-value is small, the correlation is quite strong.
`r if( knitr::is_html_output() ) {
torf(answer=FALSE)
}`
1. Is the relationship a *positive* or *negative* relationship?
`r if( knitr::is_html_output() ) {
longmcq( c(
"Negative",
answer = "Positive"
) )}`
1. What is the value of $R^2$ (to one decimal place, expressed as a percentage)?
`r if( knitr::is_html_output() ) {fitb(answer = 20.9, num=TRUE, tol=0.1)}`
1. For statistical validity, what do we need to *assume* to be true?
`r if( knitr::is_html_output() ) {longmcq( c(
"The response variable has a normal distribution",
"The explanatory variable has a normal distribution",
"The sample size is larger than 25",
answer = "A linear relationship exists between the variables"
) )}`
1. True or false? Since $P$ is small, the relationship must be very strong.
`r if( knitr::is_html_output() ) {
torf(answer=FALSE)
}`
:::
## Exercises {#CorrelationExercises}
Answers to odd-numbered exercises are available in App.\ \@ref(Answers).
`r if( knitr::is_latex_output() ) "\\captionsetup{font=small}"`
::: {.exercise #CorTestDrug}
@leblanc2005paramedic studied $n = 30$ paramedicine students, and examined the relationship between the amount of stress experienced while performing drug-dose calculations (measured using the State–Trait Anxiety Inventory (STAI)), and length of work experience.
1. Write the hypotheses for testing for a relationship between the STAI score and the length of work experience.
1. The article gives the correlation coefficient as $r = 0.346$ and $P = 0.18$.
What do you conclude?
1. What must be *assumed* for the test to be statistically valid?
:::
::: {.exercise #CorTestPesticides}
@einsiedel2024investigating studied the relationship between amount of pesticide residue reported on a variety of fresh fruits and vegetables, and various weather measurements.
One pesticide studied was the herbicide perchlorate.
1. Write the hypotheses for testing for a relationship between the perchlorate residue and *maximum* temperature at the growing location.
1. The article gives the correlation coefficient as $r = -0.059$ and $P = 0.035$.
What do you conclude?
1. Write the hypotheses for testing for a relationship between the perchlorate residue and *minimum* temperature at the growing location.
1. The article gives the correlation coefficient as $r = -0.025$ and $P = 0.365$.
What do you conclude?
1. What must be *assumed* for the tests to be statistically valid?
:::
::: {.exercise #CorrelationSoftdrink}
[*Dataset*: `SDrink`]
A study examined the time taken to deliver soft drinks to vending machines [@others:Montgomery:regressionanalysis] using a sample of size $n = 25$ (Fig.\ \@ref(fig:MandibleGestationPlotHT), left panel).
To perform a test of the correlation coefficient, are the statistical validity conditions met?
:::
::: {.exercise #TwoQuantExercisesMandibleTEST}
[*Dataset*: `Mandible`]
@data:royston:mandible examined the mandible length and gestational age for $n = 167$ foetuses from the $12$th week of gestation onward (Fig.\ \@ref(fig:MandibleGestationPlotHT), right panel).
To perform a test of the correlation coefficient, are the statistical validity conditions met?
:::
```{r MandibleGestationPlotHT, fig.cap="Two scatterplots. Left: the time taken to deliver soft drinks to vending machines. Right: the relationship between gestational age and mandible length. In both plots, the solid line displays the linear relationship.", fig.align="center", fig.width=9, fig.height=3.5, out.width='100%'}
par(mfrow = c(1, 2),
mar = c(5.1, 5.1, 4.1, 2.1))
data(SDrink) ### Exercise
plot(Time ~ Cases,
data = SDrink,
main = "Time to service vending machine\nand number of products stocked",
xlab = "Number of cases of product stocked",
ylab = "Time to service\nmachine (mins)",
xlim = c(0, 30),
ylim = c(0, 80),
las = 1,
pch = 19)
abline(coef(lm(Time ~ Cases,
data = SDrink)),
col = "grey")
###
data(Mandible) ### Exercise
plot(Length ~ Age,
data = Mandible,
main = "Gestational age and\nmandible length",
xlab = "Gestational age (in weeks)",
ylab = "Mandible length (in mm)",
xlim = c(10, 40),
ylim = c(0, 50),
las = 1,
pch = 19)
abline(coef(lm(Length ~ Age,
data = Mandible)),
col = "grey")
###
```
::: {.exercise #CorTestDogs}
[*Dataset*: `Dogs`]
@quan2017relation studied Phu Quoc Ridgeback dogs (*Canis familiaris*), and recorded many measurements of the dogs, including body length and body height.
The scatterplot displaying the relationship and the jamovi output are shown in Fig.\ \@ref(fig:DogsScatter).
In this example, it does not matter which variable is used as $x$ or $y$.
1. Describe the relationship.
2. Taller dogs might be expected to be longer.
To test this, write the hypotheses.
3. Perform the test, using the output.
Write a conclusion.
4. Is the test statistically valid?
:::
```{r DogsScatter, fig.align = "center", fig.cap = "Phu Quoc ridgeback dogs. Left: a scatterplot of the body height vs body length. Right: jamovi output", fig.width=c(4, 5), fig.height=3.25, out.width=c("50%", "5%", "40%"), fig.show="hold"}
data(Dogs) ### Exercise
plot( jitter(BL) ~ jitter(BH),
data = Dogs,
xlab = "Body length (in cm)",
ylab = "Body height (in cm)",
main = "Body height vs body length\nfor Phu Quoc ridgeback dogs",
pch = 19,
las = 1,
ylim = c(44, 65),
xlim = c(35, 60) )
knitr::include_graphics("OtherImages/SPACER.png")
knitr::include_graphics("jamovi/Dogs/Dogs-correlation-jamoviTest.png")
```
::: {.exercise #CorrelationExerciseBitumen}
[*Dataset*: `Bitumen`]
@data:Panda2018:Bitumen made $n = 42$ observations of studied hot mix asphalt, and measured the volume of air voids and the bitumen content by weight.
The scatterplot displaying the relationship and the jamovi output are shown in Fig.\ \@ref(fig:BitumenScatter).
1. Using the plot, estimate the value of $r$.
1. The value of $R^2$ is $99.29$%.
What is the value of $r$? (Hint: Be careful!)
1. Would you expect the $P$-value testing $H_0$: $\rho=0$ to be small or large?
Explain.
1. Would the test be statistically valid?
:::
```{r BitumenScatter, fig.align = "center", fig.cap = "Bitumen content by weight. Left: a scatterplot. Right: jamovi output", fig.width=c(4, 5), fig.height=3.25, out.width=c("50%", "5%", "40%"), fig.show="hold"}
data(Bitumen) ### Exercise
plot(AirVoids ~ Bitumen,
data = Bitumen,
pch = 19,
xlab = "Bitumen content by weight (%)",
ylab = "Air voids by volume (%)",
main = "The relationship between air voids\nand bitumen content",
las = 1,
xlim = c(4.7, 5.4),
ylim = c(3.5, 5.5)
)
knitr::include_graphics("OtherImages/SPACER.png")
knitr::include_graphics("jamovi/Bitumen/Bitumen-Correlation.png")
```
::: {.exercise #CorrelationExercisePunting}
[*Dataset*: `Punting`]
A study (@MyersRegression, p. 75) of American footballers measured the right-leg strengths $x$ of 13 players (using a weight lifting test), and the distance $y$ they punted a football with their right leg (Fig.\ \@ref(fig:PuntPlotCor2)).
Use the jamovi output (Fig.\ \@ref(fig:PuntPlotCor2)) to answer these questions.
1. Compute the value of $R^2$, and explain what this means.
1. Perform a hypothesis test to determine if a *positive* correlation exists between punting distance and right-leg strength.
:::
```{r PuntPlotCor2, fig.align = "center", fig.cap = "The punting data. Left: a scatterplot. Right: jamovi output", fig.width=c(4, 5), fig.height=3.25, out.width=c("50%", "5%", "40%"), fig.show="hold"}
data(Punting) ### Exercise
plot(Punt ~ Right,
data = Punting,
las = 1,
xlab = "Right leg strength (in pounds)",
ylab = "Punting distance (in feet)",
pch = 19,
xlim = c(110, 180),
ylim = c(100, 200)
)
abline(
coef(
Punt.lm <- lm( Punt ~ Right,
data = Punting)),
lwd = 2,
col = "grey")
knitr::include_graphics("OtherImages/SPACER.png")
knitr::include_graphics("jamovi/Punting/Punting-Correlation.png")
```
::: {.exercise #CorrelationExercisesGorillas}
[*Dataset*: `Gorillas`]
(These data were also seen in Exercise\ \@ref(exr:TwoQuantExercisesGorillas).)
@wright2021chest examined $25$ gorillas and recorded information about their chest beating and their size (measured by the breadth of the gorillas' backs).
The relationship is shown in a scatterplot in Fig.\ \@ref(fig:GorillaPlotCorTest).
Using the output (Fig.\ \@ref(fig:GorillaPlotCorTest)), determine the value of $r$ and $R^2$.
Perform a hypothesis tests, and make a conclusion about the relationship between the chest beating and size of gorillas.
:::
```{r GorillaPlotCorTest, fig.align = "center", fig.cap = "The punting data. Left: a scatterplot. Right: jamovi output", fig.width=c(4, 5), fig.height=3.25, out.width=c("50%", "5%", "40%"), fig.show="hold"}
data("Gorillas") ### Exercise
plot(ChestBeatRate ~ BackBreadth,
data = Gorillas,
las = 1,
xlab = "Back breadth (in cm)",
ylab = "Chest beating rate (per 10 hrs)",
pch = 19,
xlim = c(54, 66),
ylim = c(0, 5)
)
abline(
coef(
Gorilla <- lm( ChestBeatRate ~ BackBreadth,
data = Gorillas)),
lwd = 2,
col = "grey")
knitr::include_graphics("OtherImages/SPACER.png")
knitr::include_graphics("jamovi/Gorillas/GorillasCorrelation-jamovi.png")
```
::: {.exercise #CorrelationExercisePossums}
[*Dataset*: `Possums`]
@data:Williams2022:Possums studied Leadbeater's possums in the Victorian Central Highlands.
They recorded, among other information, the body weight of the possums and their location, including the elevation of the location.
A scatterplot of the data and the jamovi output are shown in Fig.\ \@ref(fig:PossumsScatterjamovi).
Using the output (Fig.\ \@ref(fig:PossumsScatterjamovi)), determine the value of $r$ and $R^2$.
Perform a hypothesis tests, and make a conclusion about the relationship between the chest beating and size of gorillas.
:::
```{r PossumsScatterjamovi, fig.cap="The relationship between weight of possums and the elevation of their location. Left: scatterplot. Right: jamovi output", fig.align="center", fig.width=5, fig.height=3.5, out.width=c("50%", "45%"), fig.show="hold"}
data(Possums) ### Exercise
plot(Wgt ~ DEM,
data = subset(Possums, Sex=="Male"),
xlab = "Elevation (in m)",
ylab = "Body weight (in g)",
main = "Body weight and elevation\nfor male Leadbeaters possums",
las = 1,
xlim = c(600, 1600),
ylim = c(100, 170),
pch = 19)
knitr::include_graphics("jamovi/Possums/Possums-Correlation-jamovi.png")
```
:::{.exercise #CorrelationExerciseSoil}
[*Dataset*: `Soils`]
The *California Bearing Ratio* (CBR) value is used to describe soil sub-grade for flexible pavements (such as in the design of air field runways).
@talukdar2014study examined the relationship between CBR and other properties of soil, including the plasticity index (PI, a measure of the plasticity of the soil).
The scatterplot from 16 different soil samples from Assam, India, is shown in Fig.\ \@ref(fig:SoilPlotCor).
1. Using the plot, take a guess at the value of $r$.
1. The value of $R^2$ is $67.07$%.
What is the value of $r$? (Hint: Be careful!)
1. Would you expect the $P$-value testing $H_0$: $\rho = 0$ to be small or large?
Explain.
1. Would the test be statistically valid?
:::
```{r SoilPlotCor, fig.cap="The relationship between CBR and PI in sixteen soil samples", fig.align="center", fig.width=5, fig.height=3.5}
data(Soils) ### Exercise
plot(CBR ~ PI,
data = Soils,
pch = 19,
xlab = "Plasticity index (PI)",
ylab = "CBR",
las = 1,
xlim = c(6.0, 8.5),
ylim = c(5.5, 6.2)
)
```
::: {.exercise #GraphsTypingCor}
[*Dataset*: `Typing`]
The `Typing` dataset contains four variables: typing speed (`mTS`), typing accuracy (`mAcc`), age (`Age`). and sex (`Sex`) for $1301$ students [@pinet2022typing].
Is there evidence of a linear relationship between the mean typing speed and mean accuracy?
Explain.
:::
`r if( knitr::is_latex_output() ) "\\captionsetup{font=normalsize}"`
<!-- QUICK REVIEW ANSWERS -->
`r if (knitr::is_html_output()) '<!--'`
::: {.EOCanswerBox .EOCanswer data-latex="{iconmonstr-check-mark-14-240.png}"}
**Answers to *Quick Revision* questions:**
**1.** $6$MWD.
**2.** False.
**3.** Positive.
**4.** $20.9$.
**5.** A linear relationship exists between the variables.
:::
`r if (knitr::is_html_output()) '-->'`