[R-sig-eco] Variation Partitioning - RDA predicted values from spatial component with absence/presence matrix

2014-04-01 Thread amommendes
Dear list members,

I extracted a matrix of predicted values by the pure spatial model (fraction
C in the variation partitioning approach with environmental and spatial
variables [i.e.,Y ~ environmental + spatial]) from a matrix of species
presence/absence as the following example:

require (vegan)
data(mite)
data(mite.env)
data(mite.pcnm)
mite[mite0]-1 # abundance matrix to presence/absence matrix

mod - rda(mite ~ ., data=cbind(mite.pcnm,mite.env))
modEnv- rda (mite~.,mite.env)
predFull- predict(mod)
predEnv-predict (modEnv)
predSpace- predFull-predEnv # predicted values (species occurrence?) 

I would like to know if it would be correct (or even if make sense)
interpret this matrix of predicted values as predicted species occurrences
by pure spatial model.

Thanks in advance,

Amom



--
View this message in context: 
http://r-sig-ecology.471788.n2.nabble.com/Variation-Partitioning-RDA-predicted-values-from-spatial-component-with-absence-presence-matrix-tp7578813.html
Sent from the r-sig-ecology mailing list archive at Nabble.com.

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] residuals in RDA, and test for spatial autocorrelation

2014-04-01 Thread amommendes
Hi Tracy,

You can try this:

require (vegan)

data(mite)
data(mite.env)
data(mite.xy)

mod- rda (mite~., data=mite.env)
res-residuals(mod)

require (spacemakeR)

vario-variogmultiv(res, mite.xy)
plot(vario$d, vario$var, ty='b',pch=20,xlab=Distance, ylab=C(distance))


But, I'm not sure. Maybe to implement spatial variables in the model through
spatial eigenfuncion analysis (e.g., db-MEM, MEM) also could be very useful.

Hope this helps.

Best



--
View this message in context: 
http://r-sig-ecology.471788.n2.nabble.com/residuals-in-RDA-and-test-for-spatial-autocorrelation-tp7578814p7578818.html
Sent from the r-sig-ecology mailing list archive at Nabble.com.

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Selecting spatial variables to distance matrix in capscale

2013-08-21 Thread amommendes
Dear list,

I've a phylobeta diversity matrix (distance matrix) and I intend to analyze
it with db-RDA (capscale {vegan}).
I'm trying to select spatial variables in order to assess the spatial
structure of this matrix with db-RDA (i.e. the spatial predictors at RHS of
the formula in capscale function).

Would be correct to apply a PCoA (cmdscale) in this distance matrix, in
order to test and select the best (smallest AICc) spatial weighting model
through test.W {spacemakeR} function? In other words, I would like use the
site x principal coordinates matrix as a multivariate response matrix in
test.W function (i.e. Y argument).

Here's a code with mite data to exemplify my doubt (however, in this
example, only three MEMs were selected):

library (vegan)
require (spacemakeR)

data(mite)
data(mite.xy)
d- vegdist (mite, bray)
d.pcoa.all- cmdscale (d, k= attr(d, Size) - 1, add=T)
d.pcoa- d.pcoa.all$points # All PCoA's axes will be used, how in capscale.
And it'll be the Y argument in test.W function (i.e. multivariate response
matrix)

d.xy- dist(mite.xy) # Geographic distances
thresh- seq(give.thresh(d.xy), max(d.xy), le=20) # Vector of thresholds of
distances
list.nb- lapply (thresh, dnearneigh, x=as.matrix (mite.xy), d1=0) # List of
neighbourhood matrices

# Testing neighbourhood matrices by test.W
mite.W- lapply (list.nb, test.W, Y=d.pcoa, xy=mite.xy)
minAIC- sapply(mite.W, function (x) min(x$best$AICc, na.rm=T))
min(minAIC) # Smallest AICc
which.min(minAIC) # Number of the best model among 20
thresh[which.min(minAIC)] #Geographic distance of best model among 20

# MEM's selected by the best spatial model (smallest AICc) through test.W
MEMid- mite.W[[4]]$best$ord[1:which.min(mite.W[[4]]$best$AICc)]
sort(MEMid)
MEM.all-mite.W[[4]]$best$vectors
MEM.selected-mite.W[[4]]$best$vectors[,sort(c(MEMid))]
colnames(MEM.selected)-sort(MEMid)

# Plotting MEM selected
par(mfrow=c(1,3))
for (i in 1:ncol(MEM.selected))
s.value(mite.xy, MEM.selected[,i],csize=0.8, clegend=1.5,pch=22, csub=2)

Thanks in advance,

Best,

Amom



--
View this message in context: 
http://r-sig-ecology.471788.n2.nabble.com/Selecting-spatial-variables-to-distance-matrix-in-capscale-tp7578362.html
Sent from the r-sig-ecology mailing list archive at Nabble.com.

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology