Solved – df missing in R output of chi-square- test

I performed a chi-square goodness-of-fit test with R, which uses simulation of the p-value:

x<-c(0.16*260,0.48*260,0.31*260,0.05*260,0)  chisq.test(x, p=c(0.25,0.25,0.3,0.11,0.09),simulate.p.value = TRUE, B = 1000) 

The output says:

Chi-squared test for given probabilities with simulated p-value (based     on 1000 replicates)  data:  x X-squared = 95.4358, df = NA, p-value = 0.000999 

I think the df should be 4. Why is it missing in the output? The documentation at

does not mention the df-related output.

Any similar experience with R packages? Would you consider it worth a feature request?

You've specified simulate.p.value = TRUE, so chisq.test will use a test statistic and P-value based on a Monte Carlo approach. In this case, there is no assumed chi-square distribution for the test statistic, so there is also no df parameter involved.

Similar Posts:

Rate this post

Leave a Comment