# st: Re: Marginal effects in mvrs

 From Ryan Edwards To "statalist@hsphsun2.harvard.edu" Subject st: Re: Marginal effects in mvrs Date Mon, 9 Nov 2009 13:50:37 -0500

Here's an update to my own thread, for posterity, based on some exchanges with the author of mvrs, Patrick Royston. Thanks also to Nick Cox for forwarding my statalist question to Patrick.
```
Suppose the nonlinear model is:

y = f1(x1) + f2(x2) + f3(x3) + ... + epsilon

```
As far as I can tell, there's no easy way to interpret the regression output of the point estimates and standard errors.
```
```
The way to obtain marginal effects from a mvrs or mfp fit of y is by using "fracpred" or Patrick's "xpredict" command after the model estimation. Those functions allow you to obtain the "partial prediction" of y, meaning you can vary a single x1 while keeping the other x's fixed, call it yhat1.
```
```
The *slope* of what you obtain is the partial derivative d yhat / d x1, and this is visible in a graph of yhat1 against x1. For confidence bands, fracpred and xpredict can both produce standard errors of the estimate with the "stdp" option.
```
```
A BIG HEADS UP concerns the role of indicator/dummy/categorical variables. I believe the default is for fracpred and xpredict to generate yhat1 by setting all of the indicators equal to zero, *not* their sample means. So the upshot is that without further adjustment, you will wind up with a yhat1 that may differ quite radically in terms of levels from y.
```
```
A related warning from Patrick is that mvrs only centers variables that are spline-transformed. This will probably further shift yhat1 away from y.
```
His suggestion about how to get around these problems was to:
1.  fit the model
```
2. replace all the x2 x3 ... xn as desired --- e.g., to their sample means 3. then run fracpred or xpredict on the "new data" with all the x's changed except for the x1 of interest
```
Ryan Edwards
Assistant Professor of Economics
Queens College and the Graduate Center
City University of New York
redwards@qc.cuny.edu
cell: 510-484-3912
tel: 212-817-8273
http://qcpages.qc.cuny.edu/~redwards/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```