[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: creating polynomial expansion
What I am doing is to create the variables: x^2 , x^3 , z^2 and z^3
I am creating all possible interactions (without including those ones
the same variable, e.g. x * x^2). In a second step I regress these
against "y". The procedure gets quite unmanageable with three
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
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
* For searches and help try: