<b><i>Simulation study comparing number of sampled reefs</i></b>
收藏资源简介:
This repository contains all the scripts and data used in the simulation study titled <i>“Simulation study comparing number of sampled reefs”, </i>presented in the manuscript <i>“Longer time series with missing data improve parameter estimation in State-Space mode in coral reef fish communities”</i>. There are 66 files in total.All model fits were run on the HPC cluster at James Cook University. Depending on the simulated dataset, run times ranged from several hours up to 1-2 days per fit.<b>Simulated data</b><b>multisp_sim_dat_reefs.R</b>: Simulates communities of 20 species across 40 reefs. We used this script to generate 20 simulated communities, which were saved as <b>sim_40vs20_s1.RData</b> through <b>sim_40vs20_s20.RData</b>.<b>Model fitting to simulated data</b><b>fit_20reefs.R</b>: Script to implement the <i>20 reefs fit</i> from the manuscript. For each simulated dataset, it: 1) saves posterior model parameters, 2) computes diagnostics (divergent transitions, tree depth saturation, E-BFMI), and 3) generates effective sample size (ESS) and R-hat plots. Example output: input simulated dataset <b>sim_40vs20_s1.RData </b>and the output <b>fit_20r_s1.RData</b>. We include all fit output files up to <b>fit_20r_s20.RData</b>. We did not include the diagnostic figures in this repository, but users can get them by running the code.<b>fit_40reefs.R</b>: Script to implement the <i>40 reefs fit</i> from the manuscript. It follows the same process as above. Output files range from <b>fit_40r_s1.RData </b>up to<b> fit_40r_s20.RData</b><b>Stan model</b><b>MARPLN_LV.stan</b>: Stan code for the multivariate autoregressive Poisson-Lognormal model with the latent variables. This model is used in the file <b>fit_20reefs.R</b><b>MARPLN_LV_withNA.stan</b>: Same as the model above, but it can also handle missing data. This model is used in the file<b> fit_40reefs.R.</b><b>Figure and analysis script</b><b>Figure 3.R</b>: This script calculates the accuracy and precision estimates for all key parameters across simulations and generates Figure 3 from the manuscript.<br>



