blog/chi-square-test-of-independence-in-r/ #55
Replies: 13 comments 6 replies
-
Comment written by Herivelto Cordeiro dos Santos on November 30, 2020 11:55:35: Hi Antoine! I realy liked your blog, I think is clear and focus! Let me ask you about this one... I have tried the scripts method #1 and #2 and I got different p-values. Do you know what could be the reason for that as they should be equal? My table is matrix (c(63,78,94,65), ncol=2). |
Beta Was this translation helpful? Give feedback.
-
Comment written by Antoine Soetewey on November 30, 2020 12:20:12: Thank you for your feedback! I just tried on my side, and I have the same p-values with your data, see my code here. One potential reason you have different p-values is due to the fact that first method use the Yate's continuity correction by default. Add the argument (I've added a note at the end of this section following your comment.) Hope this helps. Regards, |
Beta Was this translation helpful? Give feedback.
-
Hi Antoine! Thank you so much for your blog, it's very helpful! I have a question for you: I have a data frame with several (10) different categorical variables that I would like to test for possible correlations between each other. Is there a way that I can test them all at the same time, like you explained for the quantitative variables? Or is it really only possible for two variables at the same time? Not sure how I would do this for 10 variables... |
Beta Was this translation helpful? Give feedback.
-
Dear Clarice, Do you want to compute correlation coefficients or perform chi-square tests? You mentioned correlations but you posted the comment on the article about chi-square test, so I'm not sure. For correlation, if your categorical variables are ordinal, you can simply use The standard Chi-square test for independence (with the Hope this helps. Regards, |
Beta Was this translation helpful? Give feedback.
-
Hey Antoine! Thank you so much for your quick answer. My goal is to find out whether the different variables correlate with each other or not, so I can exclude them before computing a model.
From your blog I learned that it’s not possible to compute correlation coefficients between two categorical variables (if I understood that correctly?) but only to do a contingency analysis.
Some of my categorical variables are ordinal with 3-4 levels, most of them are nominal though. I tried to use the corr() function that you suggested, but unfortunately I just can’t make it work with my R version… not sure why.
So I’ll have to find another way I guess!
Best wishes,
Hanna
|
Beta Was this translation helpful? Give feedback.
-
You understood correctly:
Regards, |
Beta Was this translation helpful? Give feedback.
-
Alright, I get it. Sorry for the confusion and thanks for your help!
Best wishes,
Hanna
|
Beta Was this translation helpful? Give feedback.
-
Hello Mr Antoine, |
Beta Was this translation helpful? Give feedback.
-
Hello, Here is a reproducible example using for loop:
Hope this helps. Regards, |
Beta Was this translation helpful? Give feedback.
-
Trouble installing summarytools on r studio server I'm building a shiny dashboard on an r studio server here's the error installation method:
result from install in console:
If i try to run the app after attempting to install summarytools it crashes with:
installing them in r has no affect jimbo |
Beta Was this translation helpful? Give feedback.
-
so i was able to install magick in the background using command line libraries in the code now look like this:
dashboard launches without error |
Beta Was this translation helpful? Give feedback.
-
with regard to this piece of code in the example:
i don't know what this means
sorry for my newbness...i just use something like this in any of my calculations:
cheers ~! |
Beta Was this translation helpful? Give feedback.
-
Hi Antoine, regarding this: |
Beta Was this translation helpful? Give feedback.
-
Chi-square test of independence in R - Stats and R
Learn when and how to use the Chi-square test of independence in R. See also how it works in practice and how to interpret the results of the Chi-square test
https://statsandr.com/blog/chi-square-test-of-independence-in-r/
Beta Was this translation helpful? Give feedback.
All reactions