Learn R Programming

rvgtest (version 0.7.2)

plot.rvgt.htest: Plot p-Values against Sample Size

Description

Method for plotting the p-values of test results on RVG frequency tables.

Usage

## S3 method for class 'rvgt.htest':
plot(x, alpha = 0.001, \dots)

Arguments

x
an object of class "rvgt.htest" or a list of such objects.
alpha
significance level.
...
further graphical parameters.

Details

Plot common logarithm of p-values stored in an object of class "rvgt.htest" (i.e., p-values of tests on RVG frequency tables). The p-values are plotted against increasing sample size. The significance level alpha is marked by a red dashed line. This allows for visible inspection of test results.

Argument x must be an object of class "rvgt.htest" that contains information about the test and p-values. Such an object is created by rvgt.chisq or rvgt.Mtest.

Alternatively, when the method is called by its full name, plot.rvgt.htest, then the first argument x may also be a list of such objects. Then p-values for multiple experiments will be plotted in the same graph with different colors. Thus one can compare the power of different tests or the results for different generation methods.

See Also

rvgt.chisq, rvgt.Mtest.

Examples

Run this code
## Create a frequency table for normal distribution and show histogram.
## Use a sample of size of 5 times 10^5 random variates.
table <- rvgt.ftable(n=1e5,rep=5, rdist=rnorm,qdist=qnorm, mean=1,sd=2)

## Perform a chi-square goodness-of-fit test and plot result
r1 <- rvgt.chisq(table)
plot(r1)

## Perform M-test
r2 <- rvgt.Mtest(table)
plot(r2)

## Create a plot that contains the results of both tests
plot.rvgt.htest(list(r1,r2))

Run the code above in your browser using DataLab