Commit 37afb3ae authored by kunstler's avatar kunstler
Browse files

update jags

parent 386ee232
......@@ -18,6 +18,8 @@ figs
*.rds
*.R~
*.Rout
*.aux
*.toc
docs/metadata/sites
.Rproj.user
GROWTH.MODEL.*
......
......@@ -54,40 +54,45 @@ fun.call.jags.and.save <- function(jags.model,
chains = 3,
thin = 50,
parallel = FALSE){
require(runjags)
start <- Sys.time()
model.file <-
inits <- fun.generate.init(jags.model, list.jags[[1]], chains)
### SEND to jags
if(!parallel){
jags.output <- jags(data=list.jags[[1]], inits = inits,
model.file = file.path(path.out,"model.file.bug"),
parameters.to.save = names(jags.model$pars),
jags.output <- run.jags(data=list.jags[[1]],
inits = inits,
model = file.path(path.out,"model.file.bug"),
monitor = names(jags.model$pars),
n.chains = chains ,
DIC = FALSE,
n.iter = iter,
n.burnin = warmup,
n.thin = thin)
sample = iter,
burnin = warmup,
adapt = 2000,
thin = thin,
modules= 'glm on',
method = 'rjags')
}else{
jags.output <- run.jags(data=list.jags[[1]],
inits = inits,
model = file.path(path.out,"model.file.bug"),
monitor = names(jags.model$pars),
n.chains = chains ,
sample = iter,
burnin = warmup,
adapt = 2000,
thin = thin,
modules= 'glm on',
method = 'parallel')
}
end <- Sys.time()
print(end -start)
print(jags.output)
}else{
## jags.output <- jags.parallel(data=list.jags[[1]], inits = inits,
## model.file = file.path(path.out,"model.file.bug"),
## parameters.to.save = names(jags.model$pars),
## n.chains = chains ,
## DIC = FALSE,
## n.iter = iter,
## n.burnin = warmup,
## n.thin = thin)
## TODO CHANGE TO run.jags
}
saveRDS(list(output = jags.output, list.sd = list.jags[[2]]),
file = file.path(path.out, paste(var.sample,
"results.jags.rds", sep = '.')))
return(jags.output)
}
run.jags <- function (model.file, trait, init.TF,
run.jags.b <- function (model.file, trait, init.TF,
data.type='simple',
sample.size = NA,
ecocode.var = 'wwf',
......@@ -96,7 +101,7 @@ run.jags <- function (model.file, trait, init.TF,
select.set = NA,
merge.biomes.TF = FALSE,
...) {
require(R2jags)
require(runjags)
source(model.file, local = TRUE)
model <- load.model()
......
load.model <- function(){
list(
name = "LOGLIN.ER.AD.Tf.r.set.tree.species",
## parameters to save
pars = c('intercept' , 'mean_logD', 'mean_Tf',
'mean_sumBn', 'mean_sumTfBn', 'mean_sumTnBn',
'mean_sumTnTfBn_abs', 'sigma_inter_species',
'sigma_inter_set', 'sigma_inter_plot',
'sigma_inter_tree', 'sigma_logD_species',
'sigma_Tf_set', 'sigma_sumBn_set',
'sigma_sumBn_species', 'sigma_sumTfBn_set',
'sigma_sumTnBn_set', 'sigma_sumTnTfBn_abs_set',
'sigma', 'param_Tf_set',
'param_sumBn_set', 'param_sumTfBn_set',
'param_sumTnBn_set', 'param_sumTnTfBn_abs_set'),
bug =
"#########################################
########## Growth model with JAGS #######
model {
############ Likelihood ###################
for (i in 1:N_indiv) {
logG[i] ~ dnorm(theo_g[i],tau)
theo_g[i] <- inter[i] + DD[i] +TTf[i] + SUMBBN[i] +SUMTFBBN[i] + SUMTNBBN[i] + SUMABSBBN[i]
inter[i] <- intercept + intercept_species[species_id[i]] + intercept_tree[tree_id[i]]*tree_01[i] + intercept_plot[plot_id[i]] + intercept_set[set_id[i]]
DD[i] <- (mean_logD + param_logD_species[species_id[i]])*logD[i]
TTf[i] <- (mean_Tf + param_Tf_set[set_id[i]])*Tf[i]
SUMBBN[i] <-(mean_sumBn + param_sumBn_set[set_id[i]] + param_sumBn_species[species_id[i]])*sumBn[i]
SUMTFBBN[i] <- (mean_sumTfBn + param_sumTfBn_set[set_id[i]])*sumTfBn[i]
SUMTNBBN[i] <- (mean_sumTnBn + param_sumTnBn_set[set_id[i]])*sumTnBn[i]
SUMABSBBN[i] <- (mean_sumTnTfBn_abs + param_sumTnTfBn_abs_set[set_id[i]])*sumTnTfBn_abs[i]
}
################################################
########### Hierarchical parameters ########
### species random param
for (n in 1:N_species)
{
param_logD_species[n] ~ dnorm(0,tau_logD_species)
param_sumBn_species[n] ~ dnorm(0,tau_sumBn_species)
intercept_species[n] ~ dnorm(0,tau_inter_species)
}
## plot effect
for (j in 1:N_plot)
{
intercept_plot[j] ~ dnorm(0,tau_inter_plot)
}
## tree effect
for (j in 1:N_tree)
{
intercept_tree[j] ~ dnorm(0,tau_inter_tree)
}
## tree effect
for (j in 1:N_set)
{
intercept_set[j] ~ dnorm(0,tau_inter_set)
}
## set
for (j in 1:N_set)
{
param_Tf_set[j] ~ dnorm(0, tau_Tf_set)T(-5, 5)
param_sumBn_set[j] ~ dnorm(0, tau_sumBn_set)T(-5, 5)
param_sumTfBn_set[j] ~ dnorm(0 ,tau_sumTfBn_set)T(-5, 5)
param_sumTnBn_set[j] ~ dnorm(0 ,tau_sumTnBn_set)T(-5, 5)
param_sumTnTfBn_abs_set[j] ~ dnorm(0 ,tau_sumTnTfBn_abs_set)T(-5, 5)
}
###############################################
########### Non-hierarchical parameters ########
# constants for prior
tau0 <- 1.0E-4
intercept ~ dnorm(0,tau0)T(-5, 5)
mean_logD ~ dnorm(0,tau0)T(-5, 5)
mean_Tf ~ dnorm(0,tau0)T(-5, 5)
mean_sumBn ~ dnorm(0,tau0)T(-5, 5)
mean_sumTfBn ~ dnorm(0,tau0)T(-5, 5)
mean_sumTnBn ~ dnorm(0,tau0)T(-5, 5)
mean_sumTnTfBn_abs ~ dnorm(0,tau0)T(-5, 5)
# variance error
tau <- pow(sigma,-2)
sigma ~ dunif(0.00001,5)
tau_inter_plot <- pow(sigma_inter_plot,-2)
sigma_inter_plot ~ dunif(0.00001,4)
tau_inter_tree <- pow(sigma_inter_tree,-2)
sigma_inter_tree ~ dunif(0.00001,2)
tau_inter_set <- pow(sigma_inter_set,-2)
sigma_inter_set ~ dunif(0.00001,4)
tau_inter_species <- pow(sigma_inter_species,-2)
sigma_inter_species ~ dunif(0.00001,4)
tau_logD_species <- pow(sigma_logD_species,-2)
sigma_logD_species ~ dunif(0.00001,4)
tau_sumBn_species <- pow(sigma_sumBn_species,-2)
sigma_sumBn_species ~ dunif(0.00001,4)
tau_Tf_set <- pow(sigma_Tf_set,-2)
sigma_Tf_set ~ dunif(0.00001,4)
tau_sumBn_set <- pow(sigma_sumBn_set,-2)
sigma_sumBn_set ~ dunif(0.00001,4)
tau_sumTfBn_set <- pow(sigma_sumTfBn_set,-2)
sigma_sumTfBn_set ~ dunif(0.00001,4)
tau_sumTnBn_set <- pow(sigma_sumTnBn_set,-2)
sigma_sumTnBn_set ~ dunif(0.00001,4)
tau_sumTnTfBn_abs_set <- pow(sigma_sumTnTfBn_abs_set,-2)
sigma_sumTnTfBn_abs_set ~ dunif(0.00001,4)
} # End of the jags model
")
}
load.model <- function(){
list(
name = "LOGLIN.ER.AD.Tf.r.set.species",
## parameters to save
pars = c('intercept'=1 , 'mean_logD'=1, 'mean_Tf'=1,
'mean_sumBn'=1, 'mean_sumTfBn'=1, 'mean_sumTnBn'=1,
'mean_sumTnTfBn_abs'=1, 'sigma_inter_species'=1,
'sigma_inter_set'=1, 'sigma_inter_plot'=1,
'sigma_logD_species'=1,
'sigma_Tf_set'=1, 'sigma_sumBn_set'=1,
'sigma_sumBn_species'=1, 'sigma_sumTfBn_set'=1,
'sigma_sumTnBn_set'=1, 'sigma_sumTnTfBn_abs_set'=1,
'sigma'=1, 'param_Tf_set'='N_set',
'param_sumBn_set'='N_set', 'param_sumTfBn_set'='N_set',
'param_sumTnBn_set'='N_set', 'param_sumTnTfBn_abs_set'='N_set'),
bug =
"#########################################
########## Growth model with JAGS #######
model {
############ Likelihood ###################
for (i in 1:N_indiv) {
logG[i] ~ dnorm(theo_g[i],tau)
theo_g[i] <- inter[i] + DD[i] +TTf[i] + SUMBBN[i] +SUMTFBBN[i] + SUMTNBBN[i] + SUMABSBBN[i]
inter[i] <- intercept + intercept_species[species_id[i]] + intercept_plot[plot_id[i]] + intercept_set[set_id[i]]
DD[i] <- (mean_logD + param_logD_species[species_id[i]])*logD[i]
TTf[i] <- (mean_Tf + param_Tf_set[set_id[i]])*Tf[i]
SUMBBN[i] <-(mean_sumBn + param_sumBn_set[set_id[i]] + param_sumBn_species[species_id[i]])*sumBn[i]
SUMTFBBN[i] <- (mean_sumTfBn + param_sumTfBn_set[set_id[i]])*sumTfBn[i]
SUMTNBBN[i] <- (mean_sumTnBn + param_sumTnBn_set[set_id[i]])*sumTnBn[i]
SUMABSBBN[i] <- (mean_sumTnTfBn_abs + param_sumTnTfBn_abs_set[set_id[i]])*sumTnTfBn_abs[i]
}
################################################
########### Hierarchical parameters ########
### species random param
for (n in 1:N_species)
{
param_logD_species[n] ~ dnorm(0,tau_logD_species)
param_sumBn_species[n] ~ dnorm(0,tau_sumBn_species)
intercept_species[n] ~ dnorm(0,tau_inter_species)
}
## plot effect
for (j in 1:N_plot)
{
intercept_plot[j] ~ dnorm(0,tau_inter_plot)
}
## set effect
for (j in 1:N_set)
{
intercept_set[j] ~ dnorm(0,tau_inter_set)
}
## set
for (j in 1:N_set)
{
param_Tf_set[j] ~ dnorm(0, tau_Tf_set)T(-5, 5)
param_sumBn_set[j] ~ dnorm(0, tau_sumBn_set)T(-5, 5)
param_sumTfBn_set[j] ~ dnorm(0 ,tau_sumTfBn_set)T(-5, 5)
param_sumTnBn_set[j] ~ dnorm(0 ,tau_sumTnBn_set)T(-5, 5)
param_sumTnTfBn_abs_set[j] ~ dnorm(0 ,tau_sumTnTfBn_abs_set)T(-5, 5)
}
###############################################
########### Non-hierarchical parameters ########
# constants for prior
tau0 <- 1.0E-4
intercept ~ dnorm(0,tau0)T(-5, 5)
mean_logD ~ dnorm(0,tau0)T(-5, 5)
mean_Tf ~ dnorm(0,tau0)T(-5, 5)
mean_sumBn ~ dnorm(0,tau0)T(-5, 5)
mean_sumTfBn ~ dnorm(0,tau0)T(-5, 5)
mean_sumTnBn ~ dnorm(0,tau0)T(-5, 5)
mean_sumTnTfBn_abs ~ dnorm(0,tau0)T(-5, 5)
# variance error
tau <- pow(sigma,-2)
sigma ~ dunif(0.00001,5)
tau_inter_plot <- pow(sigma_inter_plot,-2)
sigma_inter_plot ~ dunif(0.00001,4)
tau_inter_set <- pow(sigma_inter_set,-2)
sigma_inter_set ~ dunif(0.00001,4)
tau_inter_species <- pow(sigma_inter_species,-2)
sigma_inter_species ~ dunif(0.00001,4)
tau_logD_species <- pow(sigma_logD_species,-2)
sigma_logD_species ~ dunif(0.00001,4)
tau_sumBn_species <- pow(sigma_sumBn_species,-2)
sigma_sumBn_species ~ dunif(0.00001,4)
tau_Tf_set <- pow(sigma_Tf_set,-2)
sigma_Tf_set ~ dunif(0.00001,4)
tau_sumBn_set <- pow(sigma_sumBn_set,-2)
sigma_sumBn_set ~ dunif(0.00001,4)
tau_sumTfBn_set <- pow(sigma_sumTfBn_set,-2)
sigma_sumTfBn_set ~ dunif(0.00001,4)
tau_sumTnBn_set <- pow(sigma_sumTnBn_set,-2)
sigma_sumTnBn_set ~ dunif(0.00001,4)
tau_sumTnTfBn_abs_set <- pow(sigma_sumTnTfBn_abs_set,-2)
sigma_sumTnTfBn_abs_set ~ dunif(0.00001,4)
} # End of the jags model
")
}
load.model <- function(){
list(
name = "LOGLIN.ER.AD.Tf.r.set.species.fixed.biomes",
## parameters to save
pars = c('param_intercept'='N_biomes' ,
'param_mean_logD'='N_biomes', 'param_mean_Tf'='N_biomes',
'param_mean_sumBn'='N_biomes', 'param_mean_sumTfBn'= 'N_biomes',
'param_mean_sumTnBn'= 'N_biomes',
'param_mean_sumTnTfBn_abs'='N_biomes', 'sigma_inter_species'=1,
'sigma_inter_set'=1, 'sigma_inter_plot'=1,
'sigma_logD_species'=1,
'sigma_Tf_set'=1, 'sigma_sumBn_set'=1,
'sigma_sumBn_species'=1, 'sigma_sumTfBn_set'=1,
'sigma_sumTnBn_set'=1, 'sigma_sumTnTfBn_abs_set'=1,
'sigma'=1, 'param_Tf_set'='N_set',
'param_sumBn_set'='N_set', 'param_sumTfBn_set'='N_set',
'param_sumTnBn_set'='N_set', 'param_sumTnTfBn_abs_set'='N_set'),
bug =
"#########################################
########## Growth model with JAGS #######
model {
############ Likelihood ###################
for (i in 1:N_indiv) {
logG[i] ~ dnorm(theo_g[i],tau)
theo_g[i] <- inter[i] + DD[i] +TTf[i] + SUMBBN[i] +SUMTFBBN[i] + SUMTNBBN[i] + SUMABSBBN[i]
inter[i] <- param_intercept[biomes_id[i]] + intercept_species[species_id[i]] + intercept_plot[plot_id[i]] + intercept_set[set_id[i]]
DD[i] <- (param_mean_logD[biomes_id[i]] + param_logD_species[species_id[i]])*logD[i]
TTf[i] <- (param_mean_Tf[biomes_id[i]] + param_Tf_set[set_id[i]])*Tf[i]
SUMBBN[i] <-(param_mean_sumBn[biomes_id[i]] + param_sumBn_set[set_id[i]] + param_sumBn_species[species_id[i]])*sumBn[i]
SUMTFBBN[i] <- (param_mean_sumTfBn[biomes_id[i]] + param_sumTfBn_set[set_id[i]])*sumTfBn[i]
SUMTNBBN[i] <- (param_mean_sumTnBn[biomes_id[i]] + param_sumTnBn_set[set_id[i]])*sumTnBn[i]
SUMABSBBN[i] <- (param_mean_sumTnTfBn_abs[biomes_id[i]] + param_sumTnTfBn_abs_set[set_id[i]])*sumTnTfBn_abs[i]
}
################################################
########### Hierarchical parameters ########
### species random param
for (n in 1:N_species)
{
param_logD_species[n] ~ dnorm(0,tau_logD_species)
param_sumBn_species[n] ~ dnorm(0,tau_sumBn_species)
intercept_species[n] ~ dnorm(0,tau_inter_species)
}
## plot effect
for (j in 1:N_plot)
{
intercept_plot[j] ~ dnorm(0,tau_inter_plot)
}
## set effect
for (j in 1:N_set)
{
intercept_set[j] ~ dnorm(0,tau_inter_set)
}
## set
for (j in 1:N_set)
{
param_Tf_set[j] ~ dnorm(0, tau_Tf_set)T(-5, 5)
param_sumBn_set[j] ~ dnorm(0, tau_sumBn_set)T(-5, 5)
param_sumTfBn_set[j] ~ dnorm(0 ,tau_sumTfBn_set)T(-5, 5)
param_sumTnBn_set[j] ~ dnorm(0 ,tau_sumTnBn_set)T(-5, 5)
param_sumTnTfBn_abs_set[j] ~ dnorm(0 ,tau_sumTnTfBn_abs_set)T(-5, 5)
}
###############################################
########### Non-hierarchical parameters ########
# constants for prior
tau0 <- 1.0E-4
for (j in 1:N_biomes)
{
param_intercept[j] ~ dnorm(0,tau0)T(-5, 5)
param_mean_logD[j] ~ dnorm(0,tau0)T(-5, 5)
param_mean_Tf[j] ~ dnorm(0,tau0)T(-5, 5)
param_mean_sumBn[j] ~ dnorm(0,tau0)T(-5, 5)
param_mean_sumTfBn[j] ~ dnorm(0,tau0)T(-5, 5)
param_mean_sumTnBn[j] ~ dnorm(0,tau0)T(-5, 5)
param_mean_sumTnTfBn_abs[j] ~ dnorm(0,tau0)T(-5, 5)
}
# variance error
tau <- pow(sigma,-2)
sigma ~ dunif(0.00001,5)
tau_inter_plot <- pow(sigma_inter_plot,-2)
sigma_inter_plot ~ dunif(0.00001,4)
tau_inter_set <- pow(sigma_inter_set,-2)
sigma_inter_set ~ dunif(0.00001,4)
tau_inter_species <- pow(sigma_inter_species,-2)
sigma_inter_species ~ dunif(0.00001,4)
tau_logD_species <- pow(sigma_logD_species,-2)
sigma_logD_species ~ dunif(0.00001,4)
tau_sumBn_species <- pow(sigma_sumBn_species,-2)
sigma_sumBn_species ~ dunif(0.00001,4)
tau_Tf_set <- pow(sigma_Tf_set,-2)
sigma_Tf_set ~ dunif(0.00001,4)
tau_sumBn_set <- pow(sigma_sumBn_set,-2)
sigma_sumBn_set ~ dunif(0.00001,4)
tau_sumTfBn_set <- pow(sigma_sumTfBn_set,-2)
sigma_sumTfBn_set ~ dunif(0.00001,4)
tau_sumTnBn_set <- pow(sigma_sumTnBn_set,-2)
sigma_sumTnBn_set ~ dunif(0.00001,4)
tau_sumTnTfBn_abs_set <- pow(sigma_sumTnTfBn_abs_set,-2)
sigma_sumTnTfBn_abs_set ~ dunif(0.00001,4)
} # End of the jags model
")
}
load.model <- function(){
list(
name = "LOGLIN.ER.AD.Tf.r.set.tree.species",
## parameters to save
pars = c('intercept'=1 , 'mean_logD'=1, 'mean_Tf'=1,
'mean_sumBn'=1, 'mean_sumTfBn'=1, 'mean_sumTnBn'=1,
'mean_sumTnTfBn_abs'=1, 'sigma_inter_species'=1,
'sigma_inter_set'=1, 'sigma_inter_plot'=1,
'sigma_inter_tree'=1, 'sigma_logD_species'=1,
'sigma_Tf_set'=1, 'sigma_sumBn_set'=1,
'sigma_sumBn_species'=1, 'sigma_sumTfBn_set'=1,
'sigma_sumTnBn_set'=1, 'sigma_sumTnTfBn_abs_set'=1,
'sigma'=1, 'param_Tf_set'='N_set',
'param_sumBn_set'='N_set', 'param_sumTfBn_set'='N_set',
'param_sumTnBn_set'='N_set', 'param_sumTnTfBn_abs_set'='N_set'),
bug =
"#########################################
########## Growth model with JAGS #######
model {
############ Likelihood ###################
for (i in 1:N_indiv) {
logG[i] ~ dnorm(theo_g[i],tau)
theo_g[i] <- inter[i] + DD[i] +TTf[i] + SUMBBN[i] +SUMTFBBN[i] + SUMTNBBN[i] + SUMABSBBN[i]
inter[i] <- intercept + intercept_species[species_id[i]] + intercept_tree[tree_id[i]]*tree_01[i] + intercept_plot[plot_id[i]] + intercept_set[set_id[i]]
DD[i] <- (mean_logD + param_logD_species[species_id[i]])*logD[i]
TTf[i] <- (mean_Tf + param_Tf_set[set_id[i]])*Tf[i]
SUMBBN[i] <-(mean_sumBn + param_sumBn_set[set_id[i]] + param_sumBn_species[species_id[i]])*sumBn[i]
SUMTFBBN[i] <- (mean_sumTfBn + param_sumTfBn_set[set_id[i]])*sumTfBn[i]
SUMTNBBN[i] <- (mean_sumTnBn + param_sumTnBn_set[set_id[i]])*sumTnBn[i]
SUMABSBBN[i] <- (mean_sumTnTfBn_abs + param_sumTnTfBn_abs_set[set_id[i]])*sumTnTfBn_abs[i]
}
################################################
########### Hierarchical parameters ########
### species random param
for (n in 1:N_species)
{
param_logD_species[n] ~ dnorm(0,tau_logD_species)
param_sumBn_species[n] ~ dnorm(0,tau_sumBn_species)
intercept_species[n] ~ dnorm(0,tau_inter_species)
}
## plot effect
for (j in 1:N_plot)
{
intercept_plot[j] ~ dnorm(0,tau_inter_plot)
}
## tree effect
for (j in 1:N_tree)
{
intercept_tree[j] ~ dnorm(0,tau_inter_tree)
}
## set effect
for (j in 1:N_set)
{
intercept_set[j] ~ dnorm(0,tau_inter_set)
}
## set
for (j in 1:N_set)
{
param_Tf_set[j] ~ dnorm(0, tau_Tf_set)T(-5, 5)
param_sumBn_set[j] ~ dnorm(0, tau_sumBn_set)T(-5, 5)
param_sumTfBn_set[j] ~ dnorm(0 ,tau_sumTfBn_set)T(-5, 5)
param_sumTnBn_set[j] ~ dnorm(0 ,tau_sumTnBn_set)T(-5, 5)
param_sumTnTfBn_abs_set[j] ~ dnorm(0 ,tau_sumTnTfBn_abs_set)T(-5, 5)
}
###############################################
########### Non-hierarchical parameters ########
# constants for prior
tau0 <- 1.0E-4
intercept ~ dnorm(0,tau0)T(-5, 5)
mean_logD ~ dnorm(0,tau0)T(-5, 5)
mean_Tf ~ dnorm(0,tau0)T(-5, 5)
mean_sumBn ~ dnorm(0,tau0)T(-5, 5)
mean_sumTfBn ~ dnorm(0,tau0)T(-5, 5)
mean_sumTnBn ~ dnorm(0,tau0)T(-5, 5)
mean_sumTnTfBn_abs ~ dnorm(0,tau0)T(-5, 5)
# variance error
tau <- pow(sigma,-2)
sigma ~ dunif(0.00001,5)
tau_inter_plot <- pow(sigma_inter_plot,-2)
sigma_inter_plot ~ dunif(0.00001,4)
tau_inter_tree <- pow(sigma_inter_tree,-2)
sigma_inter_tree ~ dunif(0.00001,2)
tau_inter_set <- pow(sigma_inter_set,-2)
sigma_inter_set ~ dunif(0.00001,4)
tau_inter_species <- pow(sigma_inter_species,-2)
sigma_inter_species ~ dunif(0.00001,4)
tau_logD_species <- pow(sigma_logD_species,-2)
sigma_logD_species ~ dunif(0.00001,4)
tau_sumBn_species <- pow(sigma_sumBn_species,-2)
sigma_sumBn_species ~ dunif(0.00001,4)
tau_Tf_set <- pow(sigma_Tf_set,-2)
sigma_Tf_set ~ dunif(0.00001,4)
tau_sumBn_set <- pow(sigma_sumBn_set,-2)
sigma_sumBn_set ~ dunif(0.00001,4)
tau_sumTfBn_set <- pow(sigma_sumTfBn_set,-2)
sigma_sumTfBn_set ~ dunif(0.00001,4)
tau_sumTnBn_set <- pow(sigma_sumTnBn_set,-2)
sigma_sumTnBn_set ~ dunif(0.00001,4)
tau_sumTnTfBn_abs_set <- pow(sigma_sumTnTfBn_abs_set,-2)
sigma_sumTnTfBn_abs_set ~ dunif(0.00001,4)
} # End of the jags model
")
}
all: paper.pdf extended_method.pdf extended_data.pdf
paper.pdf: paper.md include.tex refs.bib
pandoc $< metadata.yaml --csl=nature.csl --filter pandoc-citeproc --bibliography=refs.bib --template=include.tex --variable mainfont="Times New Roman" --variable sansfont=Arial --variable fontsize=12pt --latex-engine=xelatex -o $@
paper.docx: paper.md include.tex refs.bib
pandoc -s -S $< metadata.yaml --csl=nature.csl --filter pandoc-citeproc --bibliography=refs.bib --template=include.tex --variable mainfont="Times New Roman" --variable sansfont=Arial --variable fontsize=12pt -o paper.docx
extended_method.md: extended_method.Rmd
Rscript -e "library(knitr); knit('extended_method.Rmd', output = 'extended_method.md')"
extended_method.pdf: extended_method.md include.tex refs.bib
pandoc $< --csl=nature.csl --filter pandoc-citeproc --bibliography=refs.bib --template=include.tex --variable mainfont="Times New Roman" --variable sansfont=Arial --variable fontsize=12pt --latex-engine=xelatex -o $@
extended_method.docx: extended_method.md include.tex refs.bib
pandoc -s -S $< --csl=nature.csl --filter pandoc-citeproc --bibliography=refs.bib --template=include.tex --variable mainfont="Times New Roman" --variable sansfont=Arial --variable fontsize=12pt -o $@
extended_data.md: extended_data.R
Rscript -e "library(sowsear); sowsear('extended_data.R', 'Rmd')"
Rscript -e "library(knitr); knit('extended_data.Rmd', output = 'extended_data.md')"
extended_data.pdf: extended_data.md include.tex refs.bib
pandoc $< --csl=nature.csl --filter pandoc-citeproc --bibliography=refs.bib --standalone --template=include.tex --variable mainfont="Times New Roman" --variable sansfont=Arial --variable fontsize=12pt --latex-engine=xelatex -o $@
SupplMat.md: Suppl_Mat.Rmd
Rscript -e "library(knitr); knit('Suppl_Mat.Rmd', output = 'SupplMat.md')"
SupplMat.pdf: SupplMat.md include.tex refs.bib
pandoc $< --csl=nature.csl --filter pandoc-citeproc --bibliography=refs.bib --template=include.tex --variable mainfont="Times New Roman" --variable sansfont=Arial --variable fontsize=12pt --latex-engine=xelatex -o $@
clean:
rm -f *.pdf
rm -f *.html
#
This diff is collapsed.
%Title : Plant functional traits have globally consistent effects on competition
%Authors: Georges Kunstler; David A Coomes; Daniel Falster; Francis Hui;
Rob Kooyman; Daniel Laughlin Lourens Poorter; Mark Vanderwel;
Ghislain Vieilledent; Joe Wright; Masahiro Aiba; John Caspersen;
Sylvie Gourlet-Fleury; Marc Hanewinkel; Bruno Herault; Hiroko Kurokawa;
Yusuke Onoda; Maria Uriarte; Sarah Richardson; Paloma Ruiz;
I-Fang Sun; Goran Ståhl; Nathan Swenson; Jill Thompson; Miguel Zavala;
Hongcheng Zeng; Jess Zimmerman; Niklaus E Zimmermann; and Mark Westoby.
# Summary paragraph outline (max 200 words)
Competition is a very important type of ecological interaction, especially in terrestrial vegetation where plants greatly modify the local environment for each other. Competition has influence on growth of individuals and survival, on how species mixtures will change over time into the future, and on community composition. However firm generalizations have yet to be established about outcomes of competition among tree species. Here we show how key species traits have consistent influences on growth and competition. The data sources are exceptionally large, including national forest inventories monitoring growth in sometimes millions of trees. We here synthesize across a global set of such inventories plus also several large forest-monitoring plots. Some traits had strong effects on the growth rate of the species. Traits of focal species also influenced their tolerance to competition, and traits of competitor species influenced their impact. A notable generalization was that trait values that favoured tolerance to competition also rendered species slow growing in absence of competition. There was a small but detectable benefit in reducing competition from trait-dissimilarity between focal plant and its competitors. The trait-based picture that emerged is much simpler and more general than a quantification of competition coefficients between each pair of species, which is intractable at global scale. Our results demonstrate that traits can be used to predict competitive interactions between forest tree species at a large scale, and models of community assembly can be considerably simplified on a trait basis.
# Main text