MSCI is a package that allows you to view the data of MSCI USA and MSCI Min Volatility.

I) Data Overview

The raw data can be found in inst/extdata while processed data can be viewed by running the following commands:

The unique sectors were identified, and a table with relative weights of each was constructed, for the data on a monthly basis. The different sectors were S.T.Securities, Health.care, Industrials, Financials, Materials, Consumer.Discretionary, Information.Technology, Energy, Consumer.Staples, Utilities, Telecommunication.Services, Real.Estate, Cash.Derivatives, Telecommunications. The date is shown on the leftmost rows, followed by the different sectors. Each sector then has its relative weight with respect to the date in the corresponding row.

#download package
library(mscir)
library(ggplot2)
library(scales)

# Display the data for MSCI USA
View(usa) 

#Display the data for MSCI Min Vol
View(minvol) 

#Display the weight of each sector over time
View(usa_weight)
View(minvol_weight)

II) Data Analysis

Plot industry weight of each sector over time:

data(minvol_weight)
data(usa_weight)
data(usa)
data(minvol)

# MSCI Minvol's sector weights over time
ggplot(data = minvol_weight) + geom_line(mapping = aes(x = Date, y = Weight)) + scale_x_date(labels = date_format("%m-%Y"), date_breaks = "3 years") +  facet_wrap(~ Sector, nrow = 4)

# MSCI USA's sector weights over time
ggplot(data = usa_weight) + geom_line(mapping = aes(x = Date, y = Weight)) + scale_x_date(labels = date_format("%m-%Y"), date_breaks = "3 years") +  facet_wrap(~ Sector, nrow = 4)

# MSCI Minvol's market cap over time
colnames(minvol)[7] <- "Market.Value"
df1 <- mutate(minvol, Sector = ifelse(Sector == "Telecommunications", "Telecommunication Services", Sector))
df1 <- aggregate(Market.Value~Date + Sector, data = df1, FUN = sum, na.action = na.omit)
ggplot(data = df1) + geom_line(mapping = aes(x = Date, y = Market.Value)) + scale_x_date(labels = date_format("%m-%Y"), date_breaks = "3 years") +  facet_wrap(~ Sector, nrow = 4)

# MSCI USA's market cap over time
colnames(usa)[7] <- "Market.Value"
df2 <- mutate(usa, Sector = ifelse(Sector == "Telecommunications", "Telecommunication Services", Sector))
df2 <- aggregate(Market.Value~Date + Sector, data = df2, FUN = sum, na.action = na.omit)
ggplot(data = df2) + geom_line(mapping = aes(x = Date, y = Market.Value)) + scale_x_date(labels = date_format("%m-%Y"), date_breaks = "3 years") +  facet_wrap(~ Sector, nrow = 4)

# MSCI vs USA
ggplot() + geom_line(data = df1, mapping = aes(x = Date, y = Market.Value, color = "minvol")) +  geom_line(data = df2, mapping = aes(x = Date, y = Market.Value, color = "usa")) + 
scale_colour_manual(name="Line Color",
    values=c(minvol="red", usa="blue")) +
facet_wrap(~ Sector, nrow = 4)

The market caps of all the constituents by sector of both the MSCI Min Vol and MSCI USA Equal Weight indices were found and plotted against one another. MSCI USA Equal Weight is shown in blue, while the MSCI Min Vol is shown in red. The time frame is from Oct 2011 to January 2017. The market value unit is dollars.



nnguyen2496/mscir documentation built on May 23, 2019, 9:29 p.m.