[R] Goodness of fit of binary logistic model

Paul Smith phhs80 at gmail.com
Fri Aug 5 23:16:25 CEST 2011


Thanks, Frank. The following piece of code generate data, which
exhibit the problem I reported:

-----------------------------------------
set.seed(123)
intercept = -1.32
beta = 1.36
xtest = rbinom(1000,1,0.5)
linpred = intercept + xtest*beta
prob = exp(linpred)/(1 + exp(linpred))
runis = runif(1000,0,1)
ytest = ifelse(runis < prob,1,0)
xtest <- as.factor(xtest)
ytest <- as.factor(ytest)
require(rms)
model <- lrm(ytest ~ xtest,x=T,y=T)
model
residuals.lrm(model,'gof')
-----------------------------------------

Paul


On Fri, Aug 5, 2011 at 7:58 PM, Frank Harrell <f.harrell at vanderbilt.edu> wrote:
> Please provide the data or better the R code for simulating the data that
> shows the problem.  Then we can look further into this.
> Frank
>
> -----
> Frank Harrell
> Department of Biostatistics, Vanderbilt University
> --
> View this message in context: http://r.789695.n4.nabble.com/Goodness-of-fit-of-binary-logistic-model-tp3721242p3721997.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list