User Tools

Site Tools


en:expl_var_rscript

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:expl_var_rscript [2019/02/10 12:57]
David Zelený created
en:expl_var_rscript [2019/02/10 12:58] (current)
David Zelený
Line 42: Line 42:
 points (adj.r2.mean ~ vars, data = samp.vars.r2[samp.vars.r2$samp == 100,], cex = 2, pch = 21, col = '​black',​ bg = '​white',​ type = '​b',​ lty = '​dashed',​ lwd = 2) points (adj.r2.mean ~ vars, data = samp.vars.r2[samp.vars.r2$samp == 100,], cex = 2, pch = 21, col = '​black',​ bg = '​white',​ type = '​b',​ lty = '​dashed',​ lwd = 2)
 legend ('​topright',​ legend = c(expression (italic (R)^2, italic (R)[adj]^2)),​ cex = 2, pch = c(21,21), col = c('​black',​ '​black'​),​ pt.bg = c('​black',​ '​white'​),​ lty = c('​solid',​ '​dashed'​),​ bty = '​n',​ lwd = 2) legend ('​topright',​ legend = c(expression (italic (R)^2, italic (R)[adj]^2)),​ cex = 2, pch = c(21,21), col = c('​black',​ '​black'​),​ pt.bg = c('​black',​ '​white'​),​ lty = c('​solid',​ '​dashed'​),​ bty = '​n',​ lwd = 2)
 +dev.off ()
 +</​code>​
 +
 +<code rsplus>
 +# comparison of variation explained by soil pH on Vltava data vs variation represented by the first axes of unconstrained ordination
 +
 +library (vegan)
 +library (weimea)
 +data (vltava)
 +
 +spe.hell <- decostand (log1p (vltava$spe),​ method = '​hell'​)
 +tbRDA <- rda (spe.hell ~ pH, vltava$env)
 +tbPCA <- rda (spe.hell)
 +
 +tbRDA
 +tbPCA
 +
 +tot.var <- tbPCA$CA$tot.chi
 +tbRDA_RDA1 <- tbRDA$CCA$eig[1]
 +tbRDA_PCA1 <- tbRDA$CA$eig[1]
 +tbPCA_PCA1 <- tbPCA$CA$eig[1]
 +tbPCA_PCA2 <- tbPCA$CA$eig[2]
 +
 +png ('​tbRDA-vs-tbPCA.png',​ width = 8, height = 4, units = '​in',​ res = 300)
 +par (mfrow = c(1,2))
 +ordiplot (tbRDA, xlab = paste ('RDA1 (', round (tbRDA_RDA1/​tot.var*100,​ 1), '​%)',​ sep = ''​),​ ylab = paste ('PC1 (', round (tbRDA_PCA1/​tot.var*100,​ 1), '​%)',​ sep = ''​),​ main = '​tb-RDA'​)
 +ordiplot (tbPCA, xlab = paste ('PC1 (', round (tbPCA_PCA1/​tot.var*100,​ 1), '​%)',​ sep = ''​),​ ylab = paste ('PC2 (', round (tbPCA_PCA2/​tot.var*100,​ 1), '​%)',​ sep = ''​),​ main = '​tb-PCA'​)
 dev.off () dev.off ()
 </​code>​ </​code>​
en/expl_var_rscript.txt · Last modified: 2019/02/10 12:58 by David Zelený