In this article, we will examine whether the gasoline prices are related to the variables that are thought to affect gasoline prices the most by the Turkish people. One of the variables is the Brent crude oil prices that are averaged monthly in dollars; the other is the dollar exchange rate in Turkish currency (TL) that are averaged per month as well.
These variables will be shown brent and dollar respectively in the dataset. The range of the dataset is between 2013 and 2020. The brief data frame is shown below. (All the coding in the article is based on R language)
The T-test is used to examine whether the population correlation coefficient is zero or not. The pre-acceptance is that the sample is normally distributed. This pre-acceptance is violated in some situations, in those cases, an alternative non-parametric test is needed. The Spearman’s rank correlation test takes over here; because profit or price data generally do not show normal distribution. Therefore, it is not appropriate to use the Pearson correlation coefficient test in our dataset.
Spearman’s rank correlation test consider ranking while it measures the correlation between two variables. The value is as between +1 and -1 as is the Pearson correlation coefficient- – The two-way hypothesis test is described as:
First of all, the sample spearman rank correlation coefficient– – is calculated to execute the test; this happens in a couple of steps.
- Gasoline prices are ranked from small to big; in the case of equality, the ranking of equal observations are averaged and the ranking continues from where it left off. The same process is executed for Brent prices.
- The difference between the rankings of each binary observation is calculated as :
- Later, the squares of the difference are summed:
Spearman rank correlation coefficient –– is formulated as:
This result shows us that there is a positive and weak relation between gasoline and brent prices. Let’s examine this result is at a significance level of %5 and find if the alternative hypothesis is true.
The point we have to look at is highlighted in the chart above for – – and n=84; because of the – the null hypothesis –– is rejected and at the %5 significance level, we can say that although it is weak there is a positive relation between gasoline and brent prices.
Let’s check the results with another way by calling the function ggscatter.
As we can see in the chart above, spearman’s ranked correlation coefficient (R=0.3) is the same we found before; and p-value (0.0055) less than 0.05 significance level which means the alternative hypothesis is true ––
Finally, we will examine the relation between gasoline and dollar (USD/TRY)
The graphic above appears to have a strong positive relationship between gasoline and the dollar. P-value value less than 0.05 indicates that the result is significant and one more time null hypothesis is rejected.
- Sanjiv Jaggia, Alison Kelly (2013). Business Intelligence: Communicating with Numbers.
- STHDA: Correlation Test Between Two Variables in R
- Original Article