Genstat into R - Randomisation test
Hello everybody,
I have a question. I would like to get a correlation between
constitutive and induced plant defence which I messured on 30 plant
species. So I have table with Species, Induced defence (ID), and
constitutive defence (CD). Since Induced and constitutive defence are
not independant (so called spurious correlation) I should do a
randomisation test. I have a syntax of my supervisor in Genstat, but I
would really like to try this in R.
"data from trade-off.IDCD"
list
variate [nval=1000] slope
calc ID1=ID
graph ID; CD
calc b=corr(ID; CD)
calc slope$[1]=b
"slope$[1] is the correlation before permutating the data"
for i=2...1000
randomize ID1
calc b=corr(CD1; ID1)
calc slope$[i]=b
endfor
hist slope
describe slope
quantile [proportion=!(0.0005,0.005, 0.025, 0.975, 0.995,0.9995)]slope
print slope$[1]
corr[p=corr] ID,CD
DHISTOGRAM [WINDOW=1; ORIENTATION=vertical; KEY=0; BARCOVERING=1.0]
slope; PEN=2
Does anybody have done something similar and has any idea how to make
the randomisation part?
I would be very grateful for any help!!
Thanks in advance,
Anne
Anne Kempel Institute of Plant Sciences University of Bern Altenbergrain 21 CH-3103 Bern kempel at ips.unibe.ch