# How to compute Average partial effects?

If we have a model like this: $$\hat {Prob}(Y=1|X) = F(\hat \beta_0 + \hat \beta_1 age + \hat \beta_2 education + \hat \beta_3 salary)$$ (suppose education is a scalar variable here) where $$F$$ is a cdf of some distribution, then do we compute AVERAGE PARTIAL EFFECT of e.g. variable age by averaging the effects for every observation in the sample as: $$\frac{1}{n} \sum_{i=1}^n f(\hat \beta_0 + \hat \beta_1 age_i + \hat \beta_2 education_i + \hat \beta_3 salary_i) * \hat \beta_1$$

($$f$$ is the density) or do we keep other variables (education, salary) at their means during the computation as: $$\frac{1}{n} \sum_{i=1}^n f(\hat \beta_0 + \hat \beta_1 age_i + \hat \beta_2 \overline {education} + \hat \beta_3 \overline {salary}) * \hat \beta_1$$

$$\overline {education} = \frac{1}{n} \sum_{i=1}^n education_i$$ and the same for salary.

Which one of the two is used when computing Average partial effects?

• There are In my experience the second version is quite uncommon (assuming that $age_i$ should not be replaced with $\overline{age}$). Replacing $age_i$ with $\overline{age}$ in the second expression would be something like "partial effect at the mean". – Elias Dec 14 '19 at 19:21
• Yes, if you replace $age_i$ with $\overline {age}$, it is the marginal effect at mean of variables. But I am not interested in this one, I am interested in what is referred to as "average partial effects". – doremi Dec 14 '19 at 21:54

It is the first one. In general, the average partial effect of a continuous variable $$x_k$$ is $$\frac{\beta_k}{n}\sum_{i=1}^nf(\textbf{x}_i\beta),$$ where $$\textbf{x}_i$$ is the observed vector of explanatory variables corresponding to observation $$i$$. To estimate the average partial effect of $$x_k$$ you can thus compute $$\frac{\hat\beta_k}{n}\sum_{i=1}^nf(\textbf{x}_i\hat\beta).$$ Thus, since $$age$$ is continuous, it is the first expression you need to compute.