カイ2乗検定(chi-square test)
グラフのコードの出所:
グラフのスクリプト
imanishi$Digit <- factor(imanishi$Digit)
graph <- ggplot(imanishi, aes(x=Digit, y=Frequency)) +
geom_bar(stat='identity') +
theme_bw()
graph
カイ2乗検定の結果:
library(ggplot2)
x <- seq(0, +180, 0.1)
dens <- data.frame(x=x, y=dchisq(x, 9))
ggplot(dens,aes(x,y)) +
geom_line()+
geom_vline(xintercept = 16.92, linetype="dashed")+
geom_vline(xintercept = 21.67, linetype="dashed")+
geom_vline(xintercept = 174.37, linetype="dashed",col="red")
pchisq(q=16.92,df=9)
pchisq(q=21.67,df=9)
pchisq(q=174.37,df=9)
chisq.test(imanishi$Frequency,simulate.p.value=T)