2024-06-02

Meaning of P-Value

  • P stands for Probability, and it is the probability that the observed difference between groups is due to chance or luck
  • This is related to the Null Hypothesis, which is the claim that the effect being studied does not exist
  • In order to assert that a claim is valid, the null hypothesis should be rejected, meaning that the results were not just chance
  • If p-value < 0.05 , we reject the null hypothesis
  • If p-value > 0.05 , we fail to reject the null hypothesis
  • A p-value < 0.05 gives a 95% confidence rating in the observed data
  • To determine correlation, this is used together with the Pearson Correlation Coefficient

P-Value Formula

  • \(t = (x̄ - μ) / (s / √n)\)
  • “t” is the test statistic
  • “x̄” is the sample mean
  • “μ” is the hypothesized mean
  • “s” is the standard deviation of the sample
  • “n” is the size of the sample

Pearson Correlation Coefficient

  • \(\rho_{xy}=\frac{Cov(x,y)}{\delta_{x}\delta_{y}}\)
  • ρxy = Pearson product-moment correlation coefficient
  • Cov(x,y) = covariance of variable x and y
  • δx = standard deviation of x
  • δy = standard deviation of y

Iris Data Set Summary

summary(iris$Sepal.Length)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   4.300   5.100   5.800   5.843   6.400   7.900
summary(iris$Petal.Width)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.100   0.300   1.300   1.199   1.800   2.500

Hypothesis: Sepal length correlates with petal width
Null Hypothesis: There is no correlation between these two variables

Scatter Plot of Petal Width/Sepal Length

slide6 = plot_ly(data = iris, type = 'scatter', mode = 'markers',
                 x = ~Sepal.Length, y = ~Petal.Width) 
slide6

Boxplot with Sepal Length Mean

ggplot(iris, aes(x="", y=Sepal.Length)) +
  geom_boxplot(fill="black", color="white") +
  geom_hline(yintercept = mean(iris$Sepal.Length), color="yellow",
  linetype="dashed") +  labs(y="Sepal Length") + theme_light()

Boxplot with Petal Width Mean

ggplot(iris, aes(x="", y=Petal.Width)) +
  geom_boxplot(fill="black", color="white") +
  geom_hline(yintercept = mean(iris$Petal.Width), color="yellow", 
  linetype="dashed") +  labs(y="Petal Width") + theme_light()