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


alpha=0.05
n=3
o=c(24,98,95,23)
N=sum(o);N
x=c(0,1,2,3)
pcap=sum(o*x)/N/n;pcap
e=N*dbinom(x,3,pcap);e
chisquare_compute=sum((o-e)^2/e);chisquare_compute
v=2
one_tailed_sig=1-pchisq(chisquare_compute,v);one_tailed_sig
chisq_critical=qchisq(1-alpha,v);chisq_critical



