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 [2018/12/03 16:57] – 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> | ||
| - | <code># Chi-sq test | + | ====== chi square test eg. 2 ====== |
| - | chi <- chisq.test(df$treatment, | + | <tabbed> |
| - | chi | + | * :r:chi-square |
| - | Pearson' | + | |
| + | </ | ||
| - | data: df$treatment and df$improvement | + | ====== chi square test eg. 3 ====== |
| - | X-squared | + | < |
| - | </code> | + | * : |
| + | * *: | ||
| + | </tabbed> | ||
| + | {{tag> statistics r " | ||
| - | < | ||
| - | 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 | ||
| - | not-treated | ||
| - | treated | ||
| - | |||
| - | round(chi$observed, | ||
| - | | ||
| - | df$treatment | ||
| - | not-treated | ||
| - | treated | ||
| - | </ | ||
| - | |||
| - | <WRAP box help> | ||
| - | Do chi-square test as explained in [[: | ||
| - | </ | ||
r/chi-square_test.1543856242.txt.gz · Last modified: by hkimscil
