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

Michael Dewey lists at dewey.myzen.co.uk
Fri Sep 25 14:24:12 CEST 2015


Dear massmatics

The list has a no homework policy but in this case I feel I can depart 
from that. Have you tried reading the documentation for chisq.test?

On 25/09/2015 12:44, massmatics wrote:
> 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:
> chicken <- read.csv("C:/Users/Win/Desktop/chicken.csv")
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Michael
http://www.dewey.myzen.co.uk/home.html



More information about the R-help mailing list