info:https://www.scribbr.com/statistics/chi-square-test-of-independence/ example:https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/chisq.test
dataset<- read_csv("PASAbstractClean_labels.csv")
## New names:
## Rows: 10169 Columns: 18
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (14): year, month, day, childgender, caregivergender, childrace, caregiv... dbl
## (4): ...1, record_id, project, phase
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
#View(PASAbstractClean_labels)
chisq.test(dataset$phase, dataset$childrace)
##
## Pearson's Chi-squared test
##
## data: dataset$phase and dataset$childrace
## X-squared = 543.26, df = 7, p-value < 2.2e-16
chisq.test(dataset$phase, dataset$caregiverrace)
##
## Pearson's Chi-squared test
##
## data: dataset$phase and dataset$caregiverrace
## X-squared = 447.23, df = 7, p-value < 2.2e-16
chisq.test(dataset$phase, dataset$langofcare)
## Warning in stats::chisq.test(x, y, ...): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test
##
## data: dataset$phase and dataset$langofcare
## X-squared = 538.34, df = 7, p-value < 2.2e-16
chisq.test(dataset$phase, dataset$caregivergender)
## Warning in stats::chisq.test(x, y, ...): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test
##
## data: dataset$phase and dataset$caregivergender
## X-squared = 2168.7, df = 4, p-value < 2.2e-16
chisq.test(dataset$phase, dataset$education2)
## Warning in stats::chisq.test(x, y, ...): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test
##
## data: dataset$phase and dataset$education2
## X-squared = 187.49, df = 7, p-value < 2.2e-16
chisq.test(dataset$phase, dataset$income2)
## Warning in stats::chisq.test(x, y, ...): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test
##
## data: dataset$phase and dataset$income2
## X-squared = 820.33, df = 6, p-value < 2.2e-16