R: t Distribution
I. Calculating P(t < x)
If X~t(df), where df is the degrees of freedom, use the pt(x, df) function to calculate P(X < x).
If X~t(df), where df is the degrees of freedom, use the pt(x, df) function to calculate P(X < x).
Example 1:
If X~t(4), use the following R code to calculate P(X < 1.2).
> pt(1.2, 4)
[1] 0.8518243
II. Calculating P(X > x)
If X~t(df), where df is the degrees of freedom, use the pt(x, v, lower.tail=FALSE) function to calculate P(X > x). A second method would be to subtract pt(x, df) from 1.
Example 1:
If X~t(4), use the following R code to calculate P(X > 1.2).
# Method 1 - Use "lower.tail = FALSE"
> pt(1.2, 4, lower.tail = FALSE)
[1] 0.1481757
# Method 2 - Subtract pt(x, v) from 1
> 1 - pt(1.2, 4)
[1] 0.1481757
III. Given percentile, find corresponding t-value
If X~t(df), use the qt(percentile, df) function to find the x-value that corresponds with a given percentile.
Example:
If X~t(12), what x-value corresponds with the 75th percentile?
> qt(0.90, 12)
[1] 1.356217
IV. Determing t*
For confidence interval calculations, under certain conditions, one may need to find t*. To calculate t* using R, use the following table on the bottom right.
Example:
|
|
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.