 # Correlation between two categorical variables

Hi. I'm trying to see if there is a correlation between two categorical variables:

• gender : F, M
• type of product bought: hydrating, anti-age, purifying, normal skin, sensitive skin

The code I wrote is

``````gender_impact <- face_prod ~ gender
case1 = glm(gender_impact, data=beauty, family=binomial)
summary(case1)
#exponentiate the coefficients to get the odds ratios
round(exp(case1\$coefficients),3)
``````

and the result is

Call:
glm(formula = gender_impact, family = binomial, data = beauty)

Deviance Residuals:
Min 1Q Median 3Q Max
-1.7851 0.6741 0.6741 0.6741 0.6741

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.3661 0.2241 6.097 1.08e-09 ***
genderM 15.2000 1385.3778 0.011 0.991

Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 125.54 on 125 degrees of freedom
Residual deviance: 124.20 on 124 degrees of freedom
AIC: 128.2

Number of Fisher Scoring iterations: 15

(Intercept) genderM
3.92 3992694.08

What do I have to look at in order to say if there is a correlation or not?
And what if I have a number (age) instead of the gender? What code should I write and what should I look at?
Thank you

A post was merged into an existing topic: Correlation between two variables

Please do not duplicate open topics