Commit 158632bc authored by kunstler's avatar kunstler
Browse files

exclude more extreme growth

parent df7ed2c7
......@@ -60,7 +60,6 @@ require(runjags)
inits <- fun.generate.init(jags.model, list.jags[[1]], chains)
### SEND to jags
print(getwd())
browser()
jags.output <- run.jags(data=list.jags[[1]],
inits = inits,
model = jags.model$bug, #file.path(path.out,"model.file.bug"),
......
......@@ -233,8 +233,8 @@ select.data.for.analysis <- function(data.tree, abs.CWM.tntf, perc.neigh.sp,
perc.neigh.gs, BATOT, min.obs,
min.perc.neigh.sp = 0.90,
min.perc.neigh.gs = 0.95,
min.BA.G = -100,
max.BA.G = 500){
min.BA.G = -40,
max.BA.G = 180){
select.temp <-(1:nrow(data.tree))[!is.na(data.tree[["BA.G"]]) &
!is.na(data.tree[["D"]]) &
......@@ -335,7 +335,7 @@ return(as.vector(scale(x, ...)))
get.variables <- function(data.tree, BATOT, CWM.tn,
abs.CWM.tntf, tf, ecocode.var = 'wwf',
min.BA.G = 100){
min.BA.G = 40){
logG <- scale.d(log(data.tree[["BA.G"]] + min.BA.G+1))
logD <- scale.d(log(data.tree[["D"]]))
MAT <- scale.d(data.tree[["MAT"]])
......@@ -375,7 +375,7 @@ return(data.frame(logG = logG,
get.variables.Multi <- function(data.tree, BATOT, Multi.type = 'a',
ecocode.var = 'wwf',
min.BA.G = 100){
min.BA.G = 40){
logG <- scale.d(log(data.tree[["BA.G"]] + min.BA.G+1))
logD <- scale.d(log(data.tree[["D"]]))
MAT <- scale.d(data.tree[["MAT"]])
......@@ -443,7 +443,7 @@ return(data.frame(logG = logG,
get.variables.cat <- function(data.tree, BATOT, CWM.tn,
abs.CWM.tntf, tf, ecocode.var = 'wwf',
min.BA.G = 100){
min.BA.G = 40){
logG <- scale.d(log(data.tree[["BA.G"]]+min.BA.G+1))
logD <- scale.d(log(data.tree[["D"]]))
MAT <- scale.d(data.tree[["MAT"]])
......@@ -552,7 +552,7 @@ tf <- paste(trait, "focal", sep = ".")
BATOT <- "BATOT"
#= DATA SD LIST FOR LMER
list.sd <- compute.sd.mean.var.lmer(data.tree, tf, CWM.tn,
abs.CWM.tntf, min.BA.G = 100)
abs.CWM.tntf, min.BA.G = 40)
}else{
list.sd <- NA
}
......@@ -560,7 +560,7 @@ list.sd <- NA
}
compute.sd.mean.var.lmer <- function(data.tree, tf, CWM.tn,
abs.CWM.tntf, min.BA.G = 100){
abs.CWM.tntf, min.BA.G = 40){
list.sd <- list(
'mean.logG' = mean(log(data.tree[["BA.G"]] + min.BA.G+1), na.rm = TRUE),
'sd.logG' = sd(log(data.tree[["BA.G"]] + min.BA.G+1), na.rm = TRUE),
......
......@@ -67,12 +67,12 @@ var.data <- model.matrix(fm1)[, var]
}
plot.all.resid.to.png <- function(fm1, set, trait, filling, model ,
plot.all.resid.to.png <- function(fm1, data.type, trait, model ,
output.dir = 'output/lmer'){
vars <- names(fixef(fm1))[-1]
name <- paste( trait, filling, model,
name <- paste( trait, model,
'residual.plot%03d.png', sep = '.')
png(file.path(output.dir,set,name))
png(file.path(output.dir,data.type,name))
plot.qqplot(fm1)
a <- fun.plot.resid.fitted(fm1)
multiplot(a)
......@@ -85,10 +85,9 @@ read.and.plot.resid <- function(name){
fm1 <- read.lmer.output(name)
details <- files.details.all(name)
plot.all.resid.to.png(fm1,
set = details['set'],
plot.all.resid.to.png(fm1[[1]],
data.type = details['data.type'],
trait = details['trait'],
filling = details['filling'],
model = details['model'] )
}
......
......@@ -10,13 +10,12 @@ traits <- c("SLA", "Wood.density","Max.height")
type.filling <- 'species'
files <- c()
for (trait in traits){
for(model in c(model.files.lmer.Tf.3)){
for(model in c(model.files.lmer.Tf.1[1])){
source(model, local = TRUE)
model.obj <- load.model()
pathout <- output.dir('lmer', model.obj$name, trait, 'all.no.log',
type.filling=type.filling)
pathout <- output.dir('lmer', model.obj$name, trait, 'simple')
files <- c(files,file.path(pathout,"ecocode.id.results.nolog.all.rds"))
files <- c(files,file.path(pathout,"sp.name.wwf.results.nolog.all.rds"))
}
}
......
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