1
$\begingroup$

I am trying to generally determine sample size needed for logistic regression when using cross-validation.

The "1 in 10" rule for sample size in logistic regression is that you need about 10 cases per covariate in your minority class. So, for example, if you had a sample of 2500 people, and 500 people died, you could fit 50 variables reliably to this model since your minority class has 500 observations, and you need 10 observations in the minority class per variable. Generally, this rule of thumb can be given by:

$N = $ $\frac{10\times{k}}{p}$ ,

where $k =$ The number of covariates in the model

and $p =$ The porportion of your minority split.

So, in the above example with $ k = 3$ and $p=0.2$,

$2500 = $ $\frac{10\times{50}}{0.2}$ ,

Cross validation (to prevent overfitting) would divide my sample of 2500 into a random permutation of the sample set. In this case, using 5 fold-cross validation and using a 20%/80% train/test split, would leave me with training sets of 2000 on each fold (and even then, I'd have to hope/assume that the class splits were preserved). If the class splits are preserved, then I'd have a training sample of 2000, with 1600 in my largest class and 400 in my minority class. Then, I could only fit 40 variables reliably to this model using the rule of thumb.

So, should I be adjusting for cross validation requirements in my sample size estimates? And what if the cross validation did not preserve the class splits? Would some of the models fit in the folds potentially not be reliable? Or generally, does cross-validation lessen the need to apply the 1 in 10 rule since it is supposed to prevent over fitting in the first place and provide more reliable outputs?

Here's a visual reference for how 5-fold cross validations divides the data up:

enter image description here

$\endgroup$
  • 1
    $\begingroup$ I see no reason to give any credence to the 1-in-10 rule in the first place. $\endgroup$ – Kodiologist Apr 20 '18 at 18:36
  • $\begingroup$ @Kodiologist: Well, you have to start somewhere! For a recent study suggesting this rule of thumb's useful (though perhaps a little on the low side), see Van der Ploeg et al. (2014), "Modern modelling techniques are data hungry: a simulation study for predicting dichotomous endpoints", BMC Med. Res. Methodol., 14, 137 $\endgroup$ – Scortchi - Reinstate Monica Apr 21 '18 at 18:11
  • $\begingroup$ @Scortchi I usually start with the sample size I already have, or if the data doesn't exist yet and I'm going to conduct the study, the biggest sample I could realistically get. $\endgroup$ – Kodiologist Apr 21 '18 at 19:14
  • $\begingroup$ @Kodiologist: Sure, but how big a model do you fit? One on all conceivable predictors, with plenty of non-linear & interaction terms? Or one with a select few, perhaps derived using data reduction techniques, with only linear, additive terms? Depends on the sample size whether the former will over-fit or the latter under-fit. $\endgroup$ – Scortchi - Reinstate Monica Apr 21 '18 at 19:46
2
$\begingroup$
  • First of all: is there really any question whether you should use 40 or 50 variates?
    What do you expect of the 10 features you consider adding?

  • The 10 cases per variate rule is a very rough rule of thumb that intends to safeguard you against instability.

  • However, you can always measure whether your training is stable, e.g. with iterated/repeated cross validation.See e.g. here for some references

  • Using cross validation for estimating generalization performance, you implicitly make the assumption that nothing changes substantially when leaving out a few of your training cases. So nothing should be changed between training of your final model and training of the surrogate models.

  • If you think that this assumption may be violated (because leaving out 20 % is rather a lot), you can go for higher k, say, 10-fold or 20-fold cross validation.

  • Of course "same training procedure" doesn't answer your question as you can still formulate a training procedure that determines number of features as function of available cases.

  • Again, the solution is to use your knowledge about the application/task at hand to decide.


does cross-validation lessen the need to apply the 1 in 10 rule since it is supposed to prevent over fitting in the first place and provide more reliable outputs?

This is a misconception: cross validation does not prevent overfitting. It can only tell you that you did overfit.


what if the cross validation did not preserve the class splits? Would some of the models fit in the folds potentially not be reliable?

If so, cross validation will tell you that you cannot expect great performance. And if that's the result on 80/90/95 % of the training data, would you really rely on the 20/10/5 % additional samples to change "rescuing" your model? I wouldn't.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.