Calculating a goal model with only national-level data
Opened this issue · 0 comments
Here is a question that often comes up: what if there is a goal where you only have data at the at the national level (example: region_id 0), not for each region (example: region_id 1 to 8)? While there are ways to try to allocate the data to smaller spatial scales, they have a lot of assumptions and are dependent on a lot of things that aren't very transparent.
Instead, it's possible to calculate the status for region_id 0 and then allocate the status score to the other regions (you can also do this with trend if you need to). This will give the same status score to each region, but pressures and resilience layers can still act differently on each region.
Here is some code to illustrate (and also now in the toolbox-demo)
LSP_ex <- function(layers){
### an example when there are only data available for the entire assessment area, not for each region.
### our assessment area has 8 regions...
## total offshore/inland areas
inland <- layers$data$rgn_area_inland1km %>%
select(region_id = rgn_id, area_inland1km = area); inland
offshore <- layers$data$rgn_area_offshore3nm %>%
select(region_id = rgn_id, area_offshore3nm = area); offshore
## total protected
inland_prot <- layers$data$lsp_prot_area_inland1km %>%
select(region_id = rgn_id, cmpa = a_prot_1km, year); inland_prot
offshore_prot <- layers$data$lsp_prot_area_offshore3nm %>%
select(region_id = rgn_id, cp = a_prot_3nm, year); offshore_prot
### ...but let's pretend we only had data for the entire assessment area and not those regions:
inland <- data_frame(region_id = 0, area_in = 175147)
offshore <- data_frame(region_id = 0, area_off = 621887.8)
inland_prot <- data_frame(region_id = 0, cmpa = 15369.5)
offshore_prot <- data_frame(region_id = 0, cp = 30635.50)
## combine to one dataframe
lsp_data <- inland %>%
left_join(inland_prot) %>%
left_join(offshore) %>%
left_join(offshore_prot)
### you can calculate the status for just this overall assessment area, and then apply the status score to all the regions so that the Toolbox can calculate the pressures/resilience for those regions.
## model
status_0 <- lsp_data %>%
dplyr::mutate(score = area_in/cp + area_off/cmpa)
## apply to all regions
status <- data_frame(region_id = 1:8,
score = status_0$score) %>%
mutate(goal = "LSP",
dimension = "status") %>%
arrange(goal, dimension, region_id, score)
}