Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Stata FAQ How can I run a piecewise regression in Stata?

piecewise REGRESSION run stata
0
Posted

Stata FAQ How can I run a piecewise regression in Stata?

0

Say that you want to look at the relationship between how much a child talks on the phone and the age of the child. You get a random sample of 200 kids and ask them how old they are and how many minutes they spend talking on the phone. You start with a scatterplot of the data like below. use http://www.ats.ucla.edu/stat/stata/faq/talk, clear twoway (scatter talk age) (lfit talk age) Looking at this you are not happy with the nonlinearity that you see in the data, so try to add a quadratic fit. twoway (scatter talk age) (lfit talk age) (qfit talk age) Thinking about this more, you decide that you think that the amount of time that kids talk on the phone changes dramatically at age 14, and that the slope might change at that age as well. You think that a piecewise regression might make more sense, where before age 14 there is an intercept and linear slope, and after age 14, there is a different intercept and different linear slope, kind of like pictured below with just freehand drawing o

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123