I have a clinical dataset of 1,100 observations of 22 variables. The dataset is mildly sparse (819/24,200 data points missing) with no particular row or column being particularly affected.
Both the dependent (disease present) and independent/predictor (symptoms) variables are binary, where 0 represents absent and 1 represents present for the disease or symptom. The independent variables are relevant to the disease itself, i.e. they're not randomly selected variables.
I want to perform binary logistic regression to determine the probability of disease presence.
However, this is my first time with logistic regression and binary data and I am a bit lost. I think I've read over 100 StackOverflow/CrossValidated posts now, but because I'm so new to it all and there seem to be conflicting responses, I'm still not sure and have a few questions.
- Do I need to generate dummy variables from my binary dataset after reading it into R? It's already in 0/1 (csv) format. This is my code to do this:
df <- na.omit(read.table("data.csv", header = TRUE, sep = ","))
This imports 773 observations.
Is it possible to perform logistic regression with the sparse dataset? If so, that would allow for 1,100 observations in total.
This is my code for creating the glm model (I've removed some of the independent variables from the function below for brevity):
model.fit <- glm(has_disease ~ symptomOne + symptomTwo + symptomThree + symptomFour + symptomFive + SymptomSix, data = df, family = binomial)
When I run this, I receive this warning message:
glm.fit: fitted probabilities numerically 0 or 1 occurred
Any help would be very much appreciated.