User Tools

Site Tools


en:fourthcorner_examples_rscript

FIXME

load (url ('https://raw.githubusercontent.com/zdealveindy/anadat-r/master/data/vltava.r'))
 
# fourthcorner analysis
 
spe <- log1p (vltava$herbs$spe)
env <- vltava$env[, c(1:4, 11:13)]
traits <- vltava$herbs$traits
 
library (ade4)
 
traits.na <- na.omit (traits)
traits.na$plant.height <- log10 (traits.na$plant.height)
traits.na$seed.weight <- log10 (traits.na$seed.weight)
select.species <- rownames (traits) %in% rownames (traits.na)
spe.na <- spe[,select.species]
 
 
 
fc <- fourthcorner (tabR = env, tabL = spe[,select.species], tabQ = traits[select.species,], p.adjust.method.G = 'none', p.adjust.method.D = 'none')
 
plot (fc, alpha = 0.1, stat = "D2")
 
 
library (weimea)
cwm <- wm (sitspe = spe, speatt = traits)
modif.cwm <- test.MR (cwm, env = env, test = 'modif')
 
modif.cwm.df <- do.call (rbind.data.frame, modif.cwm$out)
p.adjust (modif.cwm.df$P.mod, method = 'fdr')
 
 
dudiL <- dudi.coa (spe.na, scannf = FALSE)
dudiR <- dudi.pca (env, scannf = FALSE, row.w = dudiL$lw)
dudiQ <- dudi.pca (traits.na, scannf = FALSE, row.w = dudiL$cw)
vlt.rlq <- rlq (dudiR = dudiR, dudiL = dudiL, dudiQ = dudiQ, scannf = FALSE)
plot (vlt.rlq)
en/fourthcorner_examples_rscript.txt · Last modified: 2018/04/09 16:28 by David Zelený