r:chi-square_test
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| r:chi-square_test [2019/09/17 23:01] – hkimscil | r:chi-square_test [2025/12/02 23:00] (current) – hkimscil | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== chi square test ====== | + | ====== chi square test eg. 1 ====== |
| - | < | + | |
| - | # read the data | + | |
| - | df <- read.csv(" | + | |
| - | # summarize data to table | + | |
| - | table(df$treatment, | + | |
| - | + | ||
| - | improved not-improved | + | |
| - | not-treated | + | |
| - | treated | + | |
| - | </code> | + | < |
| + | * : | ||
| + | * *: | ||
| + | </tabbed> | ||
| - | < | + | ====== chi square |
| - | chi <- chisq.test(df$treatment, | + | <tabbed> |
| - | chi | + | |
| - | Pearson' | + | |
| - | + | </tabbed> | |
| - | data: df$treatment and df$improvement | + | |
| - | X-squared = 5.5569, df = 1, p-value | + | |
| - | </code> | + | |
| - | + | ||
| - | < | + | |
| - | Length Class Mode | + | |
| - | statistic 1 -none- numeric | + | |
| - | parameter 1 -none- numeric | + | |
| - | p.value | + | |
| - | method | + | |
| - | data.name 1 -none- character | + | |
| - | observed | + | |
| - | expected | + | |
| - | residuals 4 table numeric | + | |
| - | stdres | + | |
| - | > </ | + | |
| - | + | ||
| - | < | + | |
| - | | + | |
| - | df$treatment | + | |
| - | | + | |
| - | treated | + | |
| - | + | ||
| - | round(chi$observed, | + | |
| - | | + | |
| - | df$treatment | + | |
| - | not-treated | + | |
| - | treated | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP box help> | + | |
| - | Do chi-square test as explained in [[:chi-square test]] explanation. | + | |
| - | </WRAP> | + | |
| + | ====== chi square test eg. 3 ====== | ||
| + | < | ||
| + | * : | ||
| + | * *: | ||
| + | </ | ||
| {{tag> statistics r " | {{tag> statistics r " | ||
r/chi-square_test.1568761283.txt.gz · Last modified: by hkimscil
