-
Notifications
You must be signed in to change notification settings - Fork 0
/
countycal2017.R
188 lines (184 loc) · 7.35 KB
/
countycal2017.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
library(PoPS)
library(terra)
# library(plyr)
# Note that the google drive might have a different letter
ffIn <- "Z:/Late_blight/"
ffout <- "Z:/Late_blight/modelresults/"
# This has all the time steps for a calibration/validation duration
infected_years_file = paste0(ffIn, "infections/gpkg/years/2017/inf_years_file_2017.gpkg")#"infections/rasters/2017/usa_2017_infections.tif")
number_of_observations = 115
prior_number_of_observations = 2303
prior_means = c(0, 0, 0, 0, 0, 0)
prior_cov_matrix = matrix(0, 6, 6)
params_to_estimate = c(TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)
number_of_generations = 7
generation_size = 1000
pest_host_table = paste0(ffIn, "hosts/pest_host_table_lb.csv")
competency_table = paste0(ffIn, "hosts/competency_table_original.csv")
# This is the starting infection for a calibration/validation perio
infected_file_list = paste0(ffIn, "infections/gpkg/filelist/2017/inf_filelist_2017.gpkg")
host_file_list = paste0(ffIn, "hosts/host_2017_nona.tif")
total_populations_file = paste0(ffIn, "all_populations/tot_pop_2017_nona.tif")
temp = TRUE
temperature_coefficient_file = paste0(ffIn, "Weather_data/weather_us_2017.tif")
precip = FALSE
precipitation_coefficient_file = ""
model_type = "SI"
latency_period = 0
time_step = "week"
season_month_start = 1
season_month_end = 12
start_date = "2017-01-01"
end_date = "2017-12-31"
use_survival_rates = FALSE
survival_rate_month = 3
survival_rate_day = 15
survival_rates_file = ""
use_lethal_temperature = FALSE
temperature_file = ""
lethal_temperature = 5
lethal_temperature_month = 1
mortality_frequency = "week"
mortality_frequency_n = 1
management = FALSE
treatment_dates = c("")
treatments_file = ""
treatment_method = "ratio"
natural_kernel_type = "cauchy"
anthropogenic_kernel_type = "cauchy"
natural_dir = "NONE"
natural_kappa = 0
anthropogenic_dir = "NONE"
anthropogenic_kappa = 0
pesticide_duration = c(0)
pesticide_efficacy = 1
mask = NULL
output_frequency = "week"
output_frequency_n = 1
movements_file = ""
use_movements = FALSE
start_exposed = FALSE
generate_stochasticity = TRUE
establishment_stochasticity = TRUE
movement_stochasticity = TRUE
dispersal_stochasticity = TRUE
establishment_probability = 0.5
dispersal_percentage = 0.99
quarantine_areas_file = ""
use_quarantine = FALSE
use_spreadrates = FALSE
use_overpopulation_movements = FALSE
overpopulation_percentage = 0
leaving_percentage = 0
leaving_scale_coefficient = 1
calibration_method = "ABC"
number_of_iterations = 1e+05
exposed_file_list = ""
verbose = TRUE
write_outputs = "None"
output_folder_path = ffout
network_filename = ""
network_movement = "walk"
success_metric = "mcc"
use_initial_condition_uncertainty = FALSE
use_host_uncertainty = FALSE
weather_type = "deterministic"
temperature_coefficient_sd_file = ""
precipitation_coefficient_sd_file = ""
dispersers_to_soils_percentage = 0
quarantine_directions = ""
multiple_random_seeds = FALSE
file_random_seeds = NULL
use_soils = FALSE
soil_starting_pest_file = ""
start_with_soil_populations = FALSE
county_level_infection_data = TRUE
#started at 20:35 on 4/19
# Started at 9 on 2/13
lb_cal = calibrate(infected_years_file,
number_of_observations,
prior_number_of_observations,
prior_means,
prior_cov_matrix,
params_to_estimate,
number_of_generations,
generation_size,
pest_host_table,
competency_table,
infected_file_list,
host_file_list,
total_populations_file,
temp,
temperature_coefficient_file,
precip,
precipitation_coefficient_file,
model_type,
latency_period,
time_step,
season_month_start,
season_month_end,
start_date,
end_date,
use_survival_rates,
survival_rate_month,
survival_rate_day,
survival_rates_file,
use_lethal_temperature,
temperature_file,
lethal_temperature,
lethal_temperature_month,
mortality_frequency,
mortality_frequency_n,
management,
treatment_dates,
treatments_file,
treatment_method,
natural_kernel_type,
anthropogenic_kernel_type,
natural_dir,
natural_kappa,
anthropogenic_dir,
anthropogenic_kappa,
pesticide_duration,
pesticide_efficacy,
mask,
output_frequency,
output_frequency_n,
movements_file,
use_movements,
start_exposed,
generate_stochasticity,
establishment_stochasticity,
movement_stochasticity,
dispersal_stochasticity,
establishment_probability,
dispersal_percentage,
quarantine_areas_file,
use_quarantine,
use_spreadrates,
use_overpopulation_movements,
overpopulation_percentage,
leaving_percentage,
leaving_scale_coefficient,
calibration_method,
number_of_iterations,
exposed_file_list,
verbose,
write_outputs,
output_folder_path,
network_filename,
network_movement,
success_metric,
use_initial_condition_uncertainty,
use_host_uncertainty,
weather_type,
temperature_coefficient_sd_file,
precipitation_coefficient_sd_file,
dispersers_to_soils_percentage,
quarantine_directions,
multiple_random_seeds,
file_random_seeds,
use_soils,
soil_starting_pest_file,
start_with_soil_populations,
county_level_infection_data)