Skip to content
This repository has been archived by the owner on Oct 21, 2021. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Added readme text
  • Loading branch information
flakesw authored Sep 4, 2018
1 parent 19cc719 commit d9a4c03
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# Flake-and-Weisberg-PJ-mortality-analysis
Analysis by Sam Flake, [email protected]
This code takes raw data, found in the folder "Raw Data," processes it into clean analyzable data, and generates all the figures used in the manuscript Flake, S.W., P.J. Weisberg. Accepted. Fine-scale stand structure mediates drought-induced tree mortality in pinyon-juniper woodlands. Ecological Applications.

The first script that should be run is pj_mortality_data_prep_112117.R, which processes the raw data and populates the Clean Data folder. This script merges climate data, plot-level data, and tree-level data. Some plot-level variables (for example, basal area) are aggregated from tree-level data.

After generating clean data, plot_level_analysis_for_paper_061718.R and ind_tree_analysis_for_paper_061718.R can be run. These scripts run all of the analysis for the paper, including variable selection, model fitting, bootstrapping, and validation. It takes processed data from the Clean Data folder and outputs several large files to the model output folder, including saved model objects as .Rds files, which are used for generating figures. This script will take AT LEAST 1 Day to run on a run-of-the-mill laptop, so if you are interested in the analysis, I'd recommend skipping the model dredging and bootstrapping and looking at the exported objects instead.

For each response variable (juniper dieback, pinyon dieback, pinyon mortality), three objects are saved as .Rds files: the model selection object from MuMIn, the output from the bootstrapping process (from package boot), and the final model. The summarized results from model selection (tables in the appendix) and bootstrapping (with confidence intervals) are saved as a .csv file.

The final script generates the effects plots and other figures (Figures 1-6 and Figures S1 and S2). It requires the .rds files for the fitted models as well as the bootstrapped parameter estimates. It also needs the raw data and the clean data generated by the data prep script. Figures are output to the ./plots folder.

The code here is not very well documented and a little spaghetti-stringy, so please contact me if you have any questions.

0 comments on commit d9a4c03

Please sign in to comment.