Suppose we want to know whether people are in favour of having daylight savings time all year round. We ask 20 males and 20 females whether they each agree with having DST all year round (“yes”) or not (“no”). Some randomly chosen data:
Count up individuals in each category combination, and arrange in contingency table:
chisq.test
.
Pearson's Chi-squared test
data: tab
X-squared = 7.033, df = 1, p-value = 0.008002
correct = FALSE
uses “Yates correction”.
Pearson's Chi-squared test
data: tab
X-squared = 4.4638, df = 1, p-value = 0.03462
median_test
does the whole thing:$grand_median
[1] 47
$table
above
group above below
c 8 15
t 14 7
$test
what value
1 statistic 4.46376812
2 df 1.00000000
3 P-value 0.03462105
group
is “explanatory” and above/below is “response”.x
and plot response as fill
(y
will be frequency):
Comments