1
$\begingroup$

I am having quite some trouble using R to calculate, say, qt(0.975,6) using qf instead of qt. I know the relationship between the t-distribution and the f-distribution which I understand as follows:

// the $t^2$ $=$ $F(1,p)$ meaning that the $t^2$ distribution is basically the $F$ distribution with $1$ degrees of freedom in the numerator and $p$ degrees of freedom in the denominator.

But how would I apply this knowledge using R?

I have a similar problem with using $F$ distribution to calculate $chi squared$ and I understand that relationship to be as follows:

// two independent $chi squared$ distributions between divided by each other with degrees of freedom $p$ in the numerator and $q$ in the denominator we get an $F(p,q)$.

How would I utilize what I know here however, to do that in R?

Thanks so much for the help, in advance! :)

$\endgroup$
2
  • 2
    $\begingroup$ Solve the problem first, write the code second. If this is a programming question, describe algorithm you want to implement (and post it on StackOverflow instead). If this is a statistics question, leave programming out of it (at least in the beginning). Otherwise you end up confusing the two when they are really very different things. $\endgroup$ Sep 26, 2014 at 17:29
  • 2
    $\begingroup$ I'm betting that the piece you are missing is the fact that both the positive and negative tails of $t$ go into the positive tail of $F$. Thus, if each tail of the $t$ has an area of, say, $.10$, then the upper tail area of $F=t^2$ is $2\times.10=.20$. If you're dealing with quantiles, of course, you need to think this in reverse. $\endgroup$
    – Russ Lenth
    Sep 26, 2014 at 17:45

1 Answer 1

1
$\begingroup$

As indicated by @rvl, you want to be sure that you are taking into consideration that F is always two tailed. If you do this by changing the quantile you request from the F ditribution to be .95 relative to the one tailed t of .975, you'll get the expected result: all.equal(sqrt(qf(0.95,1,6)),qt(.975,6)).

In regards to $\chi^2$ ... I just don't know. See @Aniko's comment below as a possible explaination as to why this isn't turning out quite like you might expect.

$\endgroup$
4
  • 3
    $\begingroup$ +1 for the first part of your answer, but the second part is confused. The ratio of the two chi-squared variables is always F, but it does not follow that the ratio of any given quantiles is the quantile of the ratio. $\endgroup$
    – Aniko
    Sep 26, 2014 at 19:12
  • $\begingroup$ I am certainly more than a bit confused about the second part, even with your comment in hand. Which two $\chi^2$ variables would one be talking about in regards to the equation mentioned by the asker? $\endgroup$ Sep 26, 2014 at 19:51
  • $\begingroup$ My apologies but why do we change our significance level from 0.975 to 0.95 again? Because F-dist is two tailed? $\endgroup$
    – nicefella
    Sep 26, 2014 at 20:19
  • $\begingroup$ The $t$ distribution is two tailed. The $F$ distribution also technically has two-tails. One tail stretches to $\inf$ and the other ends at 0. Typically we care about the upper tail because it reflects higher variance than expected. However, unlike $t$, $F$ is blind to whether one specific mean is higher or lower than another specific mean, it just knows about squared differences (variances). As a negative variance is non-nonsensical, so too are negative values of $F$. $\endgroup$ Sep 26, 2014 at 20:53

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.