I am building a logistic model with about 20 variables. I have used the following code:
`fullmod = glm(cancer ~ B_SEX+BLINE_AGE_AT_BASELINE+B_BMI+B_chro+B_fdrc+B_hrt+B_LMET+ B_MET+B_FV+B_EDU+B_INC+B_MAR+B_EMP+B_sm_status+B_sm_y+CDHQ1_ALCOHOL_MYP+CDHQ1_HEI_2005_DERV+red.meat.w.g+red.meat_cat+location,family=binomial,data=all)
Summary(fullmod) ` I got the following output:
I have investigated the correlation structure/linear dependencies of independent variables , found this:

So, Sex is correlated with the intercept, I found some explanation regarding this situation here enter link description here
But what is the solution, how I can remove this singularity

B_SEXhas more than one value in it? This would occur if all values were the same. Are there any missing values in the predictors? – Noah Nov 28 '20 at 19:30with(na.omit(all), table(B_SEX)), are there still two unique values? When missing data are present, all rows with missing data are removed byglm(), so the dataset thatglm()fits the model on may not have the same levels as the data you submitted. – Noah Nov 28 '20 at 23:54glm()cannot include missing values in the predictors or outcome. Search on this site for how to deal with missing values in regression. It's a big topic and the best answer depends on your purpose. – Noah Nov 29 '20 at 22:37