Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# RE: st: RE: Interpretation of quadratic terms

 From Rodolphe Desbordes To "statalist@hsphsun2.harvard.edu" Subject RE: st: RE: Interpretation of quadratic terms Date Fri, 12 Mar 2010 18:32:12 +0000

```Dear Michael,

In that case I do not get it. I do not see why -margins- would have some trouble to calculate the predicted value.

Using Stata 10:

. sysuse nlsw88, clear
(NLSW, 1988 extract)

.
.   generate year = age+1968

.
.  generate year2=year^2

.
.
.
.  reg wage year year2

Source |       SS       df       MS              Number of obs =    2246
-------------+------------------------------           F(  2,  2243) =    1.72
Model |  114.042127     2  57.0210637           Prob > F      =  0.1789
Residual |  74253.9253  2243  33.1047371           R-squared     =  0.0015
Total |  74367.9674  2245  33.1260434           Root MSE      =  5.7537

------------------------------------------------------------------------------
wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
year |   39.17561   55.13424     0.71   0.477    -68.94386    147.2951
year2 |  -.0097745   .0137323    -0.71   0.477    -.0367039     .017155
_cons |  -39245.61    55339.8    -0.71   0.478    -147768.2    69276.95
------------------------------------------------------------------------------

.
. local year2=1970^2

.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Dependent variable: wage     Command: regress
Covariates set to value: year = 1970, year2 = 3880900
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------
All |         xb        stdp          lb          ub
----------+-----------------------------------------------
|   -3.32907   (19.1968)   [-40.9744    34.3162]
----------------------------------------------------------
Key:  xb         =  Linear Prediction
stdp       =  Standard Error
[lb , ub]  =  [95% Confidence Interval]

Rodolphe

________________________________________
From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Michael Norman Mitchell [Michael.Norman.Mitchell@gmail.com]
Sent: 12 March 2010 18:11
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: Interpretation of quadratic terms

Dear Rodolphe

The behavior is a reflection of the problem of collinearity.  When
"age" is used in the model, the collinearity is not so severe and
"margins" is able to produce an estimate. But, when "year" is used in
the model, the collinearity is so severe that "margins" is not even able
to produce an estimate. That was the point of the example, that
sometimes collinearity is more of a problem than other times, and that
sometimes centering is necessary and other times centering is not necessary.

I hope that helps,

Michael N. Mitchell
See the Stata tidbit of the week at...
http://www.MichaelNormanMitchell.com

On 2010-03-12 3.55 AM, Rodolphe Desbordes wrote:
> Dear Michael,
>
> In that case, -margins- behaviour is slightly puzzling. Could the absence of output be explained by the fact that the year 1970 did not exist in your sample?
>
>
>
> .  sysuse nlsw88, clear
> (NLSW, 1988 extract)
>
> .
> . generate year = age + 1968
>
> .
> end of do-file
>
> . tab year
>
>         year |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>         2002 |         53        2.36        2.36
>         2003 |        260       11.58       13.94
>         2004 |        257       11.44       25.38
>         2005 |        225       10.02       35.40
>         2006 |        219        9.75       45.15
>         2007 |        234       10.42       55.57
>         2008 |        208        9.26       64.83
>         2009 |        222        9.88       74.71
>         2010 |        160        7.12       81.83
>         2011 |        165        7.35       89.18
>         2012 |        163        7.26       96.44
>         2013 |         78        3.47       99.91
>         2014 |          2        0.09      100.00
> ------------+-----------------------------------
>        Total |      2,246      100.00
>
>
> Best regards,
>
> Rodolphe
>
>
> ________________________________________
> From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Michael Norman Mitchell [Michael.Norman.Mitchell@gmail.com]
> Sent: 12 March 2010 07:33
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: RE: Interpretation of quadratic terms
>
> Dear Rodolphe
>
>     Thanks for your message. I think it is possible that you read a
> little bit more into my message than I intended... I was not purporting
> to compute marginal effects, and hence did not use the "dydx()" option.
> I was just showing how to compute the predicted value of "y" for a given
> value of "x". That is another way that the margins command can be used.
>
> Best regards,
>
> Michael N. Mitchell
> See the Stata tidbit of the week at...
> http://www.MichaelNormanMitchell.com
>
> On 2010-03-11 8.32 AM, Rodolphe Desbordes wrote:
>
>> Dear Eric,
>>
>> I apologise for my lack of clarity regarding the -margins- command. Even though I have hardly used it, exchanges on the Statalist have made it clear that -margins- can do many things, including the calculation of marginal effects. However Michael did not seem to have used the correct syntax; I believe that the option "dydx" must be used to obtain marginal effects.
>>
>>    Rodolphe
>>
>> ________________________________________
>> From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of DE SOUZA Eric [eric.de_souza@coleurope.eu]
>> Sent: 11 March 2010 15:01
>> To: 'statalist@hsphsun2.harvard.edu'
>> Subject: RE: st: RE: Interpretation of quadratic terms
>>
>> Dear Rodolphe,
>>
>> I don't have Stata 11 either. But according to the preface to the new edition of Cameron and Trivedi, Microeconometrics using Stata:
>> "Second, we describe the new margins command for prediction and for computation of
>> marginal effects in regression models. The margins command with options including the
>> dydx() option replaces the Stata mfx command and the user-written margeff command.
>> Additionally, the margins command when used in conjunction with factor variables can
>> simplify computation of marginal effects in models with interactions. "
>>
>> So the margins command is Stata 11 does allow one to calculate marginal effects
>>
>> Eric de Souza
>> College of Europe
>> BE-8000 Brugge (Bruges)
>> Belgium
>>
>> -----Original Message-----
>> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Rodolphe Desbordes
>> Sent: 11 March 2010 14:59
>> To: statalist@hsphsun2.harvard.edu
>> Subject: RE: st: RE: Interpretation of quadratic terms
>>
>> I do not have Stata 11 installed on this computer and I am not vary familiar with the -margins- command. However, using -margins-, you did not calculate the marginal effect but the predicted value of wage, at a given value of age.
>>
>>
>> *
>> *   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/
>>
>> *
>> *   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/
>>
>>
> *
> *   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/
>
> *
> *   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/
>
*
*   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/

*
*   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/
```