Dear R users, I am a master student in Mathematics and I am writing my thesis in statistics. I need to use R and unfortunately I do not have any experience with a computer program. Could you please help me about chi squared goodness of fit test with R? In R-help website I saw a message about how to do that but I do not know how to cut the data into bins and calculate the expected numbers in each bin. Moreover I have to count the observed data in each bin and I do not know how to do that either. I really need help as its an essential part of my study. I appreciate if you could help. Thank you in advance, regards, Evrim Akar [[alternative HTML version deleted]]
Dear R users, I am a master student in Mathematics and I am writing my thesis in statistics. I need to use R and unfortunately I do not have any experience with a computer program. Could you please help me about chi squared goodness of fit test with R? In R-help website I saw a message about how to do that but I do not know how to cut the data into bins and calculate the expected numbers in each bin. Moreover I have to count the observed data in each bin and I do not know how to do that either. I really need help as its an essential part of my study. I appreciate if you could help. Thank you in advance, regards, [[alternative HTML version deleted]]
You might try the cut() function to convert your data from a continuous measure into an ordinal factor. Then use the table() function to get your contingency table. The R help system is very extensive. Type "?cut" to get the help on the function cut(). This works with all functions. Look at the examples at the bottom of the help. You might want to run through "An Introduction to R" which is available through the help menu. Good luck, Ian evrim akar wrote:> > Dear R users, > > I am a master student in Mathematics and I am writing my thesis in > statistics. I need to use R and unfortunately I do not have any experience > with a computer program. Could you please help me about chi squared > goodness > of fit test with R? In R-help website I saw a message about how to do that > but I do not know how to cut the data into bins and calculate the expected > numbers in each bin. Moreover I have to count the observed data in each > bin > and I do not know how to do that either. I really need help as its an > essential part of my study. > > I appreciate if you could help. > > > Thank you in advance, > > regards, > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >-- View this message in context: http://www.nabble.com/chi-squared-goodness-of-fit-test-with-R-tp21826916p21832544.html Sent from the R help mailing list archive at Nabble.com.
Hi Evrim, chisq.test() performs chi^2 GOF tests. However, the chi^2 test may be sensitive to how you bin your data if you are working with continuous data (as I infer from your mentioning cutting). You may want to look at other GOF tests. Perhaps the NIST statistics is a good starting point: http://www.itl.nist.gov/div898/handbook/index.htm HTH, Stephan evrim akar schrieb:> Dear R users, > > I am a master student in Mathematics and I am writing my thesis in > statistics. I need to use R and unfortunately I do not have any experience > with a computer program. Could you please help me about chi squared goodness > of fit test with R? In R-help website I saw a message about how to do that > but I do not know how to cut the data into bins and calculate the expected > numbers in each bin. Moreover I have to count the observed data in each bin > and I do not know how to do that either. I really need help as its an > essential part of my study. > > I appreciate if you could help. > > > Thank you in advance, > > regards, > > Evrim Akar > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >