# Why are variables in GLM being split into multiple output variables

I have input for glm that looks like

BMI  $grp PRS age gene 24.2 1 3.0 77 0.0 33.8 1 4.0 89 0.0 30.3 1 7.0 58 0.0  I’m inputting this into glm : mylogit <- glm($grp ~ BMI + PRS + age + gene, data = data, family = 'binomial')

Where $grp and gene are categorical variables, And the output looks like: [1] " data = data)", [2] "", [3] "Deviance Residuals: ", [4] " Min 1Q Median 3Q Max ", [5] "-1.6969 -1.1797 0.7726 1.0553 1.9250 ", [6] "", [7] "Coefficients:", [8] " Estimate Std. Error z value Pr(>|z|) ", [9] "(Intercept) -3.036889 2.000203 -1.518 0.1289 ", [10] "BMI 0.007068 0.027942 0.253 0.8003 ", [11] "PRS -0.201259 0.125757 -1.600 0.1095 ", [12] "age 0.056960 0.022722 2.507 0.0122 *", [13] "gene1 -0.306879 0.577173 -0.532 0.5949 ", [14] "gene2 14.642064 882.743409 0.017 0.9868 ",  My question is unrelated to Why is my categorical variable split up into separate variables in my regression model in r I've also looked at http://www.sthda.com/english/articles/40-regression-analysis/163-regression-with-categorical-variables-dummy-coding-essentials-in-r/ but this doesn't show variables being split For the formula glm(formula = Deceased ~ PRS + age + BMI + sex, family = "binomial", data = data) I won't get sex but rather just sex1 which I don't understand. > with(data, table($$grp, gene)) gene$$grp 0 1 2 0 51 8 0 1 67 7 1  My question is why is gene being split into gene1 and gene2? What is the significance of either of these? Which variable should be reported for gene? • – whuber Commented Jan 14, 2021 at 15:57 ## 1 Answer Gene is a factor with three levels. You can confirm this by checking levels(factor(data$gene)). The reference level is rolled into the intercept term, and the coefficients corresponding to the other two levels are displayed next to gene1 and gene2.

The model fit looks unreliable due to the exceedingly high standard error on gene2. I suggest taking a look at your response by each level of gene using

with(data, table(\$grp, gene))

• I've added the output of with to the question (comments don't allow for good code snippets) how can I interpret the output?
– con
Commented Jan 14, 2021 at 16:23
• This is a contingency table of the response by the levels of gene. Look at the last row: it says that you have only one observation of the response for gene2. That's causing the wonkiness of your standard errors and coefficient estimates for that group (and possibly a glm warning) Info on contingency tables: en.wikipedia.org/wiki/….
– JTH
Commented Jan 14, 2021 at 16:28