Commit b5dd6620 authored by kunstler's avatar kunstler
Browse files

change writing of bugs file for jags

parent 6c62313a
......@@ -98,7 +98,7 @@ print('OK')
print(path.out)
dir.create(path.out, recursive = TRUE, showWarnings = FALSE)
cat(model$bug, file = file.path(path.out,"model.file.bug")
, sep=" ", fill = FALSE, labels = NULL, append = FALSE)
, sep=" ", fill = TRUE, labels = NULL, append = FALSE)
cat("run jags for model", model.file, " for trait",
trait, "\n")
if (init.TF) {
......
......@@ -106,6 +106,8 @@ tau_sumTnTfBn_abs_set <- pow(sigma_sumTnTfBn_abs_set,-2)
sigma_sumTnTfBn_abs_set ~ dunif(0.00001,4)
} # End of the jags model
}
# End of the jags model
")
}
......@@ -110,6 +110,8 @@ tau_sumTnTfBn_abs_set <- pow(sigma_sumTnTfBn_abs_set,-2)
sigma_sumTnTfBn_abs_set ~ dunif(0.00001,4)
} # End of the jags model
}
# End of the jags model
")
}
......@@ -81,12 +81,18 @@ list.all.results <-
readRDS.root('output/list.lmer.out.all.NA.simple.set.rds')
library(pander)
mat.param <- do.call('cbind', lapply(c('Wood.density', 'SLA', 'Max.height'),
extract.param, list.res = list.all.results,
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species'))
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species',
param.vec = c("(Intercept)", "logD", "Tf","sumBn",
"sumTnBn","sumTfBn", "sumTnTfBn.abs")))
mat.param.sd <- do.call('cbind', lapply(c('Wood.density', 'SLA', 'Max.height'),
extract.param.sd, list.res = list.all.results,
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species'))
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species',
param.vec = c("(Intercept)", "logD", "Tf","sumBn",
"sumTnBn","sumTfBn", "sumTnTfBn.abs")))
mat.R2c <- do.call('cbind', lapply(c('Wood.density', 'SLA', 'Max.height'),
extract.R2c, list.res = list.all.results,
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species'))
......@@ -104,16 +110,16 @@ mat.param <- rbind(mat.param.mean.sd,
round(mat.R2m, 4),
round(mat.R2c, 4))
colnames(mat.param) <- c('Wood density', 'SLA', 'Maximum height')
row.names(mat.param) <- c('$\\gamma$', '$m_1$', '$\\alpha_0$',
row.names(mat.param) <- c('$m_0$', '$\\gamma$', '$m_1$', '$\\alpha_0$',
'$\\alpha_i$', '$\\alpha_r$',
'$\\alpha_s$', '$R^2_m$*', '$R^2_c$*')
##+ Table2_Effectsize, echo = FALSE, results='asis', message=FALSE
pandoc.table(mat.param, caption = "Standaridized parameters estimates and standard error (in bracket) estimated for each traits and $R^2$* of models. See Fig 1. in main text for explanation of parameters",
pandoc.table(mat.param[c(1,3,2,4:9), ], caption = "Standaridized parameters estimates and standard error (in bracket) estimated for each traits and $R^2$* of models. See Fig 1. in main text for explanation of parameters",
digits = 3, justify = c('left', rep('right', 3)),
emphasize.strong.cells = bold.index, split.tables = 200)
## \* We report the conditional and marginal $R^2$ of the models using the methods of Nakagawa, S. & Schielzeth, H. A general and simple method for obtaining R2 from generalized linear mixed-effects models. Methods in Ecology and Evolution 4, 133–142 (2013), modified by Johnson, P. C. D. Extension of Nakagawa and Schielzeth’s R2GLMM to random slopes models. Methods in Ecology and Evolution 5, 944–946 (2014).
.
......@@ -85,12 +85,18 @@ list.all.results <-
readRDS.root('output/list.lmer.out.all.NA.simple.set.rds')
library(pander)
mat.param <- do.call('cbind', lapply(c('Wood.density', 'SLA', 'Max.height'),
extract.param, list.res = list.all.results,
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species'))
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species',
param.vec = c("(Intercept)", "logD", "Tf","sumBn",
"sumTnBn","sumTfBn", "sumTnTfBn.abs")))
mat.param.sd <- do.call('cbind', lapply(c('Wood.density', 'SLA', 'Max.height'),
extract.param.sd, list.res = list.all.results,
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species'))
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species',
param.vec = c("(Intercept)", "logD", "Tf","sumBn",
"sumTnBn","sumTfBn", "sumTnTfBn.abs")))
mat.R2c <- do.call('cbind', lapply(c('Wood.density', 'SLA', 'Max.height'),
extract.R2c, list.res = list.all.results,
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species'))
......@@ -108,20 +114,18 @@ mat.param <- rbind(mat.param.mean.sd,
round(mat.R2m, 4),
round(mat.R2c, 4))
colnames(mat.param) <- c('Wood density', 'SLA', 'Maximum height')
row.names(mat.param) <- c('$\\gamma$', '$m_1$', '$\\alpha_0$',
row.names(mat.param) <- c('$m_0$', '$\\gamma$', '$m_1$', '$\\alpha_0$',
'$\\alpha_i$', '$\\alpha_r$',
'$\\alpha_s$', '$R^2_m$*', '$R^2_c$*')
```
``` {r Table2_Effectsize, echo = FALSE, results='asis', message=FALSE}
pandoc.table(mat.param, caption = "Standaridized parameters estimates and standard error (in bracket) estimated for each traits and $R^2$* of models. See Fig 1. in main text for explanation of parameters",
pandoc.table(mat.param[c(1,3,2,4:9), ], caption = "Standaridized parameters estimates and standard error (in bracket) estimated for each traits and $R^2$* of models. See Fig 1. in main text for explanation of parameters",
digits = 3, justify = c('left', rep('right', 3)),
emphasize.strong.cells = bold.index, split.tables = 200)
```
\* We report the conditional and marginal $R^2$ of the models using the methods of Nakagawa, S. & Schielzeth, H. A general and simple method for obtaining R2 from generalized linear mixed-effects models. Methods in Ecology and Evolution 4, 133142 (2013), modified by Johnson, P. C. D. Extension of Nakagawa and Schielzeths R2GLMM to random slopes models. Methods in Ecology and Evolution 5, 944946 (2014).
``` {r }
.
```
......@@ -97,9 +97,11 @@ Table: Traits coverage in each sites. Percentage of species with species level t
-------------------------------------------------------------------------
&nbsp; Wood density SLA Maximum height
---------------- ------------------ ------------------ ------------------
**$\gamma$** **0.441 (0.014)** **0.409 (0.014)** **0.429 (0.013)**
**$m_0$** **0.218 (0.099)** 0.115 (0.099) **0.247 (0.072)**
**$m_1$** **-0.121 (0.039)** **0.115 (0.051)** 0.067 (0.044)
**$m_1$** **-0.121 (0.039)** **0.115 (0.051)** **0.067 (0.044)**
**$\gamma$** **0.441 (0.014)** **0.409 (0.014)** 0.429 (0.013)
**$\alpha_0$** **-0.308 (0.058)** **-0.259 (0.069)** **-0.349 (0.066)**
......@@ -118,12 +120,5 @@ Table: Standaridized parameters estimates and standard error (in bracket) estima
\* We report the conditional and marginal $R^2$ of the models using the methods of Nakagawa, S. & Schielzeth, H. A general and simple method for obtaining R2 from generalized linear mixed-effects models. Methods in Ecology and Evolution 4, 133–142 (2013), modified by Johnson, P. C. D. Extension of Nakagawa and Schielzeth’s R2GLMM to random slopes models. Methods in Ecology and Evolution 5, 944–946 (2014).
```r
.
```
```
## Error in eval(expr, envir, enclos): object '.' not found
```
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