
162 Data Analysis and Statistics for Geography, Environmental Science, and Engineering
> table(cut(Temp, quantile(Temp)),cut(Ozone, quantile(Ozone,
na.rm=T)))
(1,18] (18,31.5] (31.5,63.3] (63.3,168]
(56,72] 17 10 5 0
(72,79] 10 10 5 1
(79,85] 4 6 14 6
(85,97] 0 0 5 22
>
We can see that higher Ozone is associated with higher Temp, which we can verify with c hisq.test
> chisq.test(table(cut(Temp, quantile(Temp)),cut(Ozone,
quantile(Ozone, na.rm=T))))
Pearson’s Chi-squared test
data: table(cut(Temp, quantile(Temp)), cut(Ozone, quantile(Ozone,
na.rm = T)))
X-squared = 83.3787, df = 9, p-value = 3.436e-14
Indeed, this very low p-value means we can reject ...