1 of 37

STOCK MARKET ANALYSIS

Implementing Statistical Analysis on the BSE-30 Stocks for the period 2008-18

Group 8

Krisha Zaveri A004

Avani Bhatia A022

Jaskirat Singh Chadha A028

Aarushi Jain A030

Ram Chirapuram A045

Mentor:

Dr. K.S. Madhava Rao�Professor, Statistics�Specialization: Nonparametric Inference, Statistics in Social & Allied Sciences�B Sc., M.Sc., M.Phil., Ph.D.

2 of 37

INTRODUCTION

Indian Stock Markets are one of the oldest in Asia. It’s history dates back to nearly 200 years ago.

The Indian Stock Market has two major stock exchanges:�National Stock Exchange (NSE), Established in 1992�Bombay Stock Exchange (BSE), Established in 1875

The term Sensex refers to the benchmark index of the BSE in India. The Sensex is comprised of 30 of the largest and most actively traded stocks on the BSE. Created in 1986, the Sensex is the oldest stock index in India. Analysts and investors use it to observe the cycles of India's economy and the development and decline of particular industries.

In this project we have used the data on day-to-day share prices of 30 stocks on the SENSEX Index for the years 2008 to 2018.

2

3 of 37

RATIONALE

One of our main reasons behind choosing a Stock Market dataset as the foundation for our project was to gain a better understanding about how the stock market works and how we can relate it to our Sampling Distributions course in the real-world scenario. Latest data shows that the quantum of retail holding is at an all-time high in the Indian Stock Markets.

So, with the knowledge gathered about the share market from this project we can start investing right now which will prove fruitful for us in the future. The project provided us with the perfect opportunity under the guidance of respected K.S Rao Sir. Therefore, we chose Stock Market as the topic for our Sampling Distribution & Applications Project.

3

4 of 37

OBJECTIVES

01

02

03

04

​

​

​

​

​

To establish Confidence Intervals for the Daily Returns and the Adjusted Closing Stock Prices

To determine if the distribution of daily returns of the Wipro stock follows a normal distribution

To compare Monthly Returns of M&M and TATAMOTORS Stock Prices

To determine which company is riskier to invest in, between DRREDDY and SUNPHARMA

05

To determine whether volume of trading is affected during the Diwali period

5 of 37

GLOSSARY

 

6 of 37

LITERATURE REVIEW

Cristiana Tudor (2008): For better understanding and reference about how to go about stock market data, we have used the below research paper:�http://www.asecu.gr/files/RomaniaProceedings/68.pdf

Tony Yiu (2020): In some parts of this project we used R Programming to perform the Z test and to find the test statistic value and to plot a QQ plot, we have used the below article as reference and a guideline: �https://towardsdatascience.com/are-stock-returns-normally-distributed-e0388d71267e

Reka Pitaloka (2021): Has analysed the ANTM.JK Stock using various statistical measures on Python.

David Diez, Christopher Barr, & Mine Çetinkaya-Rundel (2021): https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Book%3A_OpenIntro_Statistics_(Diez_et_al)./06%3A_Inference_for_Categorical_Data/6.03%3A_Testing_for_Goodness_of_Fit_using_Chi-Square_(Special_Topic)

​

6

7 of 37

Source of Data & Data Description

  • The data used in this project is secondary data of a Stock Market Dataset on Kaggle (2008-2018) compiled by Sugandh Khobragade.
  • The 30 component companies which are some of the largest and most actively traded stocks, are representative of various industrial sectors of the Indian economy.
  • This dataset contains the data about these 30 stocks for 10 years starts from 06/05/2008 to 04/05/2018. Variables are symbol (ticker), Date, open, high, low, close, adjusted close and volume.

7

8 of 37

Data Cleaning

  1. Completeness: �The extent to which all statistics that are needed are available.�250 null/incomplete values were found in the dataset.
  2. Relevancy:�The ability to use data with maximum efficiency. 261 irrelevant values were found in the dataset.
  3. Accuracy:�The degree to which the data mirrors the characteristics of the real-world object or objects it represents. 6 inaccurate values were found in the dataset.

8

9 of 37

STATISTICAL TECHNIQUES

 

 

9

10 of 37

INSIGHTS

01

To establish Confidence Intervals for the Daily Returns and the Adjusted Closing Stock Prices

11 of 37

Analysis

Let’s plot the daily closing price for 1 stock say ASIANPAINT.

12 of 37

Confidence Interval

The confidence level represents the proportion (frequency) of acceptable confidence intervals that contain the true value of the unknown parameter.

​

Confidence Interval Formula :

 

 

13 of 37

Box Plot for the Confidence Interval of Adjusted Closing Price:

14 of 37

Confidence Interval

The 95% confidence interval for the adjusted closing price of 30 stocks data using Excel is given as:

​

Company

Mean

Standard Deviation

Lower Confidence (95%)

Upper Confidence (95%)

ADANIPORTS

197.61788

99.11789

193.69515

201.54062

ASIANPAINT

508.17687

376.57629

493.27028

523.08345

AXISBANK

292.40110

170.16530

285.66794

299.13427

BAJAJ-AUTO

1687.74608

849.59057

1654.04666

1721.44550

BHARTIARTL

344.04677

49.97483

342.06855

346.02500

COALINDIA

248.10158

36.37626

246.44020

249.76297

DRREDDY

2020.80384

940.50746

1983.59708

2058.01060

HDFC

865.70097

431.66705

839.61987

891.78206

HDFCBANK

758.68679

478.77686

739.73464

777.63893

HEROMOTOCO

2002.04893

883.84099

1967.06966

2037.02820

HINDUNILVR

561.29499

331.87465

548.16592

574.42405

ICICIBANK

165.98306

83.89649

162.66274

169.30339

INDUSINDBK

590.94799

500.64255

571.13435

610.76164

INFY

660.25796

289.04645

648.82320

671.69273

ITC

162.99923

76.35301

159.97806

166.02039

KOTAKBANK

445.90967

290.49380

434.41765

457.40169

LT

744.77870

264.80031

734.29885

755.25855

M&M

421.51060

202.32444

413.50659

429.51462

MARUTI

2770.62986

2341.96757

2677.94315

2863.31657

ONGC

147.27016

39.11168

145.72289

148.81743

RELIANCE

466.32831

148.23173

460.46182

472.19479

SBIN

168.53762

80.48651

165.35355

171.72169

SUNPHARMA

446.78204

275.85744

435.86904

457.69505

TATAMOTORS

290.19277

156.06660

284.01873

296.36681

TATAMTRDVR

192.80242

94.06907

188.87212

196.73273

TATASTEEL

380.61079

126.53461

375.60504

385.61653

TCS

1552.53515

839.29956

1519.31867

1585.75163

WIPRO

199.45233

67.78679

196.77011

202.13454

YESBANK

107.68592

99.01822

103.76872

111.60311

POWERGRID

117.78589

40.70084

116.17575

119.39603

15 of 37

Probability Distribution of Daily Returns

We are now going to calculate some insights about the probability distribution of returns.

16 of 37

Box Plot for the Confidence Interval of Daily Returns:

17 of 37

Confidence Interval

The 95% confidence interval for the daily returns of 30 stocks data using Excel is given as:

​

COMPANY

MEAN

STANDARD DEVIATION

LOWER CONFIDENCE (95%)

UPPER CONFIDENCE (95%)

ADANIPORTS

0.00079

0.02600

-0.00024

0.00182

ASIANPAINT

0.00136

0.01702

0.00069

0.00204

AXISBANK

0.00095

0.02585

-0.00007

0.00197

BAJAJ-AUTO

0.00125

0.01939

0.00048

0.00202

BHARTIARTL

0.00022

0.02163

-0.00063

0.00108

COALINDIA

0.00027

0.01722

-0.00052

0.00106

DRREDDY

0.00067

0.01805

-0.00004

0.00139

HDFC

0.00086

0.02131

0.00001

0.00170

HDFCBANK

0.00097

0.01732

0.00028

0.00166

HEROMOTOCO

0.00090

0.01798

0.00019

0.00161

HINDUNILVR

0.00092

0.01574

0.00030

0.00155

ICICIBANK

0.00089

0.02671

-0.00017

0.00195

INDUSINDBK

0.00154

0.02501

0.00055

0.00253

INFY

0.00079

0.01868

0.00005

0.00153

ITC

0.00082

0.01692

0.00015

0.00149

KOTAKBANK

0.00100

0.02367

0.00007

0.00194

LT

0.00061

0.02191

-0.00026

0.00148

M&M

0.00107

0.02275

0.00017

0.00197

MARUTI

0.00121

0.01961

0.00043

0.00198

ONGC

0.00056

0.02061

-0.00026

0.00137

RELIANCE

0.00044

0.02055

-0.00037

0.00125

SBIN

0.00093

0.02522

-0.00006

0.00193

SUNPHARMA

0.00084

0.01917

0.00008

0.00160

TATAMOTORS

0.00096

0.02793

-0.00015

0.00206

TATAMTRDVR

0.00119

0.02826

0.00001

0.00237

TATASTEEL

0.00037

0.02749

-0.00072

0.00145

TCS

0.00108

0.01959

0.00031

0.00186

WIPRO

0.00055

0.01948

-0.00022

0.00133

YESBANK

0.00150

0.02846

0.00038

0.00263

POWERGRID

0.00050

0.01714

-0.00018

0.00118

18 of 37

NORMALITY

02

To determine if the distribution of daily returns of the Wipro stock follows a normal distribution

19 of 37

Daily Returns Of WIPRO Stock

​

​

​

​

​

​

Symbol

Daily Returns

WIPRO

​

WIPRO

0.0014

WIPRO

-0.0040

WIPRO

0.0081

WIPRO

0.0130

WIPRO

-0.0266

WIPRO

0.0190

WIPRO

0.0104

WIPRO

-0.0053

Since the sample dataset has 2456 observations, we are showing the first 10 values from the dataset.

The graph of the sample data of the WIPRO stock is given:

20 of 37

To carry out the calculation for large number of observations, we have grouped the data points and found its corresponding observed frequencies:

CHI-SQUARE GOODNESS OF FIT TEST

x

Frequency

Less than -0.0813

5

(-0.0813, -0.0691)

7

(-0.0691, -0.0569)

11

(-0.0569, -0.0447)

22

(-0.0447, -0.0325)

47

(-0.0325, -0.0203)

146

(-0.0203, -0.0081)

423

(-0.0081, 0.0041)

830

(0.0041, 0.0163)

587

(0.0163, 0.0285)

236

(0.0285, 0.0408)

84

(0.0408, 0.0530)

32

(0.0530, 0.0652)

14

(0.0652, 0.0774)

5

More than 0.0774

6

Total

2455

 

 

Test Statistic

H0: The distribution of daily returns of WIPRO stock is normal.

H1: The distribution of daily returns of WIPRO stock is not normal

V/S

20

21 of 37

�

​

​

​

​

​

​

Calculation of goodness fit test using excel function:

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

*Here, few values of Ei are less than 5 thus we have clubbed those data points and carried out our final testing.

Class

Frequency

CDF

PDF

Ei

Less than -0.0813

5

0.00001

0.00001

0.032186902

(-0.0813, -0.0691)

7

0.00017

0.00016

0.394103427

(-0.0691, -0.0569)

11

0.00159

0.00141

3.469386504

(-0.0569, -0.0447)

22

0.01007

0.00849

20.83575583

(-0.0447, -0.0325)

47

0.04487

0.03480

85.42421865

(-0.0325, -0.0203)

146

0.14232

0.09745

239.2369639

(-0.0203, -0.0081)

423

0.32883

0.18651

457.8841289

(-0.0081, 0.0041)

830

0.57286

0.24403

599.0991579

(0.0041, 0.0163)

587

0.79117

0.21831

535.9391622

(0.0163, 0.0285)

236

0.92468

0.13352

327.7795434

(0.0285, 0.0408)

84

0.98050

0.05581

137.0229811

(0.0408, 0.0530)

32

0.99644

0.01594

39.13566658

(0.0530, 0.0652)

14

0.99955

0.00311

7.632746499

(0.0652, 0.0774)

5

0.99996

0.00041

1.015854774

More than 0.0774

6

1.00000

0.00004

0.098143344

Total

2455

 

1.00000

2455

22 of 37

RESULT

Significance: α = 0.05

Degrees of Freedom (df) is calculated as (no. of categories - 3).Since the no. of observations = 10.�Therefore, df is (10-3) = 7.

The test statistic value is: 244.4656

We have carried out 5% one tail test (Right Hand Test). The test statistics value (244.4656) lies in the critical region (3.325113, ∞). Therefore, we have sufficient information to reject H0. It is reasonable to consider that the distribution of daily returns of the Wipro stock is a good fit.

x

Oi

Ei

(Oi-Ei)^2/Ei

below -0.0447

45

24.73

16.61104018

(-0.0325, -0.0203)

47

85.42

17.28339576

(-0.0325, -0.0203)

146

239.24

36.33690754

(-0.0203, -0.0081)

423

457.88

2.657664626

(-0.0081, 0.0041)

830

599.10

88.9922781

(0.0041, 0.0163)

587

535.94

4.864748352

(0.0163, 0.0285)

236

327.78

25.69862812

(0.0285, 0.0408)

84

137.02

20.51799269

(0.0408, 0.0530)

32

39.14

1.301057116

over 0.0530

25

8.75

30.20190049

Total

2455

2455

244.465613

22

23 of 37

RETURNS

03

To compare Monthly Returns of M&M and TATAMOTORS Stock Prices

24 of 37

MONTHLY RETURNS

  •  

DIWALI PERIOD

M&M

2008

Month

Returns

Jun

-0.25852678

Jul

0.119735045

Aug

0.100471362

Sep

-0.1157377

Oct

-0.23503319

Nov

0.097378793

Dec

0.056219226

2009

Jan

0.075429991

Feb

0.074530981

Mar

0.273313829

Apr

0.426754859

May

0.46109011

Jun

-0.01523571

Jul

0.312072631

Aug

-0.07474964

Sep

0.036277029

Oct

0.049900396

Nov

0.169258305

Dec

0.047866325

TATAMOTORS

2008

Month

Returns

Jun

-0.144762733

Jul

0.020873127

Aug

0.085678824

Sep

-0.199841378

Oct

-0.463537667

Nov

-0.052126243

Dec

0.320904226

2009

Jan

-0.086161924

Feb

-0.032546721

Mar

0.203410897

Apr

0.48928858

May

0.394468698

Jun

-0.142774599

Jul

0.546332874

Aug

0.200817004

Sep

0.185452587

Oct

-0.065923004

Nov

0.240259869

Dec

0.18073626

25 of 37

MONTHLY RETURNS

26 of 37

LARGE SAMPLE Z-TEST�TEST OF SIGNIFICANCE FOR THE EQUALITY OF 2 MEANS

Result:

The test statistics value for Z-test is 0.09076922. �The p-value for the test statistics value of Z-test is 0.46383798.�In this case, the α value (0.05) is less than the P-value. Hence, we fail to reject the null hypothesis.

​

H0: Mean of M&M and Tata Motors are equal => µA = µB�

H1: Mean of M&M is greater than Tata Motors => µA > µB

​

​

V/S

 

Test Statistic

M&M

​

0.0308

​

119

​

0.0100505

TATA MOTORS

​

0.0293

​

119

​

0.0210292

26

27 of 37

VOLATILITY

04

To determine which company is riskier to invest in, between DRREDDY and SUNPHARMA

28 of 37

29 of 37

LARGE SAMPLE F-TEST�TEST OF SIGNIFICANCE FOR COMPARING THE VARIANCES OF TWO SAMPLES

Result:

The test statistics value for F-test is 1.128456762. �The p-value for the test statistics value of F-test is 0.001382402.�In this case, the P value is less than the α-value(0.05). Hence, we reject the null hypothesis.

H0: Variance of SunPharma & DrReddy are equal => σA = σB

H1: Variance of SunPharma & DrReddy are not equal => σA > σB

​

​

Test Statistic

 

F-Test Two-Sample for Variances

 

SunPharma

DrReddy

Mean

0.000838025

0.000674183

Variance

0.000367652

0.000325801

Observations

2456

2456

Df

2455

2455

F

1.128456762

 

P(F<=f) one-tail

0.001382402

 

F Critical one-tail

1.068661861

 

V/S

29

30 of 37

TRADING VOLUMES

05

To determine whether volume of trading is affected during the Diwali period

31 of 37

MUHURAT TRADING

Muhurat trading is the trading activity in the Indian stock market on the occasion of Diwali. Usually, it is held during evening hours and is announced by the stock market exchanges notifying traders and investors of the non-scheduled trading hour.

DIWALI PERIOD

The period was taken as 15th October to 14th November as historically, Diwali falls within these dates. Therefore, data was filtered out in MS Excel pertaining to this period. A subsection of the values is shown below.

Symbol

Date

Open

High

Low

Close

Adj Close

Volume

Returns

ADANIPORTS

15-10-2008

78

78.8

74.6

75.88

68.31

423965

5.14%

ADANIPORTS

16-10-2008

74.8

81.2

68.22

79.78

71.82

1283650

0.30%

ADANIPORTS

17-10-2008

81

82

77.64

80.02

72.04

771030

1.96%

ADANIPORTS

20-10-2008

80.8

83

75.8

81.59

73.45

862675

6.34%

ADANIPORTS

21-10-2008

83

87.98

81.41

86.76

78.11

869070

-3.45%

ADANIPORTS

22-10-2008

85

86.64

83

83.77

75.41

384610

-3.31%

ADANIPORTS

23-10-2008

80

82.98

78.41

81

72.92

428570

-8.21%

ADANIPORTS

24-10-2008

80

80

72.6

74.35

66.93

750895

-8.50%

ADANIPORTS

27-10-2008

75

75.8

64.5

68.03

61.24

836865

1.03%

ADANIPORTS

29-10-2008

74.4

75.6

67.61

68.73

61.87

384440

3.23%

32 of 37

LARGE SAMPLE Z-TEST�TEST OF SIGNIFICANCE FOR THE EQUALITY OF 2 MEANS

H0: “Volume of trade during Diwali is equal to volume during the year”

H1: “Volume of trade during Diwali is greater than volume during the year”

V/S

 

Diwali Period

Overall

x̄

1119282.25

952721.90

Sx

5817445.08

5906065.37

n

5453

72799

 

Test Statistic

IN:

OUT:

32

33 of 37

RESULT

We have carried out a 5% one-tail test. The sample mean volume for the Diwali period is 11,19,282.3 whereas, for the rest of the year it comes out to be 9,52,721.9. In this case, the α value (0.05) is greater than the p-value (0.0208). Hence, we reject the null hypothesis. This implies that volume of trade is significantly higher during the Diwali period than it is during the rest of the year.

This need not come as a surprise as many inactive traders also delve into the stock market at this time. Most investors/traders will buy and/or sell stocks as a gesture to acknowledge the auspiciousness of the day. But it is important to keep in mind that, although stocks are very volatile during this period, they aren’t necessarily profitable. With a simple calculation of the average daily return for this period, which comes out to be -0.0191%, we can see that although many people invest during the period, the focus might not be on profitability as much as it might be on the gesture.

33

34 of 37

FINDINGS

  • Many of the companies contain outliers specially companies such as Maruti and Reliance. And such a high standard deviation is the reason why stocks are considered risky assets.
  • The mean of the daily returns of stocks is quite similar to zero but the fact that it’s positive explains the positive drift of the price time series.
  • The stock returns have quite a narrow interquartile range. This phenomenon is called fat tails and is very common in stock analysis.
  • The daily returns of WIPRO do not follow a normal distribution. Assuming that they are normally distributed causes us to understate the likelihood of disastrous market returns.
  • In most cases, companies of the same industry move along similar lines based on the overall sectoral outlook. For example, here we saw that, the mean of the two stocks-M&M & Tata Motors are almost equal.
  • SunPharma is a riskier company to invest in as compared to DrReddy. This may be because Sun Pharma wanted to grow its speciality product range which also involved higher investments. Dr Reddy’s, on the other hand, has continued to focus on niche product launches in the US.
  • The number of shares traded is significantly higher during the Diwali period than it is during the rest of the year. Most investors/traders will buy and/or sell stocks as a gesture to acknowledge the auspiciousness of the festive period.

34

35 of 37

LIMITATIONS

Through the data cleaning process, the team encountered a sundry number of difficulties. There was a high volume of data which further carried a significant amount of dirty data.

There are several limitations of hypothesis testing that can affect the quality of the data that we get from this process.

  • Results of significance tests are based on probabilities and as such cannot be expressed with full certainty.
  • Test do not explain the reasons as to why does the difference exist, say between the means of the two samples. They simply indicate whether the difference is due to fluctuations of sampling or because of other reasons .
  • When used to detect whether a difference exists between groups, hypothesis testing can trigger absurd assumptions that affect the reliability of your observation.
  • Testing is not decision-making itself; the tests are only useful aids for decision-making.

35

36 of 37

FUTURE SCOPE

Further research can be undertaken on other portfolios or mutual funds and other investment avenues. Other variables can be taken into account such as risk tolerance capacity, etc.

There are lots of considerations while investing such as tax planning, future needs, safety of investments, recurring income, etc. There are some investments which are risky and few are not, so depending upon the age, the investors they should decide about the degree of risk to be taken.

We should also take into account the way people behave while making investment decisions not solely numbers. This is a new area in finance called behavioural finance which is promising branch of finance.

36

37 of 37

THANK YOU!