Rows: 537 Columns: 14
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (4): ticker, company_name, sector, esg_uw_ow
dbl (7): esg_etf, standard_etf, esg_tilt, esg_tilt_z_score, esg_tilt_rank, e...
lgl (3): in_esg_only, in_standard_only, in_on_index_only
ℹ 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.
# Explore the menus at the bottom of the screenggplot(blackrock_esg_vs_non_esg_etf) +aes(x = esg_etf, y = standard_etf, colour = sector) +geom_point(shape ="circle", size =1.5) +geom_smooth(span =0.75) +scale_color_hue(direction =1) +scale_x_continuous(trans ="log10") +scale_y_continuous(trans ="log10") +labs(x ="Weight in ESG ETF (ESGU)",y ="Weight in Standard ETF (IVV)",title ="Comparison Between 2 Funds",subtitle ="ESG vs. Non-ESG",caption ="Haotian Duan" ) +theme_minimal()
Warning: Transformation introduced infinite values in continuous x-axis
Warning: Transformation introduced infinite values in continuous y-axis
Warning: Transformation introduced infinite values in continuous x-axis
Warning: Transformation introduced infinite values in continuous y-axis
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
# A tibble: 1,074 × 4
company_name sector fund_type weight
<chr> <chr> <chr> <dbl>
1 PRUDENTIAL FINANCIAL INC Financials ESG ETF (ESGU) 0.537
2 PRUDENTIAL FINANCIAL INC Financials Standard ETF (IV… 0.106
3 GENERAL MILLS INC Consumer Staples ESG ETF (ESGU) 0.552
4 GENERAL MILLS INC Consumer Staples Standard ETF (IV… 0.151
5 KELLOGG Consumer Staples ESG ETF (ESGU) 0.453
6 KELLOGG Consumer Staples Standard ETF (IV… 0.0592
7 AUTOMATIC DATA PROCESSING INC Information Technology ESG ETF (ESGU) 0.649
8 AUTOMATIC DATA PROCESSING INC Information Technology Standard ETF (IV… 0.312
9 ECOLAB INC Materials ESG ETF (ESGU) 0.441
10 ECOLAB INC Materials Standard ETF (IV… 0.118
# ℹ 1,064 more rows
# Import datablackrock_esg_vs_non_esg_etf_long %>%# Limite the weightfilter(weight >=1L) %>%ggplot() +# Set up variablesaes(x = weight,y = company_name,colour = fund_type,size = weight ) +# Set up shape and colorgeom_point(shape ="circle") +scale_color_manual(values =c(`ESG ETF (ESGU)`="#04ED7E",`Standard ETF (IVV)`="#C1BEC0") ) +# Set up titles and labelslabs(x ="Weight",y ="Company",title ="Weight Comparison of Companies in ESGU vs. IVV ETFs",caption ="Haotian Duan" ) +theme_minimal()
This graph compares the weightings of companies in two different ETFs: an ESG ETF (ESGU) and a Standard ETF (IVV). The X-axis represents the percentage of the fund’s total assets invested in each company. The Y-axis lists company names. This graph shows the proportion that weight exceed 1%, which can be considered as outlier. We can see that most company have similar weight on ESG and non-ESG ETFs.
1.5.1.4 Homework problem 3: Make your own charts with esquisse
Rows: 537 Columns: 14
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (4): ticker, company_name, sector, esg_uw_ow
dbl (7): esg_etf, standard_etf, esg_tilt, esg_tilt_z_score, esg_tilt_rank, e...
lgl (3): in_esg_only, in_standard_only, in_on_index_only
ℹ 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.
# Modify the range of variables to zoom in graph and exclude outlierblackrock_esg_etf_vs_esg_tilt %>%filter(esg_etf >=0& esg_etf <=2.6) %>%filter(esg_tilt >=-0.6& esg_tilt <=0.44) %>%ggplot() +# Choose variables and use smooth line to show its patternaes(x = esg_etf, y = esg_tilt, colour = sector) +geom_point(shape ="circle", size =1.5) +geom_smooth(span =0.75) +scale_color_hue(direction =1) +# Name the topic and variableslabs(x ="ESG ETF Weights",y ="ESG Tilt",title ="ESG ETF Weights and Company ESG Tilt Analysis",caption ="Haotian Duan" ) +theme_minimal()
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
: pseudoinverse used at -0.0031653
Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
: reciprocal condition number 0
Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
: There are other near singularities as well. 0.012493
Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at
-0.0031653
Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
0.11494
Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
number 0
Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : There are other near
singularities as well. 0.012493
“ESG Tilt” is an investment strategy that overweights assets in a portfolio of ESG. Where investments are skewed towards companies that score higher on ESG criteria. So, I assume that higher weights in ESG ETF indicate a higher attention on ESG, which will lead to higher ESG tilt. However, our graph shows a very week positive relationship between 2 variables. In order to find out the reason, we move to our second topic.
# Topic 2# Construct graphs to study this case seperately in each sectorblackrock_esg_etf_vs_esg_tilt %>%filter(esg_etf >=0& esg_etf <=2.6) %>%filter(esg_tilt >=-0.6& esg_tilt <=0.44) %>%ggplot() +aes(x = esg_etf, y = esg_tilt, colour = sector) +geom_point(shape ="circle", size =1.5) +geom_smooth(span =0.75) +scale_color_viridis_d(option ="inferno", direction =1) +labs(x ="ESG ETF Weights",y ="ESG Tilt",title ="Relationship between ESG ETF Weights and Company ESG Tilt in Different Sector",caption ="Haotian Duan" ) +theme_minimal() +theme(legend.position ="left") +facet_wrap(vars(sector))
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
: pseudoinverse used at -0.0031653
Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
: reciprocal condition number 0
Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
: There are other near singularities as well. 0.012493
Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at
-0.0031653
Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
0.11494
Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
number 0
Warning in predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x
else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : There are other near
singularities as well. 0.012493
We can see that the pattern of relationship between ESG ETF Weights and Company ESG Tilt is very different in different sector. Most of company will raise their ESG tilt as ESG ETF Weights growth at the beginning, while when they excessive pursuit ESG, the effect will be reversed, such as health care and consumer discretionary. On the contrary, in some sector like material, it is almost the more ESG ETF Weights the better.
1.5.2.1 Homework problem 4: Understanding aes()
# Chart 1# Import dataggplot(blackrock_esg_vs_non_esg_etf) +# Choose variablesaes(x = esg_etf, y = standard_etf) +geom_point(mapping =aes(color = sector, shape ="circle")) +# Create smooth linegeom_smooth(span =0.75, method ="lm")+scale_color_hue(direction =1) +# Take log of x and yscale_x_continuous(trans ="log10") +scale_y_continuous(trans ="log10") +labs(title ="Chart 1") +theme_minimal()
Warning: Transformation introduced infinite values in continuous x-axis
Warning: Transformation introduced infinite values in continuous y-axis
Warning: Transformation introduced infinite values in continuous x-axis
Warning: Transformation introduced infinite values in continuous y-axis
The grammar difference is that for chart 1, sector does not count as variables in color, instead, it just determine the different color in mapping, since the variables are set up first and then gives information about sectors. For chart 2, sectors are set as a variables of color, this means chart 1 will regard different sectors as a whole but chart 2 regard it separately. For chart 3, it is similar as chart 1, the different is that it exclude all information about sectors.
1.5.3.1 Homework problem 5: make a new chart from the R Graph Gallery
# Column chart# Import datablackrock_esg_vs_non_esg_etf_long %>%# Limit the rangefilter(weight >=1L & weight <=7L) %>%ggplot() +# Set variablesaes(x = company_name, y = weight, colour = fund_type) +geom_col(fill ="#112446") +scale_color_hue(direction =1) +# Name titlelabs(x ="Company",y ="Weight",title ="Weight Comparison of Companies in ESGU vs. IVV ETFs",caption ="Haotian Duan" ) +# Change a direction to make company name not squeezecoord_flip() +theme_linedraw()
This chart is also used to study the weight comparison of outlier companies as we did in problem 2, the difference is that column chart shows more intuitional on the numerical information, we can see the comparison of ESGU and IVV ETFs more directly.
1.5.3.2 Homework problem 6: make a new chart from the ggplot2 Extensions Gallery
# PATCHWORK# Install and library the packdevtools::install_github("thomasp85/patchwork")
Skipping install of 'patchwork' from a github remote, the SHA1 (d9437579) has not changed since last install.
Use `force = TRUE` to force installation
library(ggplot2)library(patchwork)# P1: Comparison Between ESG and non-ESG Funds Weightp1 <-ggplot(blackrock_esg_vs_non_esg_etf) +aes(x = esg_etf, y = standard_etf, colour = sector) +geom_point(shape ="circle", size =1.5) +geom_smooth(span =0.75) +scale_color_hue(direction =1) +scale_x_continuous(trans ="log10") +scale_y_continuous(trans ="log10") +labs(x ="Weight in ESG ETF (ESGU)",y ="Weight in Standard ETF (IVV)",title ="Comparison Between 2 Funds",subtitle ="ESG vs. Non-ESG",caption ="Haotian Duan" ) +theme_minimal()# P2: ESG Weight of Outlier Companyp2 <- blackrock_esg_etf_vs_esg_tilt %>%filter(esg_etf >=1L & esg_etf <=7L) %>%ggplot() +aes(x = company_name, y = esg_etf) +geom_col(fill ="#E80E22") +labs(x ="ESG Weight",y ="Company",title ="ESG Weight of Outlier Company",caption ="Haotian Duan" ) +coord_flip() +theme_minimal()# P3: Non-ESG Weight of Outlier Companyp3 <- blackrock_esg_etf_vs_esg_tilt %>%filter(esg_etf >=1L & esg_etf <=7L) %>%ggplot() +aes(x = company_name, y = standard_etf) +geom_col(fill ="#E80E22") +labs(x ="Non-ESG Weight",y ="Company",title ="ESG Weight of Outlier Company",caption ="Haotian Duan" ) +coord_flip() +theme_minimal()# P4: ESG Tilt of Outlier Companyp4 <- blackrock_esg_etf_vs_esg_tilt %>%filter(esg_etf >=1L & esg_etf <=7L) %>%ggplot() +aes(x = company_name, y = esg_tilt) +geom_col(fill ="#E80E22") +labs(x ="ESG Tilt",y ="Company",title ="ESG_Tilt of Outlier Company" ) +coord_flip() +theme_minimal()p1 /p2 /p3 /p4
Warning: Transformation introduced infinite values in continuous x-axis
Warning: Transformation introduced infinite values in continuous y-axis
Warning: Transformation introduced infinite values in continuous x-axis
Warning: Transformation introduced infinite values in continuous y-axis
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
This pack provide us a chance to merge different chart into one. It makes easier to demostrate a conclusion that need comparision. For example, for example as we are confused about why there won’t always be a positive relationship between ESG weight and ESG tilt. We found that it is varied in different sector. But from this patchwork, we can see that there always comes with more non-ESG weight for the company with high ESG weight.