Commit 6a88dbcd authored by kunstler's avatar kunstler
Browse files

added lmer with MAT MAP

parent a0277275
......@@ -53,6 +53,7 @@ call.lmer.and.save <- function(formula, df.lmer, path.out,
relgrad <- with(lmer.output@optinfo$derivs,solve(Hessian,gradient))
print('test convergence of relative gradient of hessian')
print(max(abs(relgrad)) )
## conf.param <- confint(lmer.output)
if(is.na(select.biome)){
name.file <- paste(var.sample,ecocode.var,
"results.nolog.all.rds", sep ='.')
......
......@@ -19,26 +19,17 @@ fi
samplesize=$1
"'Seed.mass'" "'Leaf.N'"
# "'Seed.mass'" "'Leaf.N'"
for trait in "'SLA'" "'Wood.density'" "'Max.height'" ; do
# biomes data
# echo "/usr/local/R/R-3.1.1/bin/Rscript -e \"source('R/analysis/lmer.run.R'); run.multiple.model.for.set.one.trait(model.files.lmer.Tf.3[1], run.lmer,$trait, sample.size = $samplesize, var.sample = 'biomes');print('done')\"" > Rscript_temp/allf${trait}.sh
# qsub Rscript_temp/allf${trait}.sh -d ~/trait.competition.workshop -l nodes=1:ppn=1,mem=8gb -N "lmerall2all.f${trait}" -q opt32G -j oe
# echo "/usr/local/R/R-3.1.1/bin/Rscript -e \"source('R/analysis/lmer.run.R'); run.multiple.model.for.set.one.trait(model.files.lmer.Tf.3[2], run.lmer,$trait, sample.size = $samplesize, var.sample = 'biomes');print('done')\"" > Rscript_temp/allf2${trait}.sh
# qsub Rscript_temp/allf2${trait}.sh -d ~/trait.competition.workshop -l nodes=1:ppn=1,mem=8gb -N "lmerall2all.fb${trait}" -q opt32G -j oe
# echo "/usr/local/R/R-3.1.1/bin/Rscript -e \"source('R/analysis/lmer.run.R'); run.multiple.model.for.set.one.trait(model.files.lmer.Tf.3[3], merge.biomes.TF = TRUE, run.lmer,$trait, sample.size = $samplesize, var.sample = 'biomes');print('done')\"" > Rscript_temp/allf3${trait}.sh
# qsub Rscript_temp/allf3${trait}.sh -d ~/trait.competition.workshop -l nodes=1:ppn=1,mem=8gb -N "lmerall2all.fb2${trait}" -q opt32G -j oe
# # ALL data
# echo "/usr/local/R/R-3.1.1/bin/Rscript -e \"source('R/analysis/lmer.run.R'); run.multiple.model.for.set.one.trait(model.files.lmer.Tf.1[1], run.lmer,$trait);print('done')\"" > Rscript_temp/allf${trait}.sh
# qsub Rscript_temp/allf${trait}.sh -d ~/trait.competition.workshop -l nodes=1:ppn=1,mem=8gb -N "lmerall2all.f${trait}" -q opt32G -j oe
echo "/usr/local/R/R-3.1.1/bin/Rscript -e \"source('R/analysis/lmer.run.R'); run.multiple.model.for.set.one.trait(model.files.lmer.Tf.1[1], run.lmer,$trait);print('done')\"" > Rscript_temp/allf${trait}.sh
qsub Rscript_temp/allf${trait}.sh -d ~/trait.competition.workshop -l nodes=1:ppn=1,mem=8gb -N "lmerall2all.f${trait}" -q opt32G -j oe
# echo "/usr/local/R/R-3.1.1/bin/Rscript -e \"source('R/analysis/lmer.run.R'); run.multiple.model.for.set.one.trait(model.files.lmer.Tf.1[2], merge.biomes.TF = TRUE, run.lmer,$trait);print('done')\"" > Rscript_temp/allf2${trait}.sh
# qsub Rscript_temp/allf2${trait}.sh -d ~/trait.competition.workshop -l nodes=1:ppn=1,mem=8gb -N "lmerall2all.f2${trait}" -q opt32G -j oe
echo "/usr/local/R/R-3.1.1/bin/Rscript -e \"source('R/analysis/lmer.run.R'); run.multiple.model.for.set.one.trait(model.files.lmer.Tf.1[2], merge.biomes.TF = TRUE, run.lmer,$trait);print('done')\"" > Rscript_temp/allf2${trait}.sh
qsub Rscript_temp/allf2${trait}.sh -d ~/trait.competition.workshop -l nodes=1:ppn=1,mem=8gb -N "lmerall2all.f2${trait}" -q opt32G -j oe
# # ALL MAT MAP
echo "/usr/local/R/R-3.1.1/bin/Rscript -e \"source('R/analysis/lmer.run.R'); run.multiple.model.for.set.one.trait(model.files.lmer.Tf.3[1], run.lmer,$trait, data.type = 'simple');print('done')\"" > Rscript_temp/allTP${trait}.sh
......
......@@ -21,6 +21,44 @@ data.all <- readRDS(file.path('output', 'processed', "data.all.no.log.rds"))
data.glob <- readRDS(file.path('output', 'processed', "data.all.global.rds"))
library(dplyr)
data.BA.G <- filter(data.all, BA.G < 50 & BA.G >0 & !is.na(BA.G) & BATOT < 150 & !is.na(BATOT))
pdf('figs/MAT.BA.G.pdf', height = 6, width = 12)
a <- fun.hexbin.with.smooth.ggplot(data.BA.G$MAT, data.BA.G$BA.G,
'MAT', 'BA.G')
b <- fun.hexbin.with.smooth.ggplot(data.BA.G$MAP, data.BA.G$BA.G,
'MAP', 'BA.G')
library(ggplot2)
multiplot(a, b,cols=2)
dev.off()
pdf('figs/MAT.MAP.TRAITS.pdf', height = 18, width = 12)
a <- fun.hexbin.with.smooth.ggplot(data.BA.G$MAT, data.BA.G$Wood.density.focal,
'MAT', 'Wood density')
b <- fun.hexbin.with.smooth.ggplot(data.BA.G$MAP, data.BA.G$Wood.density.focal,
'MAP', 'Wood density')
c <- fun.hexbin.with.smooth.ggplot(data.BA.G$MAT, data.BA.G$SLA.focal,
'MAT', 'SLA')
d <- fun.hexbin.with.smooth.ggplot(data.BA.G$MAP, data.BA.G$SLA.focal,
'MAP', 'SLA')
e <- fun.hexbin.with.smooth.ggplot(data.BA.G$MAT, data.BA.G$Max.height.focal,
'MAT', 'Max H')
f <- fun.hexbin.with.smooth.ggplot(data.BA.G$MAP, data.BA.G$Max.height.focal,
'MAP', 'Max height')
multiplot(a, c, e,b, d, f,cols=2)
dev.off()
pdf('figs/BATOT.TRAITS.pdf', height = 12, width = 12)
a <- fun.hexbin.with.smooth.ggplot(data.BA.G$BATOT, data.BA.G$Wood.density.focal,
'BATOT', 'Wood density')
c <- fun.hexbin.with.smooth.ggplot(data.BA.G$BATOT, data.BA.G$SLA.focal,
'BATOT', 'SLA')
e <- fun.hexbin.with.smooth.ggplot(data.BA.G$BATOT, data.BA.G$Max.height.focal,
'BATOT', 'Max H')
multiplot(a, c, e, cols=2)
dev.off()
### compare biomes
data.all$wwf.biomes <- GetBiomes.from.wwf(data.all$wwf)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment