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?
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.
- Solved – Why are the degrees freedom not available when I conduct a Monte Carlo simulation with a chi-square test
- Solved – Chisq.test not working in R
- Solved – Chi Squared Results in R and Python
- Solved – Manually calculated chi-squared statistic differs from that given by chisq.test in R
- Solved – How to assess difference in binary variable between two groups