Learn R Programming

EstimDiagnostics (version 0.0.3)

expect_distfit: Test a parametric distribution

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

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

Run this code
# NOT RUN {
 # 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)
# }
# NOT RUN {
# Uniformity test
x<-runif(n=1e4,-1,6)
expect_distfit(sample=x, nulldist="punif", min=-1, max=6)

# }

Run the code above in your browser using DataLab