Skip to content

Commit

Permalink
update species lists
Browse files Browse the repository at this point in the history
  • Loading branch information
aekendig committed Jan 25, 2022
1 parent 2ef19d0 commit b73cac9
Show file tree
Hide file tree
Showing 5 changed files with 2,106 additions and 2,075 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ vignettes/*.pdf

# Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html
rsconnect/

# large file
intermediate-data/hs_US_records_080421.csv
26 changes: 26 additions & 0 deletions code/risk_score_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,24 @@ mod2 <- update(mod1, .~. - Terrestrial)
anova(mod1, mod2)
# okay to remove terrestrial

mod_summ <- tibble(Variable = "habitat (terrestrial vs. aquatic)",
ChiSq = anova(mod1, mod2)[2, "LR stat."],
df = anova(mod1, mod2)[2, " df"],
P = anova(mod1, mod2)[2, "Pr(Chi)"])

summary(mod2)
# counts are not sig

mod3 <- update(mod2, .~. - countS)
anova(mod2, mod3)
# remove

mod_summ2 <- mod_summ %>%
add_row(Variable = "records in US",
ChiSq = anova(mod2, mod3)[2, "LR stat."],
df = anova(mod2, mod3)[2, " df"],
P = anova(mod2, mod3)[2, "Pr(Chi)"])

summary(mod3)

# test significance of each remaining
Expand All @@ -183,6 +194,21 @@ anova(mod3, mod5)
mod6 <- update(mod3, .~. - earlYearS)
anova(mod3, mod6)

# model table
mod_summ3 <- mod_summ2 %>%
add_row(Variable = "assessor",
ChiSq = anova(mod3, mod4)[2, "LR stat."],
df = anova(mod3, mod4)[2, " df"],
P = anova(mod3, mod4)[2, "Pr(Chi)"]) %>%
add_row(Variable = "certainty",
ChiSq = anova(mod3, mod5)[2, "LR stat."],
df = anova(mod3, mod5)[2, " df"],
P = anova(mod3, mod5)[2, "Pr(Chi)"]) %>%
add_row(Variable = "earliest US record",
ChiSq = anova(mod3, mod6)[2, "LR stat."],
df = anova(mod3, mod6)[2, " df"],
P = anova(mod3, mod6)[2, "Pr(Chi)"])


#### diagnostics ####

Expand Down
8 changes: 5 additions & 3 deletions code/taxa_list_processing.R
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ syn_cabi10[!complete.cases(syn_cabi10),] %>%
# some occurrences missing

# save
write_csv(syn_cabi10, "intermediate-data/horizon_scan_all_names_plant_list_011522")
write_csv(syn_cabi10, "intermediate-data/horizon_scan_all_names_plant_list_011522.csv")

# summarize
acc_fin <- syn_cabi10 %>%
Expand All @@ -1068,9 +1068,11 @@ acc_fin <- syn_cabi10 %>%
summarize(Atlas = as.numeric(sum(Atlas) > 0),
climate = as.numeric(sum(climate) > 0),
acc_name_source = paste(unique(acc_name_source), collapse = ", ")) %>%
ungroup())
ungroup()) %>%
select(acc_name, synonyms, acc_name_source, climate, Atlas, fl_nox, fed_nox, naturalized, weedy, occurrences, occurrences_new)

# 2071 taxa
write_csv(acc_fin, "intermediate-data/horizon_scan_accepted_names_plant_list_011522")
write_csv(acc_fin, "intermediate-data/horizon_scan_accepted_names_plant_list_011522.csv")

# check for missing values
acc_fin[!complete.cases(acc_fin),] %>%
Expand Down
Loading

0 comments on commit b73cac9

Please sign in to comment.