I have a data between rating of the restaurant and the approximate price of food in the restaurant. After doing Hypothesis testing. The pearson correlation coefficient was found to be 0.33 whereas p value was calculated much lesser than .05. Which means we have to accept our Alternate hypothesis as the finding is statistically significant. Our Alternate Hypothesis was that there is some relation between the two variables. Which is contrary to what we got as the coefficient i.e 0.33 which says there is no relation between the two. Why this trade off. Can anyone tell me whether I am going wrong or am I missing something regarding the concepts.
Here is what I have tried.
You can download the data here
from scipy import stats import pandas as pd pear = pd.read_csv("stop.csv") pearson_coef, p_value = stats.pearsonr(pear['approx_cost(for two people)'], pear['rate']) print("Pearson Correlation Coefficient: ", pearson_coef, "and a P-value of:", p_value) # Results
Pearson Correlation Coefficient: 0.32609607011051456 and a P-value of: 3.595009214519809e-228
According to my understanding both p value and coefficient should be related.
Any help would be highly appreciated.