Commit 4516d3ce authored by Georges Kunstler's avatar Georges Kunstler
Browse files

knitr working

parent 12ab032f
......@@ -30,25 +30,11 @@ run.model.for.set.one.trait <- function(model.file, fun.model, trait,
#=====================================================================
model.files.glmer.Tf.1 <-
c("R/analysis/model.glmer/model.glmer.LOGLIN.ER.Tf.R")
model.files.glmer.Tf.2 <-
c("R/analysis/model.glmer/model.glmer.LOGLIN.nocomp.Tf.R",
## "R/analysis/model.glmer/model.glmer.LOGLIN.AD.Tf.R",
"R/analysis/model.glmer/model.glmer.LOGLIN.ER.AD.Tf.R",
"R/analysis/model.glmer/model.glmer.LOGLIN.simplecomp.Tf.R")
model.files.glmer.Tf.3 <-
c("R/analysis/model.glmer/model.glmer.LOGLIN.ER.Tf.MAT.MAP.R")
model.files.glmer.Tf.4 <-
c("R/analysis/model.glmer/model.glmer.LOGLIN.nocomp.Tf.MAT.MAP.R",
## "R/analysis/model.glmer/model.glmer.LOGLIN.AD.Tf.MAT.MAP.R",
"R/analysis/model.glmer/model.glmer.LOGLIN.ER.AD.Tf.MAT.MAP.R",
"R/analysis/model.glmer/model.glmer.LOGLIN.simplecomp.Tf.MAT.MAP.R")
c("R/analysis/model.glmer/model.glmer.LOGLIN.ER.AD.Tf.r.species.R")
### TODO ER QND QD TO CHQNGE NEED TO ADD CAT
fun.call.glmer.and.save <- function(formula, df.lmer, path.out){
fun.call.glmer.and.save <- function(formula, df.glmer, path.out, var.sample){
library(MASS)
logexp <- function(exposure = 1)
{
......@@ -74,22 +60,26 @@ logexp <- function(exposure = 1)
class = "link-glm")
}
Start <- Sys.time()
## glmer.output <- glmer(formula = formula, data = df.lmer,
## glmer.output <- glmer(formula = formula, data = df.glmer,
## family = binomial(link = 'cloglog'))
glmer.output <- glmer(formula = formula, data = df.lmer,
family = binomial(link = logexp(exp(df.lmer$logyear))))
glmer.output <- glmer(formula = formula, data = df.glmer,
family = binomial(link = logexp(exp(df.glmer$logyear))))
end <- Sys.time()
print(end - Start)
print(summary(glmer.output))
# add starting value ? start = list(theta = 1, fixef = c(1, 0))
summary(mfit_glmer)
saveRDS(glmer.output, file = file.path(path.out, "glmer.results.global.rds"))
saveRDS(glmer.output,
file = file.path(path.out,
paste(var.sample,
"glmer.results.global.rds", sep = '.')))
}
run.glmer <- function (model.file, trait,
min.obs = 5, sample.size = NA,
type.filling, fname , cat.TF) {
min.obs = 5, sample.size = NA,
type.filling, fname , cat.TF,
var.sample = 'ecocode.id') {
require(lme4)
source(model.file, local = TRUE)
model <- load.model()
......@@ -105,10 +95,15 @@ run.glmer <- function (model.file, trait,
trait, "\n")
df.glmer <- load.data.for.glmer(trait,
fname = fname,
cat.TF = cat.TF) # return a DF
cat.TF = cat.TF,
sample.size = sample.size,
var.sample = var.sample) # return a DF
cat("Ok data with Nobs", nrow(df.glmer), "\n")
#= Run model
fun.call.glmer.and.save(formula = model$glmer.formula, df.glmer, path.out)
fun.call.glmer.and.save(formula = model$glmer.formula,
df.glmer = df.glmer,
path.out = path.out,
var.sample = var.sample)
}
#========================================================================
......@@ -117,62 +112,63 @@ output.dir.glmer <- function (dir, model, trait, type.filling) {
file.path("output/glmer", dir, trait, type.filling, model)
}
fun.load.data.all <- function(base.dir, fname){
data.all.sample <- read.csv(file = file.path(base.dir, fname),
stringsAsFactors = FALSE, nrows = 1000)
classes <- sapply(data.all.sample, class)
classes[classes=='integer'] <- "numeric"
nrows <- as.numeric(system(paste('wc -l < ', file.path(base.dir, fname)),
intern = TRUE))
data.tree.tot <- read.csv(file = file.path(base.dir, fname),
stringsAsFactors = FALSE,
nrows = nrows,
colClasses = classes)
return(data.tree.tot)
}
#============================================================
# Function to prepare data for lmer
#============================================================
load.data.for.glmer <- function(trait, cat.TF = FALSE,
fname = 'data.all.no.log.csv',
base.dir = "output/processed/"){
### load data
if (fname == 'data.all.no.log.csv') type <- 'no.log'
if (fname == 'data.all.csv') type <- 'log'
## add sample equivalent per ecocode
add.sampling.prob.by.var.sample <- function(df, var.sample){
vec.prob <- 1/table(df[[var.sample]])
return(df)
}
load.data.for.glmer <- function(trait, cat.TF,
fname = 'data.all.no.log.rds',
base.dir = "output/processed",
sample.size ,
var.sample = 'ecocode.id'){
if (fname == 'data.all.no.log.rds') type <- 'no.log'
if (fname == 'data.all.log.rds') type <- 'log'
if (cat.TF) cat <- 'cat'
if (!cat.TF) cat <- 'no.cat'
df <- readRDS(file = file.path(base.dir,paste('data.glmer', trait, type, cat,'rds',
sep = '.')))
df <- readRDS(file = file.path(base.dir,
paste('data.glmer', trait, type,
cat,'rds', sep = '.')))
return(df)
if(!is.na(sample.size)){
df$species.id[is.na(df$species.id)] <- 'missing.sp'
df <- add.sampling.prob.by.var.sample(df, var.sample = var.sample)
df <- df[sample(1:nrow(df), size = sample.size,
prob = df$prob.sample), ]
print(paste('sub-sampled by',var.sample))
}
return( df)
}
load.and.save.data.for.glmer <- function(trait,
min.obs = 10, sample.size = NA,
type.filling = 'species',
fname = 'data.all.no.log.csv',
base.dir = "output/processed/",
cat.TF = FALSE){
### load data
data.tree.tot <- fun.load.data.all(base.dir, fname)
if (fname == 'data.all.no.log.csv') type <- 'no.log'
if (fname == 'data.all.csv') type <- 'log'
min.obs= 10,
type.filling = species,
cat.TF= FALSE,
fname = 'data.all.no.log.rds',
base.dir = "output/processed",
data.table.TF = FALSE){
data.tree.tot <- readRDS(file.path(base.dir, fname))
df <- fun.data.for.glmer(data.tree.tot, trait,
type.filling = type.filling,
cat.TF = cat.TF)
if (fname == 'data.all.no.log.rds') type <- 'no.log'
if (fname == 'data.all.log.rds') type <- 'log'
if (cat.TF) cat <- 'cat'
if (!cat.TF) cat <- 'no.cat'
saveRDS(df,file = file.path(base.dir,paste('data.glmer', trait, type, cat,'rds',
sep = '.')))
}
df <- fun.data.for.glmer(data.tree.tot,trait, type.filling = type.filling,
cat.TF = cat.TF)
saveRDS(df, file = file.path(base.dir, paste('data.glmer', trait,
type, cat,'rds',
sep = '.')))
}
fun.select.data.for.analysis <- function(data.tree, abs.CWM.tntf,
perc.neigh.sp,
......
......@@ -801,3 +801,13 @@ plot(1,1,pch = NA, xaxt = 'n', yaxt = 'n')
legend("center",legend = names(col.vec), col = col.vec, pch = pch.vec,
bty = 'n')
}
##
fun.get.conv <- function(list.res.lme4){
cbind(opt = unlist(lapply(list.res.lme4,
function(x) x$lmer.summary$conv$opt)),
lme4 = unlist(lapply(list.res.lme4,
function(x) x$lmer.summary$conv$lme4$code)))
}
......@@ -3,18 +3,6 @@
### FUNCTION TO RUN LMER ESTIMATION WITH NO logBA for all in one big model
library(lme4)
mem <- function() {
bit <- 8L * .Machine$sizeof.pointer
if (!(bit == 32L || bit == 64L)) {
stop("Unknown architecture", call. = FALSE)
}
node_size <- if (bit == 32L) 28L else 56L
usage <- gc()
sum(usage[, 1] * c(node_size, 8)) / (1024 ^ 2)
}
run.multiple.model.for.set.one.trait <- function(model.files, fun.model, trait,
type.filling, cat.TF = FALSE,
......@@ -40,32 +28,26 @@ run.model.for.set.one.trait <- function(model.file, fun.model, trait,
#=====================================================================
model.files.lmer.Tf.1 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.R")
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.r.species.R")
model.files.lmer.Tf.2 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.MAT.MAP.R")
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.MAT.MAP.r.species.R")
model.files.lmer.Tf.3 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.r.species.R")
model.files.lmer.Tf.4 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.r.biomes.R")
model.files.lmer.Tf.4b <-
model.files.lmer.Tf.3 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.r.biomes.species.R")
model.files.lmer.Tf.4c <-
model.files.lmer.Tf.4 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.r.ecocode.species.R")
model.files.lmer.Tf.5 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.norandom.R")
model.files.lmer.Tf.6 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.MAT.MAP.norandom.R")
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.MAT.MAP.r.biomes.species.R")
model.files.lmer.Tf.CAT.1 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.CAT.R")
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.CAT.r.species.R")
model.files.lmer.Tf.CAT.2 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.CAT.norandom.R")
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.CAT.r.biomes.species.R")
model.files.lmer.Tf.CAT.3 <-
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.CAT.MAT.MAP.norandom.R")
c("R/analysis/model.lmer/model.lmer.LOGLIN.ER.AD.Tf.CAT.MAT.MAP.r.species.R")
fun.call.lmer.and.save <- function(formula, df.lmer, path.out,
var.sample){
......@@ -100,7 +82,6 @@ run.lmer <- function (model.file, trait,
cat("Ok data with Nobs", nrow(df.lmer),
"\n")
print(mem())
#= Run model
fun.call.lmer.and.save(formula = model$lmer.formula.tree.id,
df.lmer, path.out = path.out,
......@@ -155,7 +136,7 @@ return( df)
}
load.and.save.data.for.lmer <- function(trait,
min.obs= 10, sample.size = NA,
min.obs= 10,
type.filling = species,
cat.TF= FALSE,
fname = 'data.all.no.log.rds',
......
load.model <- function () {
list(name="glmer.LOGLIN.ER.AD.Tf.r.species",
glmer.formula=formula("dead~1+Tf+logD+(1|species.id)+(logD-1|species.id)+(sumBn-1|species.id)+(1|plot.id)+(1|set.id)+sumBn+sumTfBn+sumTnBn+sumTnTfBn.abs"),
glmer.formula.offset=formula("dead~1+offset(logyear)+Tf+logD+(1|species.id)+(logD-1|species.id)+(sumBn-1|species.id)+(1|plot.id)+(1|set.id)+sumBn+sumTfBn+sumTnBn+sumTnTfBn.abs")
)
}
load.model <- function () {
list(name="lmer.LOGLIN.ER.AD.Tf.CAT.MAT.MAP.norandom",
lmer.formula.tree.id=formula("logG~1+(1|set.id)+(1|plot.id)+MAT+MAP+Tf.A_EV+Tf.A_EV:MAT+Tf.A_EV:MAP+Tf.A_D+Tf.A_D:MAT+Tf.A_D:MAP+Tf.C+Tf.C:MAT+Tf.C:MAP+logD+sumBn+sumBn:MAT+sumBn:MAP+sumTfBn.A_EV+sumTfBn.A_EV:MAT+sumTfBn.A_EV:MAP+sumTfBn.A_D+sumTfBn.A_D:MAT+sumTfBn.A_D:MAP+sumTfBn.C+sumTfBn.C:MAT+sumTfBn.C:MAP+sumTnBn.A_EV+sumTnBn.A_EV:MAT+sumTnBn.A_EV:MAP+sumTnBn.A_D+sumTnBn.A_D:MAT+sumTnBn.A_D:MAP+sumTnBn.C+sumTnBn.C:MAT+sumTnBn.C:MAP+sumTnTfBn.abs+sumTnTfBn.abs:MAT+sumTnTfBn.abs:MAP+(1+logD|species.id)"))
list(name="lmer.LOGLIN.ER.AD.Tf.CAT.MAT.MAP.r.species",
lmer.formula.tree.id=formula("logG~1+(1|set.id)+(1|plot.id)+MAT+MAP+Tf.A_EV+Tf.A_EV:MAT+Tf.A_EV:MAP+Tf.A_D+Tf.A_D:MAT+Tf.A_D:MAP+Tf.C+Tf.C:MAT+Tf.C:MAP+logD+sumBn+sumBn:MAT+sumBn:MAP+sumTfBn.A_EV+sumTfBn.A_EV:MAT+sumTfBn.A_EV:MAP+sumTfBn.A_D+sumTfBn.A_D:MAT+sumTfBn.A_D:MAP+sumTfBn.C+sumTfBn.C:MAT+sumTfBn.C:MAP+sumTnBn.A_EV+sumTnBn.A_EV:MAT+sumTnBn.A_EV:MAP+sumTnBn.A_D+sumTnBn.A_D:MAT+sumTnBn.A_D:MAP+sumTnBn.C+sumTnBn.C:MAT+sumTnBn.C:MAP+sumTnTfBn.abs+sumTnTfBn.abs:MAT+sumTnTfBn.abs:MAP+(1|species.id)+(logD-1|species.id)+(sumBn-1|species.id)"))
}
......
load.model <- function () {
list(name="lmer.LOGLIN.ER.AD.Tf.CAT.MAT.MAP.r.species",
lmer.formula.tree.id=formula("logG~1+(1|set.id)+(1|plot.id)+MAT+MAP+Tf.A_EV+Tf.A_EV:MAT+Tf.A_EV:MAP+Tf.A_D+Tf.A_D:MAT+Tf.A_D:MAP+Tf.C+Tf.C:MAT+Tf.C:MAP+logD+sumBn+sumBn:MAT+sumBn:MAP+sumTfBn.A_EV+sumTfBn.A_EV:MAT+sumTfBn.A_EV:MAP+sumTfBn.A_D+sumTfBn.A_D:MAT+sumTfBn.A_D:MAP+sumTfBn.C+sumTfBn.C:MAT+sumTfBn.C:MAP+sumTnBn.A_EV+sumTnBn.A_EV:MAT+sumTnBn.A_EV:MAP+sumTnBn.A_D+sumTnBn.A_D:MAT+sumTnBn.A_D:MAP+sumTnBn.C+sumTnBn.C:MAT+sumTnBn.C:MAP+sumTnTfBn.abs+sumTnTfBn.abs:MAT+sumTnTfBn.abs:MAP+(1|species.id)+(logD-1|species.id)+(sumBn-1|species.id)"))
}
load.model <- function () {
list(name="lmer.LOGLIN.ER.AD.Tf.MAT.MAP.r.biomes.species",
lmer.formula.tree.id=formula("logG~1+(1|plot.id)+Tf+Tf:MAT+Tf:MAP+MAT+MAP+logD+sumBn+sumBn:MAT+sumBn:MAP+sumTfBn+sumTfBn:MAT+sumTfBn:MAP+sumTnBn+sumTnBn:MAT+sumTnBn:MAP+sumTnTfBn.abs+sumTnTfBn.abs:MAT+sumTnTfBn.abs:MAP+(1|species.id)+(logD-1|species.id)+(sumBn-1|species.id)+(MAT-1|species.id)+(MAP-1|species.id)+(Tf-1|biomes.id)+(sumBn-1|biomes.id)+(sumTfBn-1|biomes.id)+(sumTnBn-1|biomes.id)+(sumTnTfBn.abs-1|biomes.id)"))
}
## % Compare output of growth model with lmer for 3 diffferent subsampling
## source(file.path(system("git rev-parse --show-toplevel", intern=TRUE)),
## "R/utils-paths.R")
## to deal with the mess in the path
## This deals with some path issues.
git.root <- function() {
system("git rev-parse --show-toplevel", intern=TRUE)
......@@ -14,22 +12,35 @@ readRDS.root <- function(filename) {
readRDS(file.path(git.root(), filename))
}
path.root <- git.root()
source.root("R/analysis/lmer.output-fun.R")
source.root("R/analysis/lmer.run.R")
source.root("R/utils/plot.R")
## load results of a fit with 200000 observations
## load results of a fit with 700000 observations
## resampling with no weights
list.all.results.obs.id <- readRDS.root('output/list.lmer.out.all.obs.id.no.log.rds')
list.all.results.obs.id <-
readRDS.root('output/list.lmer.out.all.obs.id.no.log.rds')
## resampling with weights equal to inverse focal species abundance
list.all.results.species.id <- readRDS.root('output/list.lmer.out.all.species.id.no.log.rds')
list.all.results.species.id <-
readRDS.root('output/list.lmer.out.all.species.id.no.log.rds')
## resampling with weights equal to inverse focal ecocode abundance
list.all.results.ecocode.id <- readRDS.root('output/list.lmer.out.all.ecocode.id.no.log.rds')
list.all.results.ecocode.id <-
readRDS.root('output/list.lmer.out.all.ecocode.id.no.log.rds')
## check convergence
fun.get.conv(list.all.results.obs.id)
fun.get.conv(list.all.results.species.id)
fun.get.conv(list.all.results.ecocode.id)
## there is convergence problem with all models. In generatl the optimizer has
## converge but lme4 report some error. Which gives only warnings.
## Need to try to re-run with control=lmerControl(optimizer="bobyqa")
## Plot param estimates with biomes random effect for resampling with no weights
plot.param.BLUP(list.all.results.obs.id ,
......@@ -40,7 +51,8 @@ plot.param.BLUP(list.all.results.obs.id ,
col.vec = col.vec.biomes,
pch.vec = pch.vec.biomes)
## Plot param estimates with biomes random effect for resampling with weights per species
## Plot param estimates with biomes random effect for resampling with
## weights per species
plot.param.BLUP(list.all.results.species.id ,
model = 'lmer.LOGLIN.ER.AD.Tf.r.biomes.species',
traits = c('Wood.density', 'SLA', 'Max.height'),
......@@ -58,9 +70,20 @@ plot.param.BLUP(list.all.results.ecocode.id ,
"sumTfBn", "sumTnTfBn.abs"),
col.vec = col.vec.biomes,
pch.vec = pch.vec.biomes)
## Are the results very different depending on the subsampling ?
## NOT extremely different. Overall with a subsampling without
## weight the CI are larger!
## Not really the main difference is that the estimate are largely different
## from the previous version of lme4
## This is very strange how the confidence interval change depending on the
## subsampling of the data. This is also largely different between a subsampling of
## 500 000 and 700 000.
## subsampling of the data. This is also largely different between a subsampling
## of 700 000.
## ![Old lme4 no weight](/home/kunstler/Documents/currentwork/Dropbox/westobyLAB/workshop/data.processing2/trait.competition.workshop/figs/fig1.png)
## ![Old lme4 weight species](/home/kunstler/Documents/currentwork/Dropbox/westobyLAB/workshop/data.processing2/trait.competition.workshop/figs/fig2.png)
## ![Old lme4 weight ecocode](/home/kunstler/Documents/currentwork/Dropbox/westobyLAB/workshop/data.processing2/trait.competition.workshop/figs/fig3.png)
% Compare output of growth model with lmer for 3 diffferent subsampling
source(file.path(system("git rev-parse --show-toplevel", intern=TRUE)),
"R/utils-paths.R")
to deal with the mess in the path
This deals with some path issues.
``` {r }
git.root <- function() {
......@@ -15,29 +13,44 @@ readRDS.root <- function(filename) {
readRDS(file.path(git.root(), filename))
}
path.root <- git.root()
source.root("R/analysis/lmer.output-fun.R")
source.root("R/analysis/lmer.run.R")
source.root("R/utils/plot.R")
```
load results of a fit with 200000 observations
load results of a fit with 700000 observations
resampling with no weights
``` {r }
list.all.results.obs.id <- readRDS.root('output/list.lmer.out.all.obs.id.no.log.rds')
list.all.results.obs.id <-
readRDS.root('output/list.lmer.out.all.obs.id.no.log.rds')
```
resampling with weights equal to inverse focal species abundance
``` {r }
list.all.results.species.id <- readRDS.root('output/list.lmer.out.all.species.id.no.log.rds')
list.all.results.species.id <-
readRDS.root('output/list.lmer.out.all.species.id.no.log.rds')
```
resampling with weights equal to inverse focal ecocode abundance
``` {r }
list.all.results.ecocode.id <- readRDS.root('output/list.lmer.out.all.ecocode.id.no.log.rds')
list.all.results.ecocode.id <-
readRDS.root('output/list.lmer.out.all.ecocode.id.no.log.rds')
```
check convergence
``` {r }
fun.get.conv(list.all.results.obs.id)
fun.get.conv(list.all.results.species.id)
fun.get.conv(list.all.results.ecocode.id)
```
there is convergence problem with all models. In generatl the optimizer has
converge but lme4 report some error. Which gives only warnings.
Need to try to re-run with control=lmerControl(optimizer="bobyqa")
Plot param estimates with biomes random effect for resampling with no weights
``` {r }
......@@ -50,7 +63,8 @@ plot.param.BLUP(list.all.results.obs.id ,
pch.vec = pch.vec.biomes)
```
Plot param estimates with biomes random effect for resampling with weights per species
Plot param estimates with biomes random effect for resampling with
weights per species
``` {r }
plot.param.BLUP(list.all.results.species.id ,
model = 'lmer.LOGLIN.ER.AD.Tf.r.biomes.species',
......@@ -72,9 +86,20 @@ plot.param.BLUP(list.all.results.ecocode.id ,
col.vec = col.vec.biomes,
pch.vec = pch.vec.biomes)
```
Are the results very different depending on the subsampling ?
NOT extremely different. Overall with a subsampling without
weight the CI are larger!
Not really the main difference is that the estimate are largely different
from the previous version of lme4
This is very strange how the confidence interval change depending on the
subsampling of the data. This is also largely different between a subsampling of
500 000 and 700 000.
subsampling of the data. This is also largely different between a subsampling
of 700 000.
![Old lme4 no weight](/home/kunstler/Documents/currentwork/Dropbox/westobyLAB/workshop/data.processing2/trait.competition.workshop/figs/fig1.png)
![Old lme4 weight species](/home/kunstler/Documents/currentwork/Dropbox/westobyLAB/workshop/data.processing2/trait.competition.workshop/figs/fig2.png)
![Old lme4 weight ecocode](/home/kunstler/Documents/currentwork/Dropbox/westobyLAB/workshop/data.processing2/trait.competition.workshop/figs/fig3.png)
% Compare output of growth model with lmer for 3 diffferent subsampling
source(file.path(system("git rev-parse --show-toplevel", intern=TRUE)),
"R/utils-paths.R")
to deal with the mess in the path
This deals with some path issues.
```r
......@@ -16,6 +14,7 @@ readRDS.root <- function(filename) {
readRDS(file.path(git.root(), filename))
}
path.root <- git.root()
source.root("R/analysis/lmer.output-fun.R")
```
......@@ -32,7 +31,7 @@ source.root("R/utils/plot.R")
```
load results of a fit with 200000 observations
load results of a fit with 700000 observations
resampling with no weights
......@@ -47,18 +46,84 @@ resampling with weights equal to inverse focal species abundance
list.all.results.species.id <- readRDS.root("output/list.lmer.out.all.species.id.no.log.rds")
```
resampling with weights equal to inverse focal ecocode abundance
```r
list.all.results.ecocode.id <- readRDS.root("output/list.lmer.out.all.ecocode.id.no.log.rds")
```
## Error: error reading from connection
check convergence
```r
fun.get.conv(list.all.results.obs.id)
```
```
## opt
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species 0
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.species 0
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species 0
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.species 0
## all.no.log_Max.height_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species 0
## all.no.log_Max.height_species_lmer.LOGLIN.ER.AD.Tf.r.species 0
## lme4
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species -1
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.species -1
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species -1
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.species -1
## all.no.log_Max.height_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species -1
## all.no.log_Max.height_species_lmer.LOGLIN.ER.AD.Tf.r.species -1
```
resampling with weights equal to inverse focal ecocode abundance
```r
fun.get.conv(list.all.results.species.id)
```
```
## opt
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species 0
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.species 0
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species 0
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.species 0
## all.no.log_Max.height_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species 0
## all.no.log_Max.height_species_lmer.LOGLIN.ER.AD.Tf.r.species 0
## lme4
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species -3
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.species -1
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species -1
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.species -1
## all.no.log_Max.height_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species -1
## all.no.log_Max.height_species_lmer.LOGLIN.ER.AD.Tf.r.species -1
```
```r
list.all.results.ecocode.id <- readRDS.root("output/list.lmer.out.all.ecocode.id.no.log.rds")
fun.get.conv(list.all.results.ecocode.id)
```
```
## opt
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species 0
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.species 0
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species 0
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.species 0
## all.no.log_Max.height_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species 0
## all.no.log_Max.height_species_lmer.LOGLIN.ER.AD.Tf.r.species 0
## lme4
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species -1
## all.no.log_SLA_species_lmer.LOGLIN.ER.AD.Tf.r.species -1
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.biomes.species -3
## all.no.log_Wood.density_species_lmer.LOGLIN.ER.AD.Tf.r.species -1