options(scipen=999)
options(digits=9)
cat("\014") # clear screen
rm(list=ls(all=TRUE))


alpha=0.05
o=c(88,122,104,112,94,80)
e=c(100,100,100,100,100,100)
chisquare_compute=sum((o-e)^2/e);chisquare_compute
k=6
m=0
v=k-m-1;v
one_tailed_sig=1-pchisq(chisquare_compute,v);one_tailed_sig
chisq_critical=qchisq(1-alpha,v);chisq_critical


o=c(88,122,104,112,94,80)
e=c(1/6,1/6,1/6,1/6,1/6,1/6)
chisq.test(o,p=e,rescale.p=TRUE)

o=c(88,122,104,112,94,80)
e=c(100,100,100,100,100,100)
chisq.test(o,p=e,rescale.p=TRUE)
