# [R] There is an error when I performed chisquare and postanova test...:(

massmatics 2hanl2da at naver.com
Fri Sep 25 13:44:59 CEST 2015

```I am studying for a quiz and while I was solving two problems, an error
occured.
a) So the problem is we want to test if the block program makes a difference
in retention at α = 1%
(which is the significance level)
This is the code I used to perform chisquare test.
My solution:
blockprogram <- matrix(c(18,15,5,8,4,10,5,7,18,10), nrow=2, byrow=T)
colnames(blockprogram) <- c("1 yr","2 yr","3 yr","4 yr","5+ yrs")
rownames(blockprogram) <- c("Non-Block","Block")
chisq.test(blockprogram, conf.level=0.99) ==> This is the part where I can't
run..
chisq.test(blockprogram, conf.level=0.99)\$observed
chisq.test(blockprogram, conf.level=0.99)\$expected
So my question is is it the *conf.level=0.99* where it is wrongly used?

b)I was able to run the one way anova but wasn't able to run on the tukey's
test. I seriously do not know what went wrong... So, this is the original
problem:
The data set chicken.csv contains weights of chickens which are given 1 of 3
different food rations. Perform an ANOVA procedure to determine if the
weights of the chickens are significantly affected by the food rations they
are provided. In case a significant effect exists, perform a Tukey HSD
post-hoc procedure to identify under which ration the chickens will be
heaviest. Use a 5% level of significance.

SO here's the code I used to perform:
attach(chicken)
anova(lm(chicken\$ration~chicken\$weight))
anova.ration <- aov(chicken\$ration~chicken\$weight)
*posthoc.ration <- TukeyHSD(anova.ration, 'weight', conf.level=0.95) => This
is the part where I wasn't able to run :(*
tapply(ration,weight, mean, na.rm=T)
plot(posthoc.weight)

Thanks!

--
View this message in context: http://r.789695.n4.nabble.com/There-is-an-error-when-I-performed-chisquare-and-postanova-test-tp4712770.html
Sent from the R help mailing list archive at Nabble.com.

```