Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: re: st: STATA drops squared terms from the model


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: re: st: STATA drops squared terms from the model
Date   Tue, 14 Jul 2009 08:18:46 +0000 (GMT)

I like graphs for these type of non-linear models. The thing to keep 
track of is that the mean of a variable after a non-linear 
transformation is not the mean the original variable. For that reason
I like to use -glm- with the log link, rather than manually compute
the log of wage and use that in -regress-. For the same reason I like
to use the means of the original explanatory variables and transform
those means, rather than compute the means of the transformed 
variables. See the example below:

Hope this helps,
Maarten

*-------------- begin example ---------------
sysuse nlsw88, clear

// collect means
sum grade, meanonly
local mgrade = r(mean)
sum ttl_exp, meanonly
local mexp = r(mean)

// ln transform the dependent variables
gen lngrade = ln(grade)
gen lnexp = ln(ttl_exp)

// center and generate the polynomial terms
sum lngrade if !missing(lngrade, lnexp, wage)
gen zlngrade = (lngrade-r(mean))/r(sd)
gen zlngrade2 = zlngrade^2
local zlnmgrade = (ln(`mgrade')-r(mean))/r(sd)

sum lnexp if !missing(lngrade, lnexp, wage)
gen zlnexp = (lnexp-r(mean))/r(sd)
gen zlnexp2 = zlnexp^2
local zlnmexp = (ln(`mexp')-r(mean))/r(sd)

// generate the interaction term
gen gradeXexp = zlngrade*zlnexp

// estimate the model
glm wage zln* gradeXexp , link(log)

// prepare data for graphing
preserve
// fix grade at mean
replace zlngrade = `zlnmgrade'
replace zlngrade2 = `zlnmgrade'^2
replace gradeXexp = `zlnmgrade'*zlnexp

// create predictions
predict wagehat, mu

// create graph
twoway line wagehat ttl_exp, sort
restore
*--------------- end example -----------------


-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


--- On Tue, 14/7/09, [email protected] <[email protected]> wrote:

> From: [email protected] <[email protected]>
> Subject: Re: re: st: STATA drops squared terms from the model
> To: [email protected]
> Date: Tuesday, 14 July, 2009, 8:38 AM
> Hi Dave,
> thanks for the hint. Now the terms remain in the
> regression. But I am sill unsure about the interpretation.
> How does that change when the polynomial terms are centred?
> Best Phil
> 
> -------- Original-Nachricht --------
> > Datum: Mon, 13 Jul 2009 12:53:57 -0500
> > Von: David Airey <[email protected]>
> > An: Statalist <[email protected]>
> > Betreff: re: st: STATA drops squared terms from the
> model
> 
> > .
> > 
> > Does centering before making the polynomial terms
> help?
> > 
> > -Dave
> > 
> > 
> > > Dear Statalist, I estimate a log-log model with
> interaction term of  
> > > the following form: lnY = b0 + b1lnX + b2lnZ +
> b3lnX*lnZ + e I want  
> > > to test whether X and Z have a nonlinear effect
> on Y. Therefore, I  
> > > add squared terms of X and Z to the model. When I
> estimate this  
> > > model STATA drops X and Z from the model due to
> multicollinearity.  
> > > The correlation coefficients between the
> unsquared and squared terms  
> > > are very high (> 0,96). I have some problems
> interpreting this  
> > > result. Does this mean that there is no
> non-linear effect? Best  
> > > regards Phil
> > >
> > *
> > *   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/
> 
> -- 
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> *
> *   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index