As part of the OESON Data Science internship program OGTIP Oeson, I completed my first project. The goal of the project was to conduct a statistical analysis of the stock values of three well-known companies using Advanced Excel. I used descriptive statistics to analyze the data, created charts to visualize the trends and built regression models for each company.
3. Project Overview
• Market Performance: Analysing the market price of
S&P500 big companies Microsoft, Tesla & Apple from
2018 to 2023 and studying the behavior of company
stock price fluctuation and statistical analysis.
• Forseeing the investment: Developing the regression
models against the S&P500 to gain the beta coefficient
and assessing the risk in investing in the company stock.
• Discovering the Patterns and Trends: Utilizing the
charts and plots, histograms to get a visual
demonstration of the stock price distribution over the
time.
3
4. Introduction to Data
• The dataset consists of the current stock prices of
three major companies: Microsoft, Apple, and
Tesla.
• Live data have been extracted from Yahoo Finance
and include their stock values from 2018 to 2023.
The data analysis goal is to identify various trends
and patterns in stock prices, specifically in terms of
percentage changes.
• Individuals can align their investments with market
dynamics and position themselves for strategic
success.
4
5. Introduction to Data
Date:The data on which the stock market ata was recorded.
Open:The opening price of the stock on the given date.
High:The highest price stock reached during the trading day.
Low:The lowest price the stock reached during the trading day.
Close:The closing price of the stock on the given date.
Adjusted Close:The adjusted closing price.
Volume:The total trading volume for the stock on the given date.
%chng:The percentage chance in company stock’s closing price compare
to the pevious day.
5
6. Results:Descriptive Analysis
6
Descriptive Statistics on Close Value of Tesla (2018-2023)
Mean 131.7902812
Standard Error 3.272219195
Median 97.6400035
Mode 23.620667
Standard Deviation 116.9789759
Sample Variance 13684.08079
Kurtosis -1.260371058
Skewness 0.468792298
Range 398.038668
Minimum 11.931333
Maximum 409.970001
Sum 168427.9793
Count 1278
Confidence Level(95.0%) 6.419516211
Descriptive Statistics on Close Value of Tesla (2018-223)
Mean 98.64651602
Standard Error 1.292090365
Median 95.6150015
Mode 145.860001
Standard Deviation 46.19110109
Sample Variance 2133.61782
Kurtosis -1.579983416
Skewness 0.121783854
Range 146.462494
Minimum 35.547501
Maximum 182.009995
Sum 126070.2475
Count 1278
Confidence Level(95.0%) 2.534853123
Descriptive Statistics on Close Value of MSFT(2018-2023)
Mean 194.5105477
Standard Error 2.076748161
Median 203.050003
Mode 92.330002
Standard
Deviation 74.2419314
Sample Variance 5511.864378
Kurtosis -1.290677547
Skewness 0.147216579
Range 258.099983
Minimum 85.010002
Maximum 343.109985
Sum 248584.4799
Count 1278
Confidence
Level(95.0%) 4.074213154
Mean: MSFT>Tesla>Apple MSFT: Highest averaged close value Median variance
Median: MSFT>>Tesla> Apple Tesla: Median averaged close value high variance.
SD: Apple<MSFT<Tesla Apple: Smallest averaged close value low variance.
7. 7
0
50
100
150
200
250
300
350
400
450
2017-09-22 2019-02-04 2020-06-18 2021-10-31 2023-03-15 2024-07-27
Closed Prices of MSFT, Tesla, Apple
MSFT Tesla Apple
Results
Microsoft has the highest value among the companies compared. Tesla's risk has been
increasing since late 2020, and its close value has been highly variable.
In July 2020, Tesla exceeded Apple's close value, indicating rapid improvement. closely to
ensure that we are adequately prepared to address any potential risks.
8. Results: Descriptive Analysis
8
• The given histograms have horizontal ranges from
0 to 500 with a bin size of 5.The vertical axis shoes
the frequency.
• Overall, all the Microsoft contributes with the
largest average (~194), wheras Apple has the
smallest valeur of 98.Regaring Tesla, it covers a
huge range of stock values from 12 to 411.The
smallest range covere by Apple which ranges 35-
182.
• Kurtosis is also an important parameter to which is
all negative (normal distribution is kurtosis=0),
represents the board distirbutions.
9. 9
• Minor ups&downs throught the
period of time(5 years) which is
~0.08.
• Greater positive/negative %
chance in 2020.
-0.1
-0.08
-0.06
-0.04
-0.02
0
0.02
0.04
0.06
0.08
0.1
MS%chng(2018-2023)
2-1-
2 2-1-2019 2-1-2020 2-01-2021 2-1-2022 2-1-20223
2-1-2018
Results
12. Relative Risk of Stocks
• The Capital Asset Pricing Model suggests that the
risk of a stock can be determined by calculating
the coefficient of a simple regression that
measures the excess return of the stock.
• For instance the MS% change, against the stock's
return on the market, represented by the SP%
change. A higher coefficient value indicates a risk
and a potential for higher returns.
12
13. Regression Analysis
13
Regression Statistics (MSFT)
Multiple R 0.777267351
R Square 0.604144535
Adjusted R Square 0.603833817
Standard Error 0.011344282
Observations 1276
Regression Statistics (Apple)
Multiple R 0.741061097
R Square 0.549171549
Adjusted R Square 0.54881768
Standard Error 0.013906498
Observations 1276
Regression Statistics (Tesla)
Multiple R 0.481253891
R Square 0.231605308
Adjusted R Square 0.231002172
Standard Error 0.038258302
Observations 1276
We conducted a regression analysis for Microsoft, Apple, and Tesla against the S&P500. Our findings
indicate that Microsoft and Apple have a correlation of approximately 78% and 74% respectively with the
S&P500. This suggests that they are likely to follow the market trend and will gain or lose as the market
fluctuates. In contrast, Tesla's performance is less correlated with the S&P500, and its results are more
independent from the overall market. This unique characteristic may lead to higher fluctuations and
presents risks that could impact the portfolio sensitivity balance of investors.
Upon analysis of the Adjusted R Square, it appears that a mere 23% of Tesla's stock can be attributed to changes in
the S&P 500. Conversely, Microsoft boasts the highest Adjusted R Square, nearing 1.000.
14. Regression Analysis
14
MS%chng vs SP%chng Coefficients Standard Error t Stat P-value Lower 95% Upper 95% Lower 95.0% Upper 95.0%
Intercept 0.000511957 0.000317757 1.611156 0.107393404 -0.000111428 0.001135342 -0.000111428 0.001135
SP%chng 1.221720353 0.027706712 44.09474 1.2283E-258 1.167364555 1.27607615 1.167364555 1.276076
Tesl%chng Coefficients Standard Error t Stat P-value Lower 95% Upper 95% Lower 95.0% Upper 95.0%
Intercept 0.001900944 0.001071628 1.773884 0.076321168 -0.0002 0.004003 -0.0002 0.004003
SP%chng 1.83105102 0.093440178 19.59597 6.06749E-75 1.647737 2.014365 1.647737 2.014365
App%chng vs SP%chng Coefficients Standard Error t Stat P-value Lower 95%
Upper
95%
Lower
95.0% Upper 95.0%
Intercept 0.000650919 0.000389526 1.671054 0.094956559 -0.00011 0.001415 -0.00011 0.001415
SP%chng 1.338008286 0.03396454 39.39427 1.2144E-222 1.271376 1.404641 1.271376 1.404641
As shown in the tables, Tesl%chng has the highest risk and return compared to SP%chng.
16. Regression Analysis:Beta Coefficient
• Based on the beta coefficient of the S&P500, it is observed
that Microsoft has the lowest market risk, whereas Tesla has
high market risk with high returns.
• This conclusion is supported by previous plots and Line Fit
plots. Although Microsoft and Apple have the lowest beta
coefficient, they can still be good investment options with less
risk involved in the long run.
• On the other hand, Tesla is a high-risk investment option, but it
also yields high returns in the short term.
16
17. Conclusion
• For investors looking for quick buy and sell options,
Tesla is a suitable choice as it offers high growth of
profits. On the other hand, Apple and Microsoft are
ideal for long-term investments as they are more
stable and less volatile compared to the S&P500,
which means less risk but long-term profits.
• It s worth noting that events like pandemics affect the
stock prices of all companies, but Tesla experiences
high price fluctuations, which could be attributed to
its future market vision of EV cars and battery-
powered equipment.
17