Hello, I am VERY new to R, just picking it up infact. I have got my head around the basics of ANOVA with post hoc tests but I am struggling with regression, especially with ANCOVAs. I have two sets of data, one of type A, one of type B. Both have been placed in a wind tunnel and sampled every week. The co variate is of course the days since the start. An example is day A B 0 10.0 10.0 7 9.0 9.1 14 8.0 8.2 21 7.0 7.3 28 6.0 6.4 35 5.0 5.5 42 4.0 4.5 49 3.0 3.6 56 2.0 2.7 I have been able to do ANOVA on similar data without a co variate, everyone else seems to use ANCOVAs very different to how I do, either that or I am the only one doing something this simple. Could anyone please explain how to perform the analysis, I currently have the data in R in a data frame I have called anco. Thanks for any help. Tom -- View this message in context: r.789695.n4.nabble.com/ANCOVA-in-R-single-CoVar-two-Variables-tp2173850p2173850.html Sent from the R help mailing list archive at Nabble.com.
I recommend the ancova function in the HH package. install.packages("HH") library(HH) example(ancova) ?ancova For your example, tmp <- textConnection( "day A B 0 10.0 10.0 7 9.0 9.1 14 8.0 8.2 21 7.0 7.3 28 6.0 6.4 35 5.0 5.5 42 4.0 4.5 49 3.0 3.6 56 2.0 2.7") anco <- read.table(tmp, header=TRUE) close.connection(tmp) wind <- data.frame(day=rep(anco$day, 2), y=c(anco$A, anco$B), type=rep(c("A","B"), each=9)) ancova(y ~ day + type, data=wind) Rich [[alternative HTML version deleted]]
Thankyou all for the replies! I am sure you can guess the next question that is coming... I expanded the code (and the data set) to now include a third type "C", which I made VERY similar to A: anco <- read.table(tmp, header=TRUE) close.connection(tmp) wind <- data.frame(day=rep(anco$day, 3), y=c(anco$A, anco$B, anco$C), type=rep(c("A","B","C"), each=9)) ancova(y ~ day + type, data=wind) But of course then the type summary only shows significance for all three (or four or five if I add them, which I will have to do for my application) as you can see in the output. Response: y Df Sum Sq Mean Sq F value Pr(>F) day 1 165.888 165.888 661.0229 <2e-16 *** type 2 0.140 0.070 0.2789 0.7591 Residuals 23 5.772 0.251 Now I know that when you do just an ANOVA you get this kind of result, which then leads you on to post hoccing the data (is it spelt hoccing or hocing?). Is that the way to go or is a slight modification of the code the way to go? I am very new to R and not that good at Stats and I am not sure exactly how to approach this problem now (they didnt even teach us ANCOVAs at university, either that or I slept through that lecture). Thanks again for all the great help! Tom -- View this message in context: r.789695.n4.nabble.com/ANCOVA-in-R-single-CoVar-two-Variables-tp2173850p2195734.html Sent from the R help mailing list archive at Nabble.com.