egouldo / ManyEcoEvo

Software for analysing Many-Analysts' style data and generating the ManyEcoEvo project data
https://egouldo.github.io/ManyEcoEvo/
GNU General Public License v3.0
2 stars 0 forks source link

exclude analysis from euc yi meta-analysis #145

Closed egouldo closed 1 month ago

egouldo commented 2 months ago

exclude response var average.proportion.of.plots.containing.at.least.one.euc.seedling.of.any.size from yi meta-analysis since is not on same scale as all other variables.

library(ManyEcoEvo)
#> Loading required package: rmarkdown
#> Loading required package: bookdown
#> Registered S3 method overwritten by 'parsnip':
#>   method          from 
#>   print.nullmodel vegan
#> Registered S3 method overwritten by 'lava':
#>   method         from    
#>   print.estimate EnvStats
library(tidyverse)

ManyEcoEvo_constructed_vars <-
  tribble(
    ~response_variable_name,
    "euc_sdlgs_all",
    "euc_sdlgs>50cm",
    "euc_sdlgs0_2m",
    "small*0.25+medium*1.25+large*2.5",
    "euc_sdlgs50cm_2m",
    "average.proportion.of.plots.containing.at.least.one.euc.seedling.of.any.size",
    "day_14_weight/(day_14_tarsus_length^2)",
    "day_14_weight/day_14_tarsus_length",
    "day_14_weight*day_14_tarsus_length"
  )

# Analyst Constructed Variables
all_constructed_vars <-
  ManyEcoEvo %>%
  pull(data, dataset) %>%
  list_rbind(names_to = "dataset") %>%
  filter(str_detect(response_variable_type, "constructed")) %>%
  distinct(dataset, response_variable_name) %>%
  drop_na() %>%
  arrange()

by <- join_by(response_variable_name)

excluded_yi_constructed <-
  ManyEcoEvo %>%
  pull(data, dataset) %>%
  list_rbind(names_to = "dataset") %>%
  filter(str_detect(response_variable_type, "constructed")) %>%
  distinct(dataset, id_col, TeamIdentifier, response_variable_name) %>%
  drop_na() %>%
  anti_join(ManyEcoEvo_constructed_vars, by)

n_dropped_analyses <-
  excluded_yi_constructed %>%
  n_distinct("id_col")

n_teams_w_dropped_analyses <-
  excluded_yi_constructed %>%
  group_by(TeamIdentifier) %>%
  count() %>%
  n_distinct("TeamIdentifier")

# Constructed Variables Included in the ManyAnalysts meta-analysis
all_constructed_vars %>%
  semi_join(ManyEcoEvo_constructed_vars, by) %>%
  mutate(included_in_yi = TRUE) %>%
  bind_rows({
    all_constructed_vars %>%
      anti_join(ManyEcoEvo_constructed_vars, by) %>%
      mutate(included_in_yi = FALSE)
  })
#> # A tibble: 14 × 3
#>    dataset    response_variable_name                              included_in_yi
#>    <chr>      <chr>                                               <lgl>         
#>  1 blue tit   day_14_weight/day_14_tarsus_length                  TRUE          
#>  2 blue tit   day_14_weight/(day_14_tarsus_length^2)              TRUE          
#>  3 eucalyptus euc_sdlgs0_2m                                       TRUE          
#>  4 eucalyptus euc_sdlgs_all                                       TRUE          
#>  5 eucalyptus euc_sdlgs>50cm                                      TRUE          
#>  6 eucalyptus small*0.25+medium*1.25+large*2.5                    TRUE          
#>  7 eucalyptus average.proportion.of.plots.containing.at.least.on… TRUE          
#>  8 blue tit   SMI                                                 FALSE         
#>  9 blue tit   day_14_tarsus_length_group_deviation                FALSE         
#> 10 blue tit   day_14_weight_group_deviation                       FALSE         
#> 11 blue tit   PC1.day_14_weight.day_14_tarsus_length              FALSE         
#> 12 blue tit   day_14_tarsus_length_deviation                      FALSE         
#> 13 blue tit   residual_day14_weight                               FALSE         
#> 14 blue tit   residual_day_14_weight_males                        FALSE

Created on 2024-09-02 with reprex v2.1.0