calc.stat: Calculate an EDF statistic

Description Usage Arguments Details References Examples

View source: R/calcstats.R

Description

Calculate test statistic value (and P-value?) for testing fit to specified distribution.

Usage

1
calc.stat(statfun, x, dist = punif, ...)

Arguments

statfun

Name of one of the EDF statistics (see Details)

x

Vector of data to be tested for fit to the distribution

dist

Cumulative distribution function of distribution to be fitted

...

parameters to distribution

Details

Allowable test statistics are d (Kolmogorov D), v (Kuiper V), w2 (Cramer-von Mises W-squared), a2 (Anderson-Darling A-squared), u2 (Watson U-squared). Statistics v and u2 are invariant to choice of origin, so can be used for data on a circle (for example, for testing uniformity of times of day). Also modified versions dmod, vmod, w2mod, u2mod for use with Table 4.2 of D'Agostino and Stephens (1986).

References

D'Agostino and Stephens (1986) Goodness of Fit Techniques, Chapter 4.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(leghorn)
# test the transformed data for uniformity (default)
calc.stat(a2,leghorn$z1)
# test original data for normality with mean 200 and SD 35
calc.stat("a2",leghorn$x,pnorm,200,35)
# obtain all statistics
my.stats=c("d","v","w2","a2","u2","dmod","vmod","w2mod","u2mod")
sapply(my.stats,calc.stat,leghorn$x,pnorm,200,35)
# data that are actually beta-distributed
data(beta_data)
sapply(my.stats,calc.stat,beta_data)

nxskok/edfr documentation built on May 24, 2019, 11:51 a.m.