0

I want to calculate Hosmer Lemeshow statistic for my multivariate logistic model. I tried both hosmerlem (command below) and hosmer.test functions.

hosmerlem(y= my binary dependent variable, yhat=fitted(my glm))

(The dependent variable for the logistic model is binary, and I included about 10 predictor variables.)

But in both cases, I keep getting this error: Error in quantile.default(yhat, probs = seq(0, 1, 1/g)) : missing values and NaN's not allowed if 'na.rm' is FALSE

Can someone please help ? Thanks in advance!

  • 1
    Please provide an actual [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) so we can see what exactly you are passing to the function. Include sample input data (it doesn't have to be your own, feel free to use sample data from the function help pages). – MrFlick Jul 27 '15 at 20:36

1 Answers1

0

To display the R code for hoslem.test type:

ResourceSelection::hoslem.test

Note, that it incorporates the quantile function:

qq <- unique(quantile(yhat, probs = seq(0, 1, 1/g)))

The quantile function throws an error because your yhat vector contains missing values.

user25494
  • 1,289
  • 14
  • 27