t_pval: Visualization of p-values for basic hypothesis tests with the...

Description Usage Arguments Value Author(s) Examples

View source: R/t_dist.R

Description

Given T ~ t(df) the function calculates the p-value and visualizes the result as the area under the density function. Furthermore the mean and the values one and two standard deviations from the mean are highlighted.

Usage

1
2
t_pval(T_value = 0, df, direction = c("extreme", "less", "greater",
  "both"))

Arguments

T_value

The value of a test statistic with the underlying student-t distribution

(values that are very far away from the mean - roughly more than 4 times the standard deviation - are not recommend to use as the p-value will be approximately 0 or 1 anyways)

df

The degree of freedom of the underlying student-t distribution (only df greater than 2).

direction

The 'direction' of the test with respect to T:

extreme (default)

The p-value will be calculated using min(P(X ≤ T),P(X ≥ T)) with X~t(df)

less

The p-value will be calculated using P(X ≤ T) with X~t(df)

greater

The p-value will be calculated using P(X ≥ T) with X~t(df)

both

The p-value will be calculated using 2*min(P(X ≤ T),P(X ≥ T)) with X~t(df)

So for the first three options a one sided hypothesis gets tested and for the last one a two sided hypothesis is tested.

Value

a ggplot2 object displaying the results

Author(s)

Emanuel Sommer

Examples

1
2
t_pval(-2,df=20)
t_pval(T_value = 1, df=10, direction = "both")

EmanuelSommer/PvalVis documentation built on Nov. 20, 2020, 1:34 a.m.