-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparameters_descr.qmd
35 lines (30 loc) · 3.04 KB
/
parameters_descr.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Parameters {#sec-parameters}
We stored the parameters for the demographic models in an ownCloud folder, which you can access via this link: [doc.ielab.usherbrooke.ca/s/83YSAiLAGeLm682](https://doc.ielab.usherbrooke.ca/s/83YSAiLAGeLm682).
The code used for model fitting, post-processing of model outputs, and diagnostic generation are available in the [github.com/willvieira/TreesDemography](https://github.com/willvieira/TreesDemography) GitHub repository.
Specifically, for each demographic model, the script `R/preparePosterior.R` is used to transform Stan outputs into tidy RDS formats.
These tidy parameters are stored in the folder named `output_sim_processed`, which is organized into subfolders for each demographic model.
Within each demographic model folder are subfolders containing the fitted parameters for different models, ranging from the simplest intercept-only model (`intcpt`) to the more complete model (`intcpt_plot_comp_clim`).
Inside each model folder, the parameters files are the `posterior_pop_spID.RDS` and `posterior_plot_spID.RDS,` where the *pop* refers to the species-level parameters, the *plot* for the plot-specific posterior draws, and *spID* to the species ID described in @tbl-tabSpecies.
Within each model folder, you will find parameter files named `posterior_pop_spID.RDS` and `posterior_plot_spID.RDS,` where *pop* refers to the species-level parameters, *plots* represents plot-specific posterior draws, and *spID* the species ID described in @tbl-tabSpecies.
The `R/preparePosterior.R` script produces the `diagnostics_spID.RDS` and `loo_spID.RDS` files.
The former contains diagnostic summary information from the Stan fit, including divergent transitions, E-BFMI (Effective Bayesian Fraction of Missing Information), and $\hat{R}$ statistics.
The latter file contains the output of the Leave-One-Out Cross-Validation (LOO-CV).
Furthermore, the model folders contain predictive performance metrics generated in the `MCMCdiagnostics_vitalRate.Rmd` report document.
Specifically, it should contain the files `MSE.RDS` (Mean Squared Error) and `R2.RDS` ($R^2$) for the growth and recruitment models and the `accur.RDS` (accuracy) and `R2.RDS` for the survival model.
Specifically, these folders contain the files `MSE.RDS` (Mean Squared Error) and `R2.RDS` ($R^2$) for the growth and recruitment models and `accur.RDS` (accuracy) and `R2.RDS` for the survival model.
The `output_sim_processed` folder tree structure should look like this:
```{r folderTree,echo=FALSE,eval=TRUE,cache=FALSE,warning=FALSE,message=FALSE}
# list all directories recursively
all_files <- list.dirs(file.path(readLines('_data.path'), 'output_sim_processed'), recursive = TRUE)
# replace my own file path to the parameter example
path <- gsub(
'/Users/wvieira/ownCloud/thesisData/',
'',
all_files
)
# print following this example: https://stackoverflow.com/a/36096923/6532002
x <- lapply(strsplit(path, "/"), function(z) as.data.frame(t(z)))
x <- plyr::rbind.fill(x)
x$pathString <- apply(x, 1, function(x) paste(trimws(na.omit(x)), collapse="/"))
print(data.tree::as.Node(x))
```