I'm trying to create a regression that would include a polynomial (let's say 2nd order) of year
on a certain interval of year
(say 1 to 70) and a number of dummies for certain values of year
(say for every year
between 45 and 60).
If I didn't have the restriction for dummies, I believe the commands would be:
gen year2=year^2
regress y year year2 i.year if inrange(year,1,70)
I can't make the dummies manually, there will be more than 15 of them in the end). Could anybody help me, please?
If I then want to plot the estimated function without the dummies, why do these two bring different things?
twoway function _b[_cons] +_b[year]*x + _b[year2]*x^2, range(1 70)
twoway function _b[_cons] +_b[year]*year + _b[year2]*year^2, range(1 70)
The way I understood it, _b[_cons]
, _b[year]
and _b[year2]
call previously calculated coefficients for the corresponding independent variables and then multiplies it with them. Why does it bring different results then if x
should be the same thing as year
in this case?