Hi, I have a question about how to calculate chi-sq test without directly using the chisq function, but using the p values and chi-sq formula to manually get the result. Thank you so much!

Can you please post more details about your data and what you are trying to do? The most helpful information is in the form of a Reproducible Example. Just posting data and the exact statistical question to be answered would help a lot.

So for example, there are 40 out of 100 people who work in a factory get cancer, while the normal percent of getting cancer in their age is about 10%.

I want to draw a sample of 50 people from that factory to get 1000 samples to simulate a null distribution. And using the binomial test and chi-square goodness of fit test in that simulated null distribution.

And the following is part of my sampling data:

[1] 31 16 33 27 29 36 31 34 38 38 31 25 31 34 36 42 29 26 26 36 27 32 26 36 27 31 32 32 28

[30] 41 35 27 25 34 26 35 29 26 29 23 31 36 26 29 34 30 33 23 24 32 28 34 34 32 27 30 31 33

[59] 30 30 33 32 26 26 29 35 30 30 40 28 30 25 36 24 34 31 24 26 34 26 32 42 30 28 34 27 41

[88] 29 32 37 37 35 40 29 28 28 34 26 31 29

Just a tip: look at the code of the `chisq.test`

function.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.