RMI-PACTA / PACTA_analysis

Run the PACTA analysis on EQ & CB portfolios
Other
25 stars 70 forks source link

multiple observations for same company #28

Closed cjyetman closed 4 years ago

cjyetman commented 4 years ago

In the test data PACTA_2020_TESTS_CJ I found a few examples where a company/technology/year combo has more than one row/observation, with different port_weight and allocation_weight, but the same plan_tech_share, plan_tech_prod and scen_tech_prod (for example). Not sure if that should be possible or not.

library(dplyr)

fs::path('~/Dropbox (2° Investing)/PortCheck_v2/10_Projects/PACTA_2020_TESTS_CJ',
         '40_Results', 'Platform Sample Portfolios','Equity_results_company.rda') %>%
  readRDS() %>% as_tibble() %>%
  filter(investor_name == 'Platform Sample Portfolios',
         portfolio_name == 'MSCI ACWI ETF',
         allocation == 'portfolio_weight',
         scenario == 'B2DS',
         scenario_geography == 'Global',
         year == 2019) %>%
  group_by(id, company_name, technology, year) %>% 
  filter(n() > 1) %>%
  select(id, company_name, ald_sector, technology, year, port_weight, allocation_weight, plan_tech_share, plan_tech_prod, scen_tech_prod) %>%
  arrange(company_name, technology, year)

#> # A tibble: 10 x 10
#> # Groups:   id, company_name, technology, year [5]
#>    id    company_name ald_sector technology  year port_weight allocation_weig…
#>    <chr> <chr>        <chr>      <chr>      <dbl>       <dbl>            <dbl>
#>  1 3042… Anhui Conch… Cement     Grinding    2019   0.0000474        0.0000474
#>  2 3042… Anhui Conch… Cement     Grinding    2019   0.0000214        0.0000214
#>  3 3042… Anhui Conch… Cement     Integrate…  2019   0.0000474        0.0000474
#>  4 3042… Anhui Conch… Cement     Integrate…  2019   0.0000214        0.0000214
#>  5 9808… China Shenh… Coal       Coal        2019   0.0000316        0.0000316
#>  6 9808… China Shenh… Coal       Coal        2019   0.0000310        0.0000310
#>  7 9268… Royal Dutch… Oil&Gas    Gas         2019   0.00430          0.00430  
#>  8 9268… Royal Dutch… Oil&Gas    Gas         2019   0.00376          0.00376  
#>  9 9268… Royal Dutch… Oil&Gas    Oil         2019   0.00430          0.00430  
#> 10 9268… Royal Dutch… Oil&Gas    Oil         2019   0.00376          0.00376  
#> # … with 3 more variables: plan_tech_share <dbl>, plan_tech_prod <dbl>,
#> #   scen_tech_prod <dbl>
Clare2D commented 4 years ago

Sorry I just saw this now. This is possible however we don't want it to be the case. Ie the investor is invested in a company through more than one holding (maybe through a fund for example) hence the company appears more than once. I removed the "holding_id" from the grouping variables to calculate the company results so this should no longer be an issue. Would have to check however in which branch this has gone through though.