market analysis to show which political party has managed the economy better in r

21
US Economy Analysis under Democrats and Republicans MGS690 Presented By:- Mohd Arif Sami Snehal Dutta Vinayak Kudari Siddhartha Parepally

Upload: snehal-datta

Post on 22-Jan-2018

243 views

Category:

Economy & Finance


2 download

TRANSCRIPT

US Economy Analysis under Democrats and

Republicans

MGS690

Presented By:-

Mohd Arif Sami

Snehal Dutta

Vinayak Kudari

Siddhartha Parepally

Agenda

1. Background

2. Design

3. Development

4. Code

5. Results

6. Test

7. Conclusion

Background

Political parties in the United States

Republican Party – Conservatives, free market capitalism

Democratic Party - liberal, mixed economy

Impact on the economic conditions of America

Design

Data Collection

Data Cleaning

Mapping of Data

Analysis

Value weighted returns

Equal weighted returns

Hypothesis test

Same weight, or importance, to each stock in a portfolio.

Smallest companies are given equal weight to the largest companies.

All of the companies considered on an even playing field.

The index is highly diversified with all stocks in the universe equally

weighted.

As opposed to market cap weighting, the index does not overweight

overpriced stocks and underweight underpriced stocks. Pricing errors are

random.

Equal Weight

http://valueweightedindex.com/indexcomparison/equallyweighted/

Equal Weight Index

Based on the average market capitalization rather than

on the average price of the stocks in the index.

Value Weighted

Value weighted return = 390,000 x 100 = 109.59

355,000

http://www.investopedia.com/exam-guide/cfa-level-1/securities-markets/computing-indexes.asp

SP500 Data Sample

VWRETX:-

Return (excluding dividends) on value-weighted index.

Contains, returns, excluding all dividends, on a value-weighted market portfolio.

VWRETD:-

Return (Including all Distributions) on Value-Weighted Index.

Contains the returns, including all distributions, on a value-weighted market portfolio.

EWRETD:-

Return (Including all Distributions) on Equal-Weighted Index.

Contains returns, including all distributions, on an equally-weighted market

portfolio.

EWRETX:-

Return (excluding dividends) on equal-weighted index

Contains returns, excluding all dividends, on an equally-weighted market portfolio.

Few Terms

Development

Three major steps

Collecting S&P500 index returns

S&P500 index data from 1926 to till date

Results based on the ruling party

Value weighted and equal weighted portfolio return into

two groups

Classification of returns

The expectation is that the returns during the rule of

each party is different from the other.

link:- http://www.enchantedlearning.com/history/us/pres/list.shtml

Parties Term Data

>prezData<-read.csv(file="PrezTable.csv",head=TRUE,sep=",")

>pTermData<-

>data.frame(prezData$Party,as.integer(substr(prezData$Term.as.President,1,4)),as.integer(substr(pr

ezData$Term.as.President,6,9))-1)

>colnames(pTermData)<-c('Party','Term_Start', 'Term_End')

>pTermData<-subset(pTermData,as.numeric(pTermData$Term_Start)>=1923)

>pTermData[is.na(pTermData)] <- 2015

Parties Term Data

Save the sp500monthly monthly dataset from

"http://www3.canisius.edu/~yany/RData/sp500Monthly.RData" to your local system

> load('sp500monthly.Rdata')

> head(sp500monthly)

S&P500 Data

> sp500monthlyc<-na.omit(sp500monthly)

> head(sp500monthlyc)

Cleaning S&P500 Data

#Get the number of rows for each in the pTermData dataset

terms<-nrow(pTermData)

#Initialize 2 matrices for Equal weighted returns and Value weighted returns

meanRetVWRETD<-matrix(,nrow=terms,ncol=1)

meanRetEWRETD<-matrix(,nrow=terms,ncol=1)

#Run a loop for each row of the pTermData dataset

for (i in 1:terms){

#Get the start year and end year of each term

start_year<-pTermData$Term_Start[i]

end_year<-pTermData$Term_End[i]

# Get a subset of the sp500monthly dataset between the start and end year of #the term

termData<-data.frame(subset(sp500monthly, as.numeric(substr(sp500monthly[,1],1,4))>=start_year &

as.numeric(substr(sp500monthly[,1],1,4))<=end_year))

#Store the value weighted returns and equal weighted returns in 2 separate variables

termDataVWRETD<-termData$VWRETD

termDataEWRETD<-termData$EWRETD

#Find the mean of the equal weighted and value weighted returns for that term

meanRetVWRETD[i,1]<-mean(as.numeric(as.character(termDataVWRETD)))

meanRetEWRETD[i,1]<-mean(as.numeric(as.character(termDataEWRETD)))

}

Calculating Returns

> colnames(pTermData)<-c('Party','Term_Start', 'Term_End')

> pTermData<-cbind(pTermData,meanRetVWRETD)

> pTermData

Final Data Set

> RepData<-subset(pTermData,pTermData$Party=="Republican")

> DemData<-subset(pTermData,pTermData$Party=="Democrat")

> RepData

Segregating the Data

> shapiro.test(RepData$meanRetVWRETD)

> shapiro.test(DemData$meanRetVWRETD)

P-value is more that 0.05 hence we can say both the returns follow normal distribution.

Normally Test

Null Hypothesis

H0: Republican Return=democrats Return

Alternate Hypothesis

Ha: Republican Return !=Democrats Return

Hypothesis

>t.test(RepData$meanRetVWRETD,DemData$meanRetVWRETD)

Hypothesis Testing

P-value is 0.2757 which is greater than 0.05

hence we can say:-

We fail to reject the null hypothesis.

Hence there is enough evidence to prove that

market returns during Democrat rule is equal to

market returns during Republican rule.

Test Result

Conclusion

On analysis of the S&P500 index returns (both value

weighted and equal weighted) during the terms of Republican

and Democratic rule, by using Hypothesis testing, we have

found that :

Both Republicans and Democrats have managed the

economy similarly.