expect_distfit: Test a parametric distribution

Description Usage Arguments Value Examples

View source: R/expect_distfit.R

Description

Expectation checking whether a given sample comes from a certain parametric distribution. The underlying procedure is Anderson-Darling test of goodness-of-fit ad.test. The expectation throws an error when the test's p-value is smaller than the threshold p-value.

Usage

1
expect_distfit(sample, p_value = 0.001, nulldist, ...)

Arguments

sample

to test

p_value

threshold p-value of the test

nulldist

null distribution

...

parameters to pass to the null distribution

Value

Invisibly returns a p-value of the test.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 # Gaussianity test
## Not run: 
x<-rnorm(n=1e4,5,6)
expect_distfit(sample=x, nulldist="pnorm", mean=5, sd=6.3)
expect_distfit(sample=x, nulldist="pnorm", mean=5, sd=6)

## End(Not run)

# Uniformity test
x<-runif(n=1e4,-1,6)
expect_distfit(sample=x, nulldist="punif", min=-1, max=6)

EstimDiagnostics documentation built on April 17, 2021, 1:08 a.m.