I am fitting my experimental data with different distributions, I am computing Anderson Darling statistic for my data and theoretical distributions. I want to compute P value from Anderson Darling statistic without using the tables, How can I compute P value?
1 Answer
If you don't want to interpolate from pre-computed tables, you may want to do bootstrap-based simulation. Try adSim (https://cran.r-project.org/package=qualityTools)
Let's use normal distribution in our example. You'll need to change the string to something else if you don't like to test for normality.
Interpolation
adSim(x, "normal", NA)
$distribution
[1] "normal"
$parameter_estimation
mean sd
32.450662 1.717755
$Anderson_Darling
[1] 0.5028619
$p_value
[1] 0.1865325
The table critical values are 75%, 90%, 95%, 97.5% and 99% percentile (available in the source code https://github.com/cran/qualityTools/blob/master/R/adSim.R).
Boostrap simulation
adSim(x, "normal", 10000)
... simulating the Anderson-Darling distribution by 10000 bootstraps for normal distribution...
$distribution
[1] "normal"
$parameter_estimation
mean sd
32.450662 1.717755
$Anderson_Darling
[1] 0.5028619
$p_value
[1] 0.1917
-
$\begingroup$ The link to the qualityTools package no longer seems to work, perhaps CRAN.R-project.org/package=qualityTools is better? $\endgroup$– mdeweyAug 28, 2018 at 12:11
-
-
$\begingroup$ The github one works here but not the one to the Czech domain. $\endgroup$– mdeweyAug 28, 2018 at 12:33