본문 바로가기
R

[R] Chi-Square Test in R, and easy TIP

by Chandler.j 2021. 10. 6.
반응형

fig1. title

#0. sample data

#1. chi square test

#2. chi square calculator, very very easy


 

#0. sample data

data <- data.frame(
  index = seq(1, 100,by=1),
  color = sample(c("R","G","B"), 100, replace = TRUE),
  group = sample(c("a","b"), 100, replace = TRUE)
)
summary(data)
(table <- table(data$color, data$group))

fig2. output of #0


 

#1. chi square test and proportion test

chisq.test(x=data$group, y=data$color)

fig3. output of #1-1

chisq.test(table)

fig4. output of #1-2

prop.test(table, correct = F)

fig5. output of #1-3


 

#2. chi square calculator, very very easy

 

ref : https://www.socscistatistics.com/tests/chisquare2/default2.aspx

 

Chi Square Calculator - Up To 5x5, With Steps

This is a easy chi-square calculator for a contingency table that has up to five rows and five columns (for alternative chi-square calculators, see the column to your right). The calculation takes three steps, allowing you to see how the chi-square statist

www.socscistatistics.com

fig6. calculator


TOP

Designed by 티스토리