Pearson Residual Goodness-of-fit test (Updated)

I am running a logistic regression predictive model with death (sta) as the binary outcome variable, and age (continuous variable), and cancer status (variable can; categorical variable) as predictors.

I want to assess its calibration. I decided to try the "Pearson Residual" test (pls see my code below). I want to know is there any requirement for the PR test (e.g. sample size, type of predictors, etc)? I also used the Hosmer-Lemeshow (HL) test but it yielded different results (Pearson suggests good fit but the HL test does not).

Thank you so much for the help!

lr.fit <- glm(sta~age+can, data=icu, family=binomial)
p.res <- resid(lr.fit, type="pearson")
x.stat <- sum(p.res^2)
#p-value
1-pchisq(x.stat, df=lr.fit\$df.residual)
## [1] 0.4364181


• Please don't repost questions: it is much preferred that you edit the original so that the comment thread is not lost.
– whuber
Nov 26 at 17:31
• @whuber Can you pls disregard the other post and provide a comment/advice on this post? Thanks! Nov 26 at 17:38