Skip to content
Snippets Groups Projects
Commit 24a1f3d2 authored by Maria Voigt's avatar Maria Voigt
Browse files

updating the ac-testing script

parents 4afa6bbd 2ed6e4ff
No related branches found
No related tags found
No related merge requests found
...@@ -242,8 +242,21 @@ predictors_obs$y_center <- as.numeric(as.vector(scale(predictors_obs[ , ...@@ -242,8 +242,21 @@ predictors_obs$y_center <- as.numeric(as.vector(scale(predictors_obs[ ,
"unscaled_y_center"]))) "unscaled_y_center"])))
# work on aerial transects # ou density and offset term for ground and absence transects
other_predictors_obs <- filter(predictors_obs, group != "aerial")
# density
other_predictors_obs$ou_dens <- (other_predictors_obs$nr_nests/
(other_predictors_obs$length_km * ESW * 2)) *
(1/(other_predictors_obs$nest_decay * NCS * PNB))
# offset
other_predictors_obs$offset_term <- log(other_predictors_obs$length_km * ESW *
2 * other_predictors_obs$nest_decay *
NCS * PNB)
# ou density and offset term for aerial transects
if (include_aerial == T){
aerial_predictors_obs <- dplyr::filter(predictors_obs, group == "aerial") aerial_predictors_obs <- dplyr::filter(predictors_obs, group == "aerial")
# density # density
aerial_predictors_obs$ou_dens <- (aerial_predictors_obs$nr_nests/ aerial_predictors_obs$ou_dens <- (aerial_predictors_obs$nr_nests/
...@@ -254,22 +267,14 @@ aerial_predictors_obs$offset_term <- log(aerial_predictors_obs$length_km * ESW_a ...@@ -254,22 +267,14 @@ aerial_predictors_obs$offset_term <- log(aerial_predictors_obs$length_km * ESW_a
2 * aerial_predictors_obs$nest_decay * 2 * aerial_predictors_obs$nest_decay *
NCS * PNB) NCS * PNB)
# work on ground transects predictors_obs <- aerial_predictors_obs %>%
other_predictors_obs <- filter(predictors_obs, group != "aerial") bind_rows(other_predictors_obs)
# density }else{
other_predictors_obs$ou_dens <- (other_predictors_obs$nr_nests/ predictors_obs <- other_predictors_obs
(other_predictors_obs$length_km * ESW * 2)) * }
(1/(other_predictors_obs$nest_decay * NCS * PNB))
# offset
other_predictors_obs$offset_term <- log(other_predictors_obs$length_km * ESW *
2 * other_predictors_obs$nest_decay *
NCS * PNB)
names_predictors_obs <- names(other_predictors_obs)
# bind the two together # bind the two together
predictors_obs <- aerial_predictors_obs %>% predictors_obs <- predictors_obs %>%
bind_rows(other_predictors_obs) %>%
arrange(id) %>% arrange(id) %>%
dplyr::select(id, group, x_start:LU, length_km:nest_decay, dplyr::select(id, group, x_start:LU, length_km:nest_decay,
year, deforestation_gaveau:temp_mean, x_center, y_center, year, deforestation_gaveau:temp_mean, x_center, y_center,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment