Choose two publicly traded companies with a sample size of 50 and a time range (
ID: 3235367 • Letter: C
Question
Choose two publicly traded companies with a sample size of 50 and a time range (long term/short term) for its stock prices so that you can download the data from quote.yahoo.com or google.com/finance. Make sure to STATE the COMPANY HISTORY and WHY YOU PICK THESE 2 STOCKS for comparison. (Nike and Adidas)
Run the hypothesis testing for difference in mean prices of 2 stocks that you picked from the sample size of 50. Compare the result with equal/unequal variances. Note: You can use F test to see whether 2 stocks have equal variance or not.
Explanation / Answer
I have downloaded the data from Google finance and ran the hypothesis testing and F test using R.
Glimpse of the data.
> head(nike)
DateMM DateDD DateYR Open High Low Close Volume
1 May 10, 2017 54.91 55.06 54.51 54.56 5,823,023
2 May 9, 2017 54.33 55.08 54.16 54.89 6,441,208
3 May 8, 2017 54.18 54.51 53.83 54.30 8,728,121
4 May 5, 2017 54.41 54.50 53.56 53.95 13,379,949
5 May 4, 2017 54.68 54.83 54.20 54.47 6,830,628
6 May 3, 2017 55.17 55.30 54.40 54.53 9,474,727
> head(adidas)
DateMM DateDD DateYR Open High Low Close Volume
1 May 10, 2017 99.29 99.29 98.10 98.42 64,072
2 May 9, 2017 99.90 100.19 99.81 99.96 21,036
3 May 8, 2017 99.84 100.12 99.63 99.84 56,959
4 May 5, 2017 101.04 101.99 101.04 101.99 28,812
5 May 4, 2017 101.01 101.34 100.38 100.65 71,627
6 May 3, 2017 99.10 99.53 97.92 99.25 43,895
We ran t-test for the hypothesis testing.
> t.test(nike$Close,adidas$Close)
Welch Two Sample t-test
data: nike$Close and adidas$Close
t = -40.786, df = 62.282, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-38.82969 -35.20164
sample estimates:
mean of x mean of y
56.13317 93.14883
The ouput shows that the null hypothesis is rejected and the difference in mean prices of 2 stocks is not zero.
We ran F test to see whether 2 stocks have equal variance or not.
> var.test(nike$Close,adidas$Close)
F test to compare two variances
data: nike$Close and adidas$Close
F = 0.027834, num df = 59, denom df = 59, p-value < 2.2e-16
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.01662619 0.04659853
sample estimates:
ratio of variances
0.02783444
The ouput shows that the null hypothesis is rejected and the ratio of variances of nike and adidas in not 1. That is, the variances of close price of Nike and Adidas is not equal.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.