I was reading different resources about regression diagnostic, in particular for Logistic Regression.

As for leverage, the sources suggest to seek for observations with higher-than-average leverage.

Now, where I am confused is about how the mean leverage is calculated.

One sources suggests: (k+1)/N

where k=number of predictors, N=sample size

My question:

1) if one of the predictors is categorical, in k do we have to also count the levels of the categorical predictor?

2) do we have to also count the intercept (I think not)?

As for a practical example, given the dataset and the model below, how would you calculate the average leverage?

Code:

```
mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv")
mydata$rank <- factor(mydata$rank)
> head(mydata)
admit gre gpa rank
1 0 380 3.61 3
2 1 660 3.67 3
3 1 800 4.00 1
4 1 640 3.19 4
5 0 520 2.93 4
6 1 760 3.00 2
fit <- glm(admit ~ gre + gpa + rank, data=mydata, family=binomial(logit))
```

In other words, if we have 1 continuous predictor and 1 categorical predictor with 3 levels, k would be:

2 (i.e., 1 continous predictor + 1 categorical predictor)

or

3 (i.e., 1 continuous predictor + 2 [i.e., the levels of the categ predictor minus one due to dummy coding]) ?

Thanks for any clarification

gm