1
$\begingroup$

$$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

$\endgroup$
4
  • 2
    $\begingroup$ The first equation is an approximation. The second equation looks like an obscure definition. If these equations have no context around them, how are they relevant to you? $\endgroup$
    – Galen
    Feb 27, 2023 at 3:40
  • 1
    $\begingroup$ I’ll check this sometime, but my guess is that it’s the t-stat for the slope of a simple linear regression. $\endgroup$
    – Dave
    Feb 27, 2023 at 3:59
  • $\begingroup$ This should be reopened. The question is pretty clearly about a simple linear regression, and I was in the middle of posting an answer with a simulation suggesting that when it got closed. $\endgroup$
    – Dave
    Feb 27, 2023 at 4:05
  • 1
    $\begingroup$ While I agree with @Dave and would vote it to reopen, I would love to see a bit more context. $\endgroup$ Feb 27, 2023 at 4:13

2 Answers 2

2
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ Thank you @Doctor Milt so, if I understand it well. r means how big is the correlation between two variables, while t means if the correlation it is "true or false"? $\endgroup$
    – RodParedes
    Feb 27, 2023 at 15:24
  • $\begingroup$ $r$ is the correlation between the two variables in your sample. $t$ is a measure of how big (i.e. how far from zero) this correlation is, once you've accounted for the sample size. When $t$ takes a large (positive or negative) value, we reject the null hypothesis and conclude that the there is evidence of correlation in the population. $\endgroup$ Feb 27, 2023 at 16:00
0
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ I will leave someone else with the fun of proving the claim or showing that it is true asymptotically. $\endgroup$
    – Dave
    Feb 27, 2023 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.