plotcf: p-value investigation

plotcfR Documentation

p-value investigation

Description

Plots sorted p-values showing which ones would have been rejected

Usage

plotcf(y, q=0.05)

Arguments

y

dataset

q

p-value of critical region

Details

Sorts p-values and plots the order statistic. Useful for investigating a statistical test by using it when the null hypothesis is KNOWN to be true, just to check if the probability of rejection really is alpha.

Also can be used when H0 is wrong, showing what beta is.

Author(s)

Robin K. S. Hankin

Examples

f.H0.T <- function(n,free=5){t.test(rt(n,df=free))$p.value}
f.H0.F <- function(n,free=5){t.test(rf(n,df1=free,df2=free))$p.value}

plotcf(sapply(rep(10,100),f.H0.T))  # should reject about 5: thus
                                     # probability of a type I error is
                                     # about 0.05 (as it should be; this
                                     # is an exact test)
plotcf(sapply(rep(10,100),f.H0.F))  # should reject about 80: thus
                                     # probability of a type II error is
                                     # about 0.2 for this H_A.



Davies documentation built on March 18, 2022, 5:52 p.m.