#7.5 Cordial Drink Preference Example x<-c(5,10,11,10,4) #Find mean to work out expected preferences from discrete uniform distribution mean(x) expected<-rep(sum(x)/length(x),length(x)) tab<-cbind(x,expected) colnames(tab)<-c("Observed","Expected") tab #gof stuff GOF(tab) #residual analysis Vr<-GOF(tab)$Vr residual<-sum(Vr^2)-Vr[2]^2 residual 1-pchisq(residual,3)