I've called a multiple logistic regression as follows:
step_1 <- glm(CD3LR ~ alb + surg + ASA_opt + BMI + bil + Hb_cat + MDRD + sex + DM
+ age + Path + Smoking,
na.action = na.exclude, family = binomial)
When I want to test the model by creating a ROC curve, I use the pROC package and call:
roc(CD3LR, step_1$fitted.values, plot=FALSE)
However this returns the error:
> roc(CD3LR, step_1fitted.values, plot=FALSE)
Setting levels:control=0,case=1
Error in roc.default(CD3LR,step_1fitted.values, plot = FALSE) :
Response and predictor must be vectors of the same length.
I think this is because there are 3 missing values for the MDRD
variable and because I've used na.exclude
this results in 3 fewer step_1$fitted.values
than I have for CD3LR
Is there a way to generate a ROC curve using only the CD3LR
values that correspond to the step_1$fitted.values
??
Very grateful for any help!