0

I am not sure how to get the p-value from the gofstat function. I do see the **test which may have a conclusion of "not computed", "not rejected" and "rejected". Any help would be great. The data used in assumed to be continuous.

Using the code below

library (fitdistrplus)
fitw <- fitdist(data, "weibull",method='mle')
fw<-gofstat(fitw)

#How to get p-value from this
fw$ad
fw$adtest
Tetsujin no Oni
  • 7,300
  • 2
  • 29
  • 46
megv
  • 1,421
  • 5
  • 24
  • 36

1 Answers1

1

Try fw$chisqpvalue. That will give you the p-value associated with the chi-squared statistic.

Note: From the documentation, it appears the A-D test, and KS test are only run if you have continuous data.

EDIT: Didn't notice that fw$ad, etc. gave only the test statistic.

EDIT 2: Hmm, after searching for quite a while, the only other thing I can find is the possible alternatives of using dgof instead. If you can get your data in the right format, that would hopefully give you the right p-vals for KS and CVM given your distribution, but I can't find anything for the A-D test with R.

You could also alternatively try emailing the author of fitdistrplus and suggest a change that the function return p-values as well?

Other than that, I don't think there is any way to directly extract/calculate the p-values, short of reading the paper the tests are based on and creating your own function. Sorry I couldn't be of more help.

Csislander
  • 2,100
  • 1
  • 13
  • 16
  • I have continuous data and just need the p-value for the ks, cvm, and ad tests. – megv May 12 '14 at 15:45
  • Nortest-- "hypothesis of normality". I am trying to match stats from SAS http://v8doc.sas.com/sashtml/qc/chap4/sect18.htm – megv May 12 '14 at 16:37
  • definitely not easy: http://www.jstatsoft.org/v09/i02/paper ; http://stats.stackexchange.com/questions/11310/critical-values-for-anderson-darling-test – Ben Bolker May 15 '14 at 23:08
  • 1
    I just wrote a little package to wrap the Marsaglia and Marsaglia code for A-D tests of uniformity. `library(devtools); install_github("ADmarsaglia","bbolker"); library("ADmarsaglia"); ?AD_pval` (you'll need to have development tools installed). This should probably allow you to translate the AD statistic for the Weibull test above into a p-value, although I haven't tested it out. – Ben Bolker May 16 '14 at 00:59