This repository has been archived by the owner on Oct 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added readme text
- Loading branch information
Showing
1 changed file
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |