Created
October 12, 2018 19:02
-
-
Save chris-prener/31832be0d94cd8f4b72e04b3bc37f76c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Two-tailed Probabilities Under the t Distribution | |
#' | |
#' @description This function calculates the probability of observing a t score | |
#' at least as extreme as the given t value for any t test | |
#' | |
#' @param t A given t score | |
#' @param df The degrees of freedom associated with t | |
#' | |
#' @details Depending on the type of t test, degrees of freedom (v) is calculated | |
#' in a different manner. For one sample and dependent t tests, v is n-1. | |
#' For a two-sample t test, v is n-2. | |
#' | |
#' @return A probability value | |
#' | |
probt <- function(t, df){ | |
# calculate the p value | |
out <- 2*pt(q = -abs(t), df = df) | |
# return output | |
return(out) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment