Rows: 424 Columns: 18
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (10): ticker, name, asset_class, sub_asset_class, region, market, locat...
dbl (6): gross_expense_ratio_percent, net_expense_ratio_percent, net_asset...
dttm (2): incept_date, net_assets_as_of
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
blackrock_etf_screener |># Filter only contains ESG fundsfilter(sustainable_classification =="Uplift"| sustainable_classification =="Thematic"| sustainable_classification =="Impact"| sustainable_classification =="Screened") |># Keep the largest fund from each sustainable classificationgroup_by(sustainable_classification) |>mutate(total_assets =sum(net_assets_usd)) |>slice_max(net_assets_usd, n =1) |># Calculate the percent of assets that the top fund comprises for its categorymutate(percent_assets = (net_assets_usd / total_assets) *100) |># Ranks each sustainable classificationarrange(desc(percent_assets))
# Use the packagelibrary(ggplot2)# Select 10 10 smallest ETFsblackrock_etf_screener |>slice_min(net_assets_usd, n =10) |>mutate(name =fct_reorder(name, net_assets_usd)) |># Plot the sorted bar chartggplot(aes(x = net_assets_usd, y = name)) +geom_bar(stat ="identity", fill ="yellow", alpha = .7) +scale_x_continuous(labels = scales::label_dollar(scale =1/10^3, suffix =" tn")) +labs(title ="Fund Size of 10 smallest ETFs",x ="Assets (USD)",y ="Name of EFTs",caption ="Haotian Duan") +theme_minimal()
2.5.0.3 Homework problem 3
# The funds in the bottom quintile of the MSCI ESG quality scoreblackrock_etf_screener |>mutate(score_decile =ntile(msci_esg_quality_score_0_10, n =5)) |>filter(score_decile ==1) |># Calculate the number of funds by total assets by asset classgroup_by(asset_class) |>summarize(n_funds =n(),total_assets =sum(net_assets_usd, na.rm =TRUE) )
# A tibble: 3 × 3
asset_class n_funds total_assets
<chr> <int> <dbl>
1 Equity 51 327053099481.
2 Fixed Income 21 56249713527.
3 Real Estate 4 7145439523.
# Calculate the number of funds by total assets by sub asset classblackrock_etf_screener |>mutate(score_decile =ntile(msci_esg_quality_score_0_10, n =5)) |>filter(score_decile ==1) |>group_by(sub_asset_class) |>summarize(n_funds =n(),total_assets =sum(net_assets_usd, na.rm =TRUE) )
# A tibble: 9 × 3
sub_asset_class n_funds total_assets
<chr> <int> <dbl>
1 All Cap 23 95486052602.
2 Corporates 1 41339182.
3 Credit 1 408038372.
4 Government 3 17560711395.
5 High Yield 16 38239624578.
6 Large Cap 1 1852506812.
7 Large/Mid Cap 10 42421984678.
8 Real Estate Securities 4 7145439523.
9 Small Cap 17 187292555389.
2.5.0.4 Homework problem 4
# Comparison Between Index and Active Investment# Build a Statistic Table on Assets Sizestata_table_assets <- blackrock_etf_screener |>group_by(investment_style) |>summarize(total_size =sum(net_assets_usd, na.rm =TRUE),max_size =max(net_assets_usd, na.rm =TRUE),min_size =min(net_assets_usd, na.rm =TRUE),avg_size =mean(net_assets_usd, na.rm =TRUE),sd_size =sd(net_assets_usd, na.rm =TRUE),percentile_25_size =quantile(net_assets_usd, .25, na.rm =TRUE),percentile_50_size =quantile(net_assets_usd, .5, na.rm =TRUE),percentile_75_size =quantile(net_assets_usd, .75, na.rm =TRUE), )stata_table_assets
# Comparison of Total Assets Between Different Investment Styleggplot(stata_table_assets) +aes(x = total_size, y = investment_style) +geom_bar(stat ="identity", fill ="red", alpha = .7) +scale_x_continuous(labels = scales::label_dollar(scale =1/10^3, suffix =" tn")) +labs(title ="Fund Size Between Different Investment Style",x ="Assets (USD)",y ="Investment Style",caption ="Haotian Duan") +theme_minimal()
# Display the Distribution of Assets Size in Different Investment Styleggplot(blackrock_etf_screener) +aes(x = net_assets_usd, y = investment_style) +geom_boxplot(fill ="red") +scale_x_continuous(trans ="log10") +labs(x ="Log of Assets Size",y ="Investment Style",title ="Distribution of Assets Size in Different Investment Style ",caption ="Haotian Duan" ) +theme_minimal()
# Comparison of Average MSCI ESG Quality Score Between Different Investment Styleggplot(stata_table_score) +aes(x = avg_score, y = investment_style) +geom_bar(stat ="identity", fill ="blue", alpha = .7) +labs(title ="Average MSCI ESG Quality Score Between Different Investment Style",x ="MSCI ESG Quality Score",y ="Investment Style",caption ="Haotian Duan") +theme_minimal()
# Display the Distribution of MSCI ESG Quality Score in Different Investment Styleggplot(blackrock_etf_screener) +aes(x = msci_esg_quality_score_0_10, y = investment_style) +geom_boxplot(fill ="blue") +labs(x ="MSCI ESG Quality Score",y ="Investment Style",title ="Distribution of MSCI ESG Quality Score in Different Investment Style ",caption ="Haotian Duan" ) +theme_minimal()