Sie sind auf Seite 1von 7

BUSINESS INTELLIGENCE

ASSIGNMENT:

Regression Analysis of Stock Market Returns Using R

SUBMITTED TO:
PROFESSOR PRADEEP SURI
DELHI SCHOOL OF MANAGEMENT
DELHI TECHNOLOGICAL UNIVERSITY
05-April-2020

By
JATIN ACHINT - 2K18/MBA/047

ABHISHEK BITOLIA - 2K18/MBA/042

LAONE OTUKILE - 2K18/MBA/129

MICHAEL MUNASHE - 2K18/MBA/125

NAOMY NASAMBU SIMIYU -2K18/MBA/128


R. assignment

Table of Contents

Introduction to R and RStudio ................................................................................................................ 2


R .......................................................................................................................................................... 2
RStudio ............................................................................................................................................... 2
Overview ................................................................................................................................................. 2
Table 1: Monthly Returns for Microsoft Stock and the S&P 500 stock Index for the year 2019 .... 3
Hypothesis .............................................................................................................................................. 3
Model ...................................................................................................................................................... 3
Variables ............................................................................................................................................. 3
Analysis and Coding on RStudio ............................................................................................................ 4
Figure 1: Image of the Workspace, Console and Plots during Analysis ........................................ 4
Output Summary ................................................................................................................................. 4
Figure 2: Scatter Diagram of MSFT vs S&P500 ............................................................................ 4
Pearson's product-moment correlation ............................................................................................ 5
Model Summary.............................................................................................................................. 5
Conclusion .............................................................................................................................................. 6
Regression Equation ........................................................................................................................... 6

Page 1 of 6
R. assignment

Introduction to R and RStudio


R
R is a free, open-source software and programming language based on the S language developed in
1995 at the University of Auckland as an environment for statistical computing and graphics. Since
then R has become one of the dominant software environments for data analysis and is used by a
variety of scientific disciplines. R is particularly popular for its graphical capabilities, but it is also
prized for its GIS capabilities which make it relatively easy to generate raster-based models.
R has a number of packages that offer different capabilities, but the package that we will be using is
the “Base R” which does the following functions;

 Summaries of quantitative or qualitative data


 Data exploration via graphs
 GIS data processing and analysis

RStudio
RStudio is an integrated development environment (IDE) that allows you to interact with R more
readily. RStudio is similar to the standard RGui, but is considerably more user friendly. It has more
drop-down menus, windows with multiple tabs, and many customization options.

Overview
For this exercise, we decided to run a regression on RStudio using monthly return data on Microsoft
stock (MSFT) and the S&P 500 stock index (S&P) for the period Jan-Dec 2019. The main reason for
selecting this data is because of the following reasons:

a) The S&P 500 index is a market capitalization weighted index, meaning that companies with
larger market capitalization will tend to have a profound effect on the movement of the index.
b) As of 2019, 5 tech companies dominated the S&P index, accounting for nearly 20% of the
index. Among these, two stocks, Microsoft and Apple had the largest share, with Microsoft
accounting for nearly 5% of the index weight and the rest distributed among the remaining 499
stocks.

Hence we chose Microsoft (MSFT) as it has the largest weight in the index and assumed to have a
profound impact on the movement of the S&P 500 index.

The data below relates to the monthly returns of the both the Microsoft stock and the S&P 500

Page 2 of 6
R. assignment

Table 1: Monthly Returns for Microsoft Stock and the S&P 500 stock Index for the year 2019

S&P
MSFT 500
0.03 0.08
0.07 0.03
0.06 0.02
0.11 0.04
-0.05 -0.07
0.09 0.07
0.02 0.01
0.01 -0.02
0.01 0.02
0.03 0.02
0.06 0.03
0.05 0.03

Therefore, the object of our analysis was to determine if there is significant relationship between
movement in the Microsoft Stock and the S&P 500, and the degree of the relationship.

Hypothesis
H0: There is no significant relationship between returns of Microsoft stock and that of the S&P500

H1: There is significant relationship between returns of Microsoft stock and that of the S&P500

Model
Y= β₀ + β₁X + ɛ

S&P returns= β₀ + β₁(MSFT returns) + ɛ

Variables

Independent: MSFT returns


Dependent: S&P returns

Page 3 of 6
R. assignment

Analysis and Coding on RStudio


We ran regression tests on RStudio, starting with the running a code to import the data file, followed
by a series of codes to test the relationships and extracting the model summary. Below is an image of
the workspace, Console and Plots obtained during the analysis.

Figure 1: Image of the Workspace, Console and Plots during Analysis

Output Summary

Following the order of code execution as per the image above, the output results obtained are
represented below.

Figure 2: Scatter Diagram of MSFT vs S&P500

Page 4 of 6
R. assignment

Pearson's product-moment correlation

data: Data$MSFT and Data$S.P


t = 3.4893, df = 10, p-value = 0.00583
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.2906938 0.9225618
sample estimates:
cor
0.7409783

Interpretation: there is a positive strong correlation between Microsoft returns and the S&P 500 returns.
This is shown by the correlation coefficient of 0.74. Therefore we can procced further to run regression
tests on the data.

Model Summary

Call:

lm(formula = Data$S.P ~ Data$MSFT)

Residuals:
Min 1Q Median 3Q Max
-0.029932 -0.016198 -0.001295 0.008001 0.065696

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.006085 0.011203 -0.543 0.59890
Data$MSFT 0.679645 0.194779 3.489 0.00583 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.02733 on 10 degrees of freedom


Multiple R-squared: 0.549, Adjusted R-squared: 0.504
F-statistic: 12.18 on 1 and 10 DF, p-value: 0.00583

Interpretation: Our model estimates that when MSFT returns are 0, the returns for the S&P will be -
0.006085. Furthermore, the gradient for our model equation is estimated to be 0.679645, implying that
should MSFT returns change by a unit, the S&P returns will change by a factor 0.67.

Our model is statistically significant at p.value of 0.00583 at 95% confidence level, implying that there
is a significant relationship between S&P and MSFT. Moreover, the F statistic corroborates this as it
shows that our overall model is statistically significant at a value of 12.18, which is greater than the
4.9646 critical value at 95% confidence level.

Furthermore, the R-squared value shows that about 54.9 percent of the variation in the S&P movement
is because of the movement in the returns of Microsoft.

Page 5 of 6
R. assignment

Conclusion
We reject the null hypothesis in favour of the alternative and conclude that there is a significant
relationship between the MSFT returns and the S&P 500 returns. This is evidence by the
statistically significant independent variable at 0.00583 and the overall significance of our model at an
F-statistic of 12.18 both at 95% confidence level.

Regression Equation

Y= β₀ + β₁X + ɛ

S&P= -0.006085 + 0.679645(MSFT) + ɛ


Hence, if we were to estimate the returns for the S&P based on a 4% return on MSFT, our model
would predict that;

S&P= -0.006085 + 0.679645(0.04) + ɛ

S&P= 0.0211 or 2.11%

Page 6 of 6

Das könnte Ihnen auch gefallen