-
Notifications
You must be signed in to change notification settings - Fork 1
/
maxent_modeling_code.R
149 lines (71 loc) · 4.09 KB
/
maxent_modeling_code.R
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Your sloth species name
# Maxent modeling code
# Your name + your partner's name
# Date
# FIRST STEP: Rename this file by adding your species name and an underscore to the beginning of the file
# (for example, "tridactylus_maxent.R")
# Required packages -------------------------------------------------------
# Load all the packages you need for the analyses
# You need 1) the package for spatial thinning, 2) the package for mapping,
# 3) the packages from background_region_tutorial.Rmd,
# 4) the package used in partitioning occurrences
# Occurrence data ---------------------------------------------------------
# Import the dataset for your species from data/occurrence_data
# Visualize occurrence data -----------------------------------------------
# Use the ggmap package to plot the occurrence points for your species on a map
# Share this map in Slack
# Spatial thinning --------------------------------------------------------
# Refer to your code from intern_code/occ_data_cleaning.R
# (and also lesson_plans/s2_process_occ_data/sloth_cleaning_pt3.Rmd)
# Thin your occurrence data to a distance of 40 km
# Check how many rows were removed by spatial thinning
# Share this number in Slack
# Visualize which points were removed using ggmap
# Create background region ------------------------------------------------
# Refer to lesson_plans/s4_process_env_data/background_region_tutorial.Rmd
# Create a background region for your species (based on the thinned occurrence data!):
## B. variegatus: points buffered by 2 degrees
## B. tridactylus: MCP buffered by 1 degree
## B. torquatus: points buffered by 1 degree
# Make a map of your background region
# Share that map in Slack
# Remember to sample background points from your background region
# Partition occurrence data -----------------------------------------------
# Refer to lesson_plans/s5_partition_occ_data.Rmd
# Partition your thinned occurrence data:
## if your species has 25 or fewer thinned occurrences, use a jackknife partition
## if your species has >25 thinned occurrences, use a block partition
# Visualize the partitioned occurrence data on a map
# Share this map in Slack
# Build Maxent models -----------------------------------------------------
# Refer to lesson_plans/s6_build_eval_niche_model/ENMeval_tutorial.Rmd
# Use regularization multiples from 1 to 5 with a step value of 1
# Use feature classes "L", "LQ", "H", and "LQH"
# Run ENMevaluate()
# and unpack results data frame, list of models, and RasterStack of raw predictions
# Select Maxent model -----------------------------------------------------
# Refer to lesson_plans/s6_build_eval_niche_model/model_selection_tutorial.Rmd
# Sort the results data frame using AUC, OR, and/or AIC
# Select the "best" model according to your criteria
# Slack the name of the best model and the criteria you used to select it
# Visualize model ---------------------------------------------------------
# Generate the model prediction and plot it
# Share this map in Slack
# Project in space --------------------------------------------------------
# Project the model to the background region you selected and plot the projection
# Share this map in Slack
# Project the model to a bounding box for your species and plot the projection
# Share this map in Slack
# Project forward in time --------------------------------------------------------
# Find the resolution of your masked environmental data
# Set two different GCMs: HadGEM2-ES and CCSM4 (we are going to project to 2 different GCMs to compare the results)
# Set three different RCPs: 2.6, 6, and 8.5
# Set the year to be 2070
# Download the data for the 6 different combinations of GCM and RCP (all at the year 2070)
# Set the names of your environmental data
# Crop and mask the environmental data to the bounding box for your species
# Project the model into the future -- you will end up with 6 different projected models
# Plot the projected models
# Response curves --------------------------------------------------------
# Check which variables in the model have non-zero coefficients
# Plot response curves