2024-10-30

What is the P-Value?

The P-value of a graph is a measure used in statistics that indicates how likely it is that the data on a graph could have occurred by chance or is a consistent result.

pvalue

Key concepts of the P-Value

  • It will range between 0 and 1, with a small values indicating that the result of a plot is less likely to be random.
  • Does not prove anything, can only be used to indicate how likely an effect is due to chance
  • general thresholds are .05, .01, and .001

pvalue

Steps to Calculate the P-Value

In order to calculate the P-value, there are a few steps that we must follow in order to get an accurate measure. Here we’ll break it down into 2 parts.
1- calculating the F-statistic
2- Use the F-statistic to find the P-value.
Below we’ll calculate the first step:

\[ F = \frac{\text{MS}_{\text{model}}}{\text{MS}_{\text{residual}}} \] where
- \(\text{MS}_{\text{model}}\) is the mean square of the model (explained variance)
- \(\text{MS}_{\text{residual}}\) is the mean square of the residuals (unexplained variance)

Calculating P-Value Cont.

Once we found the F-statistic, we have all the tools we need to calculate the P-value. There are a few pieces of information that are important to understand to fully grasp the equation, they are:

degrees of freedom
- df1 = the number of groups - 1
- df2 = total observations - number of groups

F-distribution CDF
- Calculates the probability of observing an F-statistic similar to the observed value (uses df1 & df2)

we take this information and plug it into the the following formula:
\[ \text{p-value} = P(F > F_{\text{observed}}) = 1 - \text{CDF}_{F(\text{df}_1, \text{df}_2)}(F_{\text{observed}}) \] The function “pf()” performs this calculation for us, see the next slide for an example.

Plotting with the P-Value in R

Here is code used to create a 3D graph in the next slide, looking closely we can see the pf() function in action.

Visualizing the P-Value: 3D Graph Example

Fun Plotting with the P-Value

It can and should be noted that for this graph, the P-value is too good, which should also be treated as suspect. Much like in machine learning, there is such a thing as “Over fitting”

More Plotting

This P-value is in an acceptable range and can be treated as accurate, showing that there is a correlation between solar radiation levels and the earth’s temperature.

The End

Thanks for taking the time to Look through this Presentation!