# Logistic regression doesn't fit this Infection risk analysis. Wrong model?

I am looking at a logistic regression model for predicting hospital acquired infection likelihood (HAI) from predictors of whether germs are found on the x number of patients (Patient), x number of environmental spots (Env), x number of air samples (Air) or x number of nurses' hands (Hand).

   Month Patient Env Air Hand HAI HAIcat BedOccupancy
1       4   0   0    1   1    yes            9
2       2   0   2    0   0     no            9
3       2   1   0    1   0     no            5
4       1   2   0    2   2    yes            7
5       2   3   0    1   1    yes            6
6       1   2   0    0   1    yes            5
7       4   0   0    2   1    yes            7
8       2   0   0    1   3    yes            7
9       3   2   2    0   1    yes            8
10       3   0   0    1   1    yes            8


For example for Month 1, the percentage of HAI would be HAI/BedOccupancy=1/9. So I'd like to know if bed occupancy or other contamination is significant in predicting HAI. I run a Logistic regression, but it says it's junk. What does a statistician do now?

model<-glm(cbind(MR$HAI,MR$BedOccupancy)~MR$Patient+MR$Env+MR$Air+MR$Hand,family = "binomial")


But I get a bad fit and non-significant correlation:

Call:
glm(formula = cbind(MR$HAI, MR$BedOccupancy) ~ MR$Patient + MR$Env + MR$Air + MR$Hand, family = "binomial")

Deviance Residuals:
1         2         3         4         5         6         7         8         9        10
-0.12882  -1.08046  -1.33787   0.01400  -0.10685  -0.02229  -0.04008   1.03688   0.75723  -0.23824

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.30758    1.34049  -0.975    0.329
MR$Patient -0.22920 0.39350 -0.582 0.560 MR$Env      -0.02415    0.37672  -0.064    0.949
MR$Air -0.46851 0.64611 -0.725 0.468 MR$Hand      0.16054    0.58277   0.275    0.783

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 6.6594  on 9  degrees of freedom
Residual deviance: 4.6929  on 5  degrees of freedom
AIC: 30.911

Number of Fisher Scoring iterations: 5

• I think that you need to specify the number of successes and failures within the cbind() construction. This may, or may not, satisfy you. If it does not you need to tell us in what way the model has failed to come up to your expectations. Commented Apr 7, 2016 at 13:21
• The M$HAI column is the number of infections in each phase. M$BedOccupancy is the total number of patients in that phase. In phase 1, one out of nine patients had an infection and this was deetected on one hand and 4 patients. The rason i think its not a working model is because all the p values are high...
– HCAI
Commented Apr 7, 2016 at 22:24
• You are specifying the number of successes and the total number of trials not the number of failures as far as I can see. Commented Apr 8, 2016 at 12:48
• A failiure happens when HAI is 0 or HAIcat is No, right?
– HCAI
Commented Apr 8, 2016 at 20:13
• If you use $more than once in a line of R code you are probably not using R effectively. Specify data=MR to glm and omit all the$. Commented Apr 9, 2016 at 12:38

Do you have sufficient data points? How many rows are you taking to build this model? If you have sufficient data points (10*variables* cardinality within categorical variable), take HAI as dependent variable.

No statistical model is junk. If you have result like this, it clearly states that different independent variable do not have significant impact on dependent variable.( Based on data provided).

model if HAI is taken as dependent variable-

summary(model)

Call: glm(formula = a$HAI ~ a$Patient + a$Env + a$Air + a$Han + a$HAIcat + a$BedOccupancy, family = binomial) Deviance Residuals: 1 2 3 4 5 6 7 8 6.547e-06 -6.547e-06 -6.547e-06 6.547e-06 6.547e-06 6.547e-06 6.547e-06 6.547e-06 9 10 6.547e-06 6.547e-06 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -2.457e+01 3.597e+05 0 1 a$Patient -2.808e-07 5.589e+04 0 1 a$Env -4.447e-07 6.340e+04 0 1 a$Air -2.732e-08 1.072e+05 0 1 a$Han -4.251e-07 8.444e+04 0 1 a$HAIcatyes 4.913e+01 1.482e+05 0 1 a\$BedOccupancy -2.195e-07 5.789e+04 0 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 1.0008e+01  on 9  degrees of freedom


Residual deviance: 4.2867e-10 on 3 degrees of freedom AIC: 14

Number of Fisher Scoring iterations: 23

Also if you have many levels in dependent variable use Random Forest/decision tree.

• Thank you very much for looking at this. Could you clarify what your formula says please as I cannot distinguish which are the tilde characters.
– HCAI
Commented Apr 11, 2016 at 9:16
• Any chance you can paste an image as I can't see what's tilde please. What does it mean to have all dependent variables in this case?
– HCAI
Commented Apr 11, 2016 at 11:04
• HAI~Patient +Env +Air +Hand + HAIcat +BedOccupancy, as HAI is ur dependent variable. ( please ignore my earlier comment) Commented Apr 11, 2016 at 15:59