How should I treat categorical variables for the purpose of the "One in 10 rule"? Hope a basic question like this is alright! To avoid overfitting, we try to maintain enough cases for the least common event per explanatory variable; people usually recommend at least 10.
How should I treat categorical variables for this purpose?
Say my dataset is grant submissions, and I run a logistic regression for success rates, predicted by 2 ordinal variables (amount requested, PI H-index) and by 2 categorical variables (1 of 5 departments, 1 of 2 sex).
Presuming the average success rate is 25%, how many cases would I need to avoid overfitting? Would that be around 160 ([10*4] * [4]) or something more on the order of 800 ([10*4] * [2] * [5*2])?
 A: It depends on what you do, e.g. if you treat the ordinal variables add linear predictors (e.g. after log transformation) and the categorical ones as factors,  then 800. You count degrees of freedom add follows: intercept (1),  each ordinal variable (+2), 5-1 for departments (+4) and 2-1 for sex (+1).
However,  if you e.g. fit a spline to amount requested, this would be more parameters than 1. On the other hand,  if you have a lot of departments and use a department random effect,  you might have fewer effective parameters for the departments than number of departments - 1.
Also note that depending on the specific data you may run into problems despite 10 events per predictor (more precisely,  it should be records in the rarer outcome category; some people say 20 and some recent publications suggest that it really depends on the application) - e.g. it would be intuitive that there are problems, if nobody from a certain department ever got a grant (separation) or if there were only ever very few applications (sparse data). For those types of situation some techniques like exact logistic regression,  Firth's penalized likelihood logistic regression, Bayesian methods or the LASSO (or elastic net) with hyperparameters tuned e.g. via cross validation may help. Machine learning methods like Random Forrest or xgboost may also be interesting, depending on what level of interpretability you need. 
