Skip to content
Snippets Groups Projects
Commit b8585429 authored by Francesco Sabatini's avatar Francesco Sabatini
Browse files

Corrected 99 - trait permutation

parent bab795d8
No related branches found
No related tags found
No related merge requests found
......@@ -110,7 +110,7 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
corXY.output <- foreach(i=1:length(allcomb.t), .combine=rbind) %myinfix% {
tt <- unlist(allcomb.t[i])
corXY.output <- rbind(corXY.output,
get.corXY.bootstrap(comm=species, trait=traits,
myfunction(comm=species, trait=traits,
trait.sel=tt, bootstrap=nperm))
}
save(corXY.output, file = paste(output,"_", chunk.i, "_.RData", sep=""))
......
......@@ -89,14 +89,15 @@ get.corXY.bootstrap <- function(comm, traits, trait.sel="all", bootstrap=199){
for(b in 1:bootstrap){
#RV.tmp <- RV.rtest(W.beals[index.bootstr[[b]],], as.data.frame(syn.out.tmp)[index.bootstr[[b]],])
RD.tmp <- dcor(W.beals[index.bootstr[[b]],], as.data.frame(syn.out.tmp)[index.bootstr[[b]],])^2
syn.out.perm.tmp <- matrix.x(comm=comm, traits=traits[index.traits[[bootstrap]],ii,drop=F],
syn.out.perm.tmp <- matrix.x(comm=comm, traits=traits[index.traits[[b]],ii,drop=F],
scale=T)$matrix.X #, asym.bin=binary.traits
#RV.perm.tmp <- RV.rtest(W.beals[index.bootstr[[b]],], as.data.frame(syn.out.perm.tmp)[index.bootstr[[b]],])
RD.perm.tmp <- dcor(W.beals[index.bootstr[[b]],], as.data.frame(syn.out.perm.tmp)[index.bootstr[[b]],])^2
corXY <- rbind(corXY,
data.frame(Trait.comb=lab.tmp, bootstr.n=b, Test="RD",
Coef.obs=RD.tmp, Coef.perm=RD.perm.tmp))
if(b %in% round(seq(1,bootstrap, length.out=10))){print(paste("trait", paste0(ii, collapse="_"), "perm", b))}
if(b %in% round(seq(1,bootstrap, length.out=10))){
print(paste("trait", paste0(ii, collapse="_"), "perm", b, paste(colnames(traits[trait.sel]), collapse="+")))}
}
return(corXY)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment