[R] R - box design-scatter plot für means/regression/lme?

Karrer Stefanie karrers at student.ethz.ch
Fri Sep 11 09:54:38 CEST 2009


Dear All!

It's now weeks that I'm going crazy with R, and as I'm a new user I now ask for help (also because I still have only a few days to finish..)...
So shortly I describe you my Experiment in which I was looking for the decomposition of herbivore dung under different treatments:
I made a box design experiment which is structured in the following way:
I collected dung from 2  species (Wildebeest and Giraffe) and put for each species 8 pellets in different pots. I used 2 water treatments for the pots: wet (by adding water) and dry and two shadow treatments: shadow and sun.
So the design for 1 box was looking as follow:
1 Box (Sun or Shadow):
1 giraffe dung - wet
1 giraffe dung - dry
1 wildebeest dung - wet
1 wildebeest dung - dry
 --> total 10 Boxen (5 shadow, 5 sun)

Now, for each treatment I took out 2 pellets which I then measured fr different variables. I did this at 3 time point: 0, 6 and 12 days after set up.

So I have now following Data:
Giraffe dung: wet/ dry treatment under shadow/sun condition, 3 collection times, always 5 Replikate
Same for the Wildebeest dung.
For the pellets I measured following variables:
DW.P = dry weight pro pellet
WL= water loss
Ctot= total carbon
Ntot=total nitrogen

Now, for my statistics I used:
lme(Y ~ Day*water.T*shadow.T*dung.T, random=~Day|Box/Pot)

but apperently I have to fit a linear correlation for Day, so that Day is not seen as a Factor.. How have I to do that?
Something Day <- corr(Day*Y)?

Then I also have to calculate the regressions for Ctot and Ntot to get the slopes. I tried with:

slope <- function(x) {-summary(lm(log(x)~c(1,6,12)))$coefficients[2,1]}
Reg.Slopes <- aggregate(DW.P, list(shadow.T=shadow.T, water.T=water.T,Species=Species,Pot=ID),slope)

...but it doesn't work...

And finally to my plots. I need scatter plots of the means of the different measured variables with the sd bar. I found out there is a code "plotmeans" but I don't know how to use it with my data... And also how to put the Titles and Subtitles in the right way, as the x and y axes...

I'm sorry for the long mail, but I'm really desperate!
Thank you very very very much,
Stefanie






More information about the R-help mailing list