# Re: [R] cross-validation / sensitivity anaylsis for logistic regression model

From: <Cody_Hamilton_at_edwards.com>
Date: Mon, 14 May 2007 16:49:01 -0700

Dylan,

You might like the validate() function in the Design library. It validates several model indeces (e.g. R^2) using resampling. There is some discussion on this function (as well as on validating your model via resampling) in the book on S programming by Carlos Alzola and Frank Harrell (available at
http://biostat.mc.vanderbilt.edu/twiki/pub/Main/RS/sintro.pdf).

Regards,

-Cody

```

Dylan Beaudette
<dylan.beaudette@
gmail.com>                                                 To
Sent by:                  r-help_at_stat.math.ethz.ch
r-help-bounces_at_st                                          cc
at.math.ethz.ch
Subject
[R] cross-validation / sensitivity
05/14/2007 04:38          anaylsis for logistic regression
PM                        model

dylan.beaudette_at_g
mail.com

```

Hi,

I have developed a logistic regression model in the form of (factor_1~ numeric
+ factor_2) and would like to perform a cross-validation or some similar form of sensitivity analysis on this model.

using cv.glm() from the boot package:

# dataframe from which model was built in 'z'
# model is called 'm_geo.lrm'

# as suggested in the man page for a binomial model:
cost <- function(r, pi=0) mean(abs(r-pi)>0.5) cv.10.err <- cv.glm(z, m_geo.lrm, cost, K=10)\$delta

I get the following:
cv.10.err

1 1
0.275 0.281

Am I correct in interpreting that this is the mean estimated error percentage
for this specified model, after 10 runs of the cross-validation?

any tips on understanding the output from cv.glm() would be greatly appreciated. I am mostly looking to perform a sensitivity analysis with this
model and dataset - perhaps there are other methods?

thanks

```--
Dylan Beaudette
University of California at Davis
530.754.7341

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help