r:chi-square_test:code01
Differences
This shows you the differences between two versions of the page.
| r:chi-square_test:code01 [2025/12/02 22:38] – created hkimscil | r:chi-square_test:code01 [2025/12/02 22:42] (current) – hkimscil | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| < | < | ||
| - | install.packages(" | + | # install.packages(" |
| library(MASS) | library(MASS) | ||
| Line 14: | Line 14: | ||
| e <- chisq$expected | e <- chisq$expected | ||
| o | o | ||
| - | round(e, | + | round(e, |
| - | r <- (e-o)/ | + | res <- (e-o)/ |
| - | r | + | round(res, |
| - | chisq.cal <- sum((e-o)^2/e) | + | chisq.cal <- sum(res^2) |
| p.val <- pchisq(chisq.cal, | p.val <- pchisq(chisq.cal, | ||
| chisq.cal | chisq.cal | ||
| Line 30: | Line 30: | ||
| legend(" | legend(" | ||
| fill = c(" | fill = c(" | ||
| + | |||
| + | |||
| </ | </ | ||
r/chi-square_test/code01.txt · Last modified: by hkimscil
