Descriptive analysis of products
Source:vignettes/articles/descriptive-analysis-products.Rmd
descriptive-analysis-products.Rmd
This article shows how to calculate the descriptive analysis of products for emission and sector profile.
Distinct europages products
Input
companies_id | company_name | country | company_city | postcode | address | main_activity | clustered | min_headcount | max_headcount |
---|---|---|---|---|---|---|---|---|---|
Output
cat("Distinct europages products:", n_distinct(example_europages_companies$clustered))
Distinct europages products: 2
Distinct europages products that matched to ecoinvent
Input
companies_id | product | grouping_emission | emission_category |
---|---|---|---|
comp_1 | a | all | high |
comp_1 | b | all | high |
comp_1 | c | all | high |
comp_1 | d | NA | NA |
comp_1 | e | NA | NA |
comp_2 | a | all | high |
comp_2 | b | all | high |
comp_2 | c | all | high |
comp_3 | d | NA | NA |
comp_3 | e | NA | NA |
Output
cat("Distinct europages products:", n_distinct(matched_ecoinvent$product))
Distinct europages products: 3
Distinct europages products that have
sector_target
Input
companies_id | product | sector_target | sector_category |
---|---|---|---|
comp_1 | a | 0.12 | high |
comp_1 | b | 0.96 | high |
comp_1 | c | 0.64 | high |
comp_1 | d | NA | NA |
comp_1 | e | NA | NA |
comp_2 | a | 0.12 | high |
comp_2 | b | 0.96 | high |
comp_2 | c | 0.64 | high |
comp_3 | d | NA | NA |
comp_3 | e | NA | NA |
Output
cat("Distinct europages products:", n_distinct(products_sector_target$product))
Distinct europages products: 3
Average amount of distinct ep products per company for emission profile if the company have atleast one matched ecoinvent product
avg_distinct_products_per_company_atleast_one_matched_ecoinvent <- function(data, col) {
companies_with_atleast_one_matched_product <- data |>
select(all_of(c("companies_id", "product", col))) |>
filter(!is.na(.data[[col]])) |>
distinct()
result <- data |>
select(all_of(c("companies_id", "product"))) |>
filter(companies_id %in% companies_with_atleast_one_matched_product$companies_id) |>
mutate(distinct_products_per_company = n_distinct(product, na.rm = TRUE), .by = "companies_id") |>
select(-all_of(c("product"))) |>
distinct()
sum(result$distinct_products_per_company) / n_distinct(result$companies_id)
}
cat("Average amount of distinct ep products per company for emission profile if the company have atleast one matched ecoinvent product:", avg_distinct_products_per_company_atleast_one_matched_ecoinvent(example_emission_profile, "emission_category"))
Average amount of distinct ep products per company for emission profile if the company have atleast one matched ecoinvent product: 4
Average amount of ep distinct products per company for sector profile if the company have atleast one product with sector target
cat("Average amount of distinct ep products per company for sector profile if the company have atleast one product with sector target:", avg_distinct_products_per_company_atleast_one_matched_ecoinvent(example_sector_profile, "sector_category"))
Average amount of distinct ep products per company for sector profile if the company have atleast one product with sector target: 4
Average amount of distinct ep products per company for transition risk profile if the company have atleast one product with transition risk category
Input
companies_id | product | grouping_transition_risk | transition_risk_category |
---|---|---|---|
comp_1 | a | 1.5C RPS_2030_all | high |
comp_1 | b | 1.5C RPS_2030_all | high |
comp_1 | c | 1.5C RPS_2030_all | high |
comp_1 | d | NA | NA |
comp_1 | e | NA | NA |
comp_2 | a | 1.5C RPS_2030_all | high |
comp_2 | b | 1.5C RPS_2030_all | high |
comp_2 | c | 1.5C RPS_2030_all | high |
comp_3 | d | NA | NA |
comp_3 | e | NA | NA |
cat("Average amount of distinct ep products per company for sector profile if the company have atleast one product with transition risk category:", avg_distinct_products_per_company_atleast_one_matched_ecoinvent(example_transition_risk_profile, "transition_risk_category"))
Average amount of distinct ep products per company for sector profile if the company have atleast one product with transition risk category: 4
Average amount of distinct ep products per company
cat("Average amount of distinct ep products per company: ", avg_distinct_products_per_company(example_transition_risk_profile))
Average amount of distinct ep products per company: 3.333333
Distinct ep products without a risk category for emission, sector, and transition risk profile
cat("Distinct ep products without a risk category for emission profile:", distinct_products_without_risk_category(example_emission_profile, "emission_category"))
Distinct ep products without a risk category for emission profile: 2
cat("Distinct ep products without a risk category for sector profile:", distinct_products_without_risk_category(example_sector_profile, "sector_category"))
Distinct ep products without a risk category for sector profile: 2
cat("Distinct ep products without a risk category for transition risk profile:", distinct_products_without_risk_category(example_transition_risk_profile, "transition_risk_category"))
Distinct ep products without a risk category for transition risk profile: 2
Average profile ranking of all ep products per grouping_emission
Input
product | grouping_emission | emission_rank |
---|---|---|
tent | all | 1.0000000 |
tent | tilt_subsector | 1.0000000 |
surface engineering | all | 0.3333333 |
surface engineering | tilt_subsector | 1.0000000 |
Output
avg_profile_ranking_df <- profile_rank_df |>
mutate(sum_profile_ranking = sum(.data$emission_rank, na.rm = TRUE), .by = "grouping_emission") |>
mutate(distinct_products_per_benchmark = n_distinct(.data$product, na.rm = TRUE), .by = "grouping_emission") |>
mutate("emission rank average" = sum_profile_ranking/distinct_products_per_benchmark) |>
select(-all_of(c("sum_profile_ranking", "distinct_products_per_benchmark", "emission_rank", "product"))) |>
distinct()
grouping_emission | emission rank average |
---|---|
all | 0.6666667 |
tilt_subsector | 1.0000000 |
Average reduction targets of all ep products per grouping_sector
Average transition risk scores of all ep products per tilt_subsector benchmarks
Input
product | grouping_transition_risk | transition_risk_score |
---|---|---|
tent | 1.5C RPS_2030_all | 0.5900000 |
tent | 1.5C RPS_2050_all | 0.9900000 |
tent | NZ 2050_2030_all | 0.7000000 |
tent | NZ 2050_2050_all | 0.9850000 |
tent | 1.5C RPS_2030_tilt_subsector | 0.5900000 |
tent | 1.5C RPS_2050_tilt_subsector | 0.9900000 |
tent | NZ 2050_2030_tilt_subsector | 0.7000000 |
tent | NZ 2050_2050_tilt_subsector | 0.9850000 |
surface engineering | 1.5C RPS_2030_all | 0.2116667 |
surface engineering | 1.5C RPS_2050_all | 0.6416667 |
Output
group | scenario | transition risk average |
---|---|---|
all | 1.5C RPS_2030 | 0.4008333 |
1.5C RPS_2050 | 0.8158333 | |
NZ 2050 | 0.4883333 | |
NZ 2050 | 0.8158333 | |
tilt_subsector | 1.5C RPS_2030 | 0.5675000 |
1.5C RPS_2050 | 0.9825000 | |
NZ 2050 | 0.6550000 | |
NZ 2050 | 0.9825000 |
Average NA share per company
Companies with atleast one matched ecoinvent product for emission profile
companies_id | product | emission_category |
---|---|---|
asteria_megalotomusquinquespinosus | tent | high |
skarn_gallinule | sheds, construction site | high |
relegable_southernhairnosedwombat | tent | high |
psychodelic_airedale | tent | high |
ergophilic_fieldspaniel | tent | high |
preexistent_africanmolesnake | tent | high |
wealthy_ocelot | tent | high |
fulltime_mollusk | tent | high |
gentlemanlike_asiaticlesserfreshwaterclam | tent | high |
frowsy_metalmarkbutterfly | tent | high |
Average NA share per company which have atleast one matched ecoinvent product for emission profile
companies_id | emission_category_NA |
---|---|
asteria_megalotomusquinquespinosus | 0 |
skarn_gallinule | 0 |
relegable_southernhairnosedwombat | 0 |
psychodelic_airedale | 0 |
ergophilic_fieldspaniel | 0 |
preexistent_africanmolesnake | 0 |
wealthy_ocelot | 0 |
fulltime_mollusk | 0 |
gentlemanlike_asiaticlesserfreshwaterclam | 0 |
frowsy_metalmarkbutterfly | 0 |
cat("Average NA share per company with atleast one matched ecoinvent product for emission profile:", average_na_emission_profile)
Average NA share per company with atleast one matched ecoinvent product for emission profile: 0
Companies with atleast one product with sector category/sector target
companies_id | product | emission_category |
---|---|---|
asteria_megalotomusquinquespinosus | tent | high |
skarn_gallinule | sheds, construction site | high |
relegable_southernhairnosedwombat | tent | high |
psychodelic_airedale | tent | high |
ergophilic_fieldspaniel | tent | high |
preexistent_africanmolesnake | tent | high |
wealthy_ocelot | tent | high |
fulltime_mollusk | tent | high |
gentlemanlike_asiaticlesserfreshwaterclam | tent | high |
frowsy_metalmarkbutterfly | tent | high |
Average NA share per company which have atleast one product with sector category
companies_id | sector_category_NA |
---|---|
asteria_megalotomusquinquespinosus | 0 |
skarn_gallinule | 0 |
relegable_southernhairnosedwombat | 0 |
psychodelic_airedale | 0 |
ergophilic_fieldspaniel | 0 |
preexistent_africanmolesnake | 0 |
wealthy_ocelot | 0 |
fulltime_mollusk | 0 |
gentlemanlike_asiaticlesserfreshwaterclam | 0 |
frowsy_metalmarkbutterfly | 0 |
cat("Average NA share per company with atleast one product with sector category:", average_na_sector_profile)
Average NA share per company with atleast one product with sector category: 0
Companies with atleast one product with transition risk category
companies_id | product | transition_risk_category |
---|---|---|
asteria_megalotomusquinquespinosus | tent | high |
asteria_megalotomusquinquespinosus | tent | medium |
skarn_gallinule | sheds, construction site | high |
skarn_gallinule | sheds, construction site | medium |
relegable_southernhairnosedwombat | tent | high |
relegable_southernhairnosedwombat | tent | medium |
psychodelic_airedale | tent | high |
psychodelic_airedale | tent | medium |
ergophilic_fieldspaniel | tent | high |
ergophilic_fieldspaniel | tent | medium |
Average NA share per company which have atleast one product with transition risk category
companies_id | transition_risk_NA_share |
---|---|
asteria_megalotomusquinquespinosus | 0 |
skarn_gallinule | 0 |
relegable_southernhairnosedwombat | 0 |
psychodelic_airedale | 0 |
ergophilic_fieldspaniel | 0 |
preexistent_africanmolesnake | 0 |
wealthy_ocelot | 0 |
fulltime_mollusk | 0 |
gentlemanlike_asiaticlesserfreshwaterclam | 0 |
frowsy_metalmarkbutterfly | 0 |
cat("Average NA share per company with atleast one product with transition risk category:", average_na_transition_risk_profile)
Average NA share per company with atleast one product with transition risk category: 0