Calculate p-values from t-, z- or F-statistics.

Description

Calculate p-values from t-, z- or F-statistics.

Usage

1
2
3
pFromZ(z_value = 1.96, two.sided = FALSE)
pFromT(t_value = 1.96, df = 10, two.sided = FALSE)
pFromF(f_value = 1.96, df1 = 10, df2 = 10, two.sided = FALSE)

Arguments

t_value, z_value, f_value

t-, z- or F-statistics to be converted into a p-Value

df, df1, df2

df: degree of freedom in t-statistics df1, df2: degrees of freedom in F-statistics

two.sided

shall the statistics be calculatede as two-sided (TURE) or one-sided (FALSE)

Value

corresponding p-Value from the t-, z- or F-statistics

Author(s)

Roland Rapold

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,

        pFromT(t_value=1.96, df=10)
        pFromT(t_value=1.96, df=100)
        pFromT(t_value=1.96, df=1000)
        pFromT(t_value=1.96, df=1000, two.sided = TRUE)

        pFromZ(z_value=1.96)
        pFromZ(z_value=1.96, two.sided=TRUE)

        pFromF(f_value=35.68, df1=2,  df2=5)
        pFromF(f_value=35.68, df1=2,  df2=5, two.sided=TRUE)
        pFromF(f_value= 1.96, df1=10, df2=10)
        pFromF(f_value= 1.96, df1=10, df2=100)
        pFromF(f_value= 1.96, df1=10, df2=1000)
        pFromF(f_value= 1.96, df1=10, df2=1000, two.sided=TRUE)
        pFromF(f_value= 1.96, df1=10, df2=1000, two.sided=TRUE)

        x <- c(seq(0.0001, 0.6, 0.01), NA, seq(0.6001, 1.0, 0.01))
        p_value <- pFromT(t_value=x, df=100)
        p_value
        formatPValue(p_value, digits=3)