Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: piecewise regression that uses panel data with entity and time fixed effects

 From "George Davies" To statalist@hsphsun2.harvard.edu Subject st: piecewise regression that uses panel data with entity and time fixed effects Date Sat, 22 Jun 2013 20:38:50 +0200

```Dear all,

I am having difficulties with a piecewise/segmented linear regression model with panel data and fixed effects, and would appreciate any thoughts you might have.

I am using Stata 12 for Mac.

I have a balanced panel dataset (15 countries over 30 years).  Being somewhat of a beginner (apologies for my ignorance!) I have followed a UCLA tutorial (http://www.ats.ucla.edu/stat/stata/faq/piecewise.htm) of how to fit a simple piecewise linear model, but would like to know whether I have committed any statistical sins by adapting it to use with panel data and fixed (both entity and time) effects.

I have used -mkspline- to split x (at 0) into two, as I have good theoretical reasons to believe the relationship to differ where x is positive/negative.  Using –areg- I have then fitted the model [“areg y neg_x pos_x negx_dummy i.year, absorb(country) cluster(country)”].   Is there any real difference between this and “xtreg y neg_x pos_x negx_dummy i.year, fe cluster(country)”?

The results are obviously very similar with both, and what I would expect given prior theory.  But I’d be very interested to hear opinions on whether the model is complete nonsense or not.

To try to find the optimal cut point I am also not completely sure what is appropriate.  UCLA has a tutorial that uses the –nl- command to perform a nonlinear least-squares estimation (http://www.ats.ucla.edu/stat/stata/faq/nl_optimal_knots.htm), but I’m afraid I don’t know how/whether it would be appropriate to adapt that to include the fixed effects.  Any thoughts you might have, or pointers towards useful literature, would be greatly appreciated!

Thanks very much for your consideration

George
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```