Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: creating polynomial expansion


From   "R.E. De Hoyos" <[email protected]>
To   <[email protected]>
Subject   st: Re: creating polynomial expansion
Date   Tue, 23 May 2006 20:19:37 +0100

Kit,

Thanks for your suggestion, it was what I was looking for.

Rafa
----- Original Message ----- From: "Kit Baum" <[email protected]>
To: <[email protected]>
Sent: Monday, May 22, 2006 11:01 PM
Subject: st: creating polynomial expansion



Rafa said

What I am doing is to create the variables: x^2 , x^3 , z^2 and z^3 and then
I am creating all possible interactions (without including those ones within
the same variable, e.g. x * x^2). In a second step I regress these variables
against "y". The procedure gets quite unmanageable with three variables and
higher order polynomials.

I am wondering if there is a code that generates the variables of the
polynomial expansion, or if there is a way to program this (perhaps there is
something in Mata that I am not aware of).



The code for whitetst (ssc type whitetst.ado) does something quite similar for squares and cross-products (including the pruning necessary if your varlist includes, e.g., x and x^2). You could readily adapt it to handle cubes.


Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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