Statalist The Stata Listserver


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

st: creating polynomial expansion


From   "R.E. De Hoyos" <[email protected]>
To   <[email protected]>
Subject   st: creating polynomial expansion
Date   Mon, 22 May 2006 21:39:56 +0100

(Note: sorry if you get this twice)


Statalist,

I am interested in running semi-parametric models where the variable of interest is regressed against a polynomial expansion of degree "d" of "k" variables and all its interactions. Say I want to estimate the following model:

y = f(x,z)

Since I do not know the reduce form of it, as a first approximation, I estimate the following model with a polynomial expansion of degree 3:

y = a + \sum_{i=0}^3 \sum_{j=0}^{3-i} \beta_{ij} x^i z^j + residual

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).

Best,
Rafa
___________________________
Rafael E. De Hoyos
Faculty of Economics
University of Cambridge
CB3 9DE, UK
www.econ.cam.ac.uk/phd/red29/ *
* 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