# About logistic regression in R

What I have is a medical data set with several variables, all 0-1 variables. I want to make inference about them with logistic regression. I have a few problems:

1. I have location variables for the disease. I was advised by my statistic advisor to put them in bins as follows: If it was solely in the right part of the organ then I would mark 1 in the column for right and similarily for left. However if it were in both places I marked in neither of the left and right column but marked one in column both. Using this approach I get error in R, numeric 0 1 error when I use glm in R and I think it is due to how these variables are constructed. Shouldn't I rather have just left and right variables and when we have the disease in both sides I should mark in left and right column and skip the both column and maybe introduce interaction term between left and right (that I would at least do in a linear model).

2. Using glm (family binomial for logistic regression) in R I was thinking how to find the best model describing some variable. I started with one usual approach with finding univarietly which variables had p-value less than $0.1$ in Fischer exact test. Then I included those variables in my model and started to delete them after which had the highest p-value. In most medical reasearches I have read when applying multivariate regression I see the usage of p-value $0.05$ but I have a feeling that it might be because of lack of understanding of the subject. When I ranked the model according to AIC and explored the best model I usually got variable with p-value around $0.1$. Which approach is preferably, is it justifyable to just cut of at p-value $0.05$ or should use AIC as an estimator of the best multivariate model? AIC does punish for extra variables and so it shouldnt give one too many variables.

• I think the part where you want to put a 1 in the columns for left and right when it's on both sides makes sense (with a column for interaction if you think there may be interaction). On the other hand I'm not sure why you're having numerical problems with the other approach you mentioned, since it's effectively the same as three dummies for three separate categories. Either way you end up with three columns which should pick up three effects (though parameterized differently), so if you had problems with one you may have them each way. On your second part, I have to agree with Frank Harrell. – Glen_b -Reinstate Monica Apr 27 '14 at 15:29
• If the only three possibilities are left, right, and both, then it makes complete sense that R would give an error when including a dummy variable for all three possibilities. In that case you can only include dummy variables for two of the three groups. – jsk Apr 27 '14 at 20:22