What is this equation for? $$t = \frac{r}{\sqrt{\frac{1-r^2}{n-2}}} \sim t_{n - 2}$$
with $$r = \frac{S_{xy}}{\sqrt{SC_{xx} SC_{yy}}}$$
I've just found this equation with no direct data to of what can I get from it, I couldn't get what is it use for, but I know that is relate to Pearson.
In the same diapositive, it says proof of hypothesis for $p$
$H_0$: $p=0$, there is no relation between variables
$H_1$: $p \neq 0$ there IS a relation between variables
but there it is called $p$, while the equation it says, $t$, so I assumed, there were not the same thing
 A: This is a hypothesis test for the significance of a correlation coefficient, though it is equivalent to a test for the slope in a simple linear regression. See here, for example. The first formula is the test statistic, while the second one is the sample correlation.
That should be a $\rho$ (population correlation) rather than a $p$ in your null and alternative hypotheses.
You have a bivariate sample $(x_1,y_1), \ldots, (x_n, y_n)$, where the $X$ and $Y$ variables are jointly normally distributed, and $r$ is the sample correlation. Under a null hypothesis of $\rho=0$ (no correlation between the two variables), your test statistic $t$ is $t$-distributed with $n-2$ degrees of freedom.
A: I think it is useful to be able to look at a formula with no context and reason about what it might mean. A few facets of this formula signal to me what might be happening.
The $n-2$ is a signal to me that this has something to do with a simple linear regssion, where the degrees of freedom equals the sample size $(n)$ minus the number of regression parameters fit $(2$, one for the slope and one for the intercept$)$, as that is the only time I can think of where something is divided by $n-2$ or has $n-2$ degrees of freedom. That the result is $t$-distributed signals to me that this should have to do with a regression coefficient, since OLS linear regression coefficients are $t$-distributed under the null hypothesis that they equal zero.
Then the use of Pearson correlation $(r)$ signals to me that this will be related to the slope, as the strength of the Pearson correlation between two variables is related to the strength of how well one variable predicts the other beyond always predicting the mean of that variable (an intercept-only model).
Indeed, a simulation suggests this detective work to be correct.
library(MASS)
set.seed(2023)
N <- 5
R <- 1000
diff_t <- rep(NA, R)
for (i in 1:R){
  
  # Simulate some correlated data
  #
  X <- MASS::mvrnorm(N, c(0, 0), matrix(c(
    1, 0.8, 
    0.8, 1
    ), 2, 2))
  x <- X[, 1]
  y <- X[, 2]
  
  # Fit a regression
  #
  L <- lm(y ~ x)
  
  # Extract the slope t-stat from the regression
  #
  t_regression <- summary(L)$coef[2, 3]
  
  # Calculate the Pearson correlation
  #
  r <- cor(x, y)
  
  # Calculate the value from the formula in the question
  #
  t_formula <- r  /
    (
      sqrt(
        (1 - r^2)/
          (N - 2)
      )
    )
  
  # Calculate the difference between the slope t-stat from the regression
  # function and calculated according to the formula given in the question
  #
  diff_t[i] <- t_regression - t_formula
}

# Summarize the findings: how different the values are
#
summary(diff_t)

################################################################################
#
# OUTPUT
#
################################################################################

> summary(diff_t)
      Min.    1st Qu.     Median       Mean    3rd Qu.       Max. 
-4.114e-12 -8.900e-16  0.000e+00  9.298e-14  6.700e-16  9.828e-11 

That the numbers are basically always equal (within the limits of equality when it comes to doing math on a computer) suggests my line of thinking to be reasonable, and I am quite comfortable taking the formula to be an alternative to the usual t-stat calculation in an ordinary least squares linear regression.
