May 22, 2022

For this project, R statistical program is used to construct time series (line) plots for Google and Amazon stock prices and return series. Further, discussion of an appropriate test is performed to claim that Amazon has a higher mean return series than Google. Null and alternative hypotheses are provided, tests performed in R, and a decision made on return series data.

**Figure 1**

*Google and Amazon Stock Prices Dataset Sample*

## Line Plots and Patterns

For the time series (line) plots, the code was written out using the *readxl* library and then renaming the file to make it easier to plot different columns. With help from the statistical tools for high-throughput data analysis website, the *plot()* function was used to create the lines for Google and Amazon stock prices and return series. Several elements were used to create the plots in Figures 1 and 2, including line width, colors, frame, line type, and a legend.

The stock price plot shows that Amazon’s stock was initially similar to Google’s, but their price rose significantly higher around November 2017. There was a slight drop in price around April 2018, but Amazon’s stock price remained higher than Google’s. This trend was consistent for the rest of the observed period.

**Figure 2**

*Time Series Line Plot for Google & Amazon Stock Prices*

The return series is calculated by using the formula (present price/past price) – 1. The return refers to a financial return, or the money made or lost in an investment (Hayes, 2021). A return series is also a historical reference to show past performance and help in forecasting (Kenton, 2021). Figure 2 shows very similar return series for Google and Amazon. Amazon shows a significantly higher return in November 2017, but they otherwise remain quite similar throughout the year. This suggests that while Amazon has a higher stock price, the company’s return is relatively equal to Google’s. This assumption is tested below.

**Figure 3**

*Time Series Line Plot for Google & Amazon Return Series*

## Testing a Claim on Mean Return Series

The question is posed as to whether it can be claimed that the mean Amazon return series is higher than that of Google. An appropriate test for this claim would be a two-sample t-test to determine if there’s a statistically significant difference between the two means (Sturdivant et al., 2016). Specifically, an unpaired or independent t-test would be best suited for this study given the two separate populations exposed to the same treatment (Sturdivant et al., 2016). To complete the test, null and alternative hypotheses are recorded, and the test is performed in R.

H_{0}: µ_{1} = µ_{2}

H_{a}: µ_{1} > µ_{2} (right-tailed test)

**Figure 4**

*Unpaired t-test in R for Mean Return Series*

*Note:*Using Sturdivant et al. (2016) as a guideline, an unpaired t-test was performed in R with the assumption that population variances are unequal.

## The Problem and Decision

In the above t-test, we are testing the claim in the alternative hypothesis that the mean Amazon return series is greater than that of Google. This makes the null hypothesis state that the mean Amazon return series is equal to that of Google, or that it is not higher than Google. After reviewing a visual line graph of the return series, I made the assumption that there is no statistically significant difference between the two means, thereby favoring the null hypothesis. The unpaired t-test was performed in R and provided a p-value of 0.1133 with a 0.05 significance level. As p > 0.05, there is insufficient evidence to reject the null hypothesis that the means are equal, or that Amazon return is not more than Google’s. We cannot claim that Amazon’s mean return series is greater than Google’s.

**References**

Hayes, A. (2021, August 27). *Return. *Investopedia. https://www.investopedia.com/terms/r/return.asp

Kenton, W. (2021, June 7). *Historical Returns. *Investopedia. https://www.investopedia.com/terms/h/historical-returns.asp

Sturdivant, R., Pardoe, I., Berrier, I., & Watts, K. (2016). *Statistics for Data Analytics. *zyBook [online].