r/dataanalysis • • 5d ago

How to interpret coefficients of linear and quadratic terms?

I regress weekly sales on week number and week number squared, i.e. I have a quadratic model. I interpret the coefficient b1 of linear term as a direction of the trend (i.e. the sales either decline or grow), and I interpret the coefficient b2 of the quadratic term depending on the sign of b1: b1>0 b2>0 - growing trend that grows more b1>0 b2<0 - growing trend that slows down b1<0 b2>0 - declining trend that slows down b1<0 b2<0 - declining trend that declines faster

I'm confused when I should treat b1 and b2 as zero (i.e. no trend and acceleration/deceleration detected by the model)

A) Shall I look at individual p-value for b1 and b2
B) Shall I look at a p-value from F-test for joint significance of linear and squared term

7 Upvotes

4 comments sorted by

2

u/syntheticcfo 3d ago

I'd do it in two steps. First the joint F test, which answers whether there's any trend at all. If that isn't significant, treat both as zero. If it is, look at the t test on b2 alone, since that's the one that tells you whether there's curvature.

The p value on b1 by itself is trickier than it looks. With the squared term in, the slope at week t is b1 + 2 × b2 × t, so b1 is only the slope at week 0. Move where week 0 sits and b1 and its p value change, while the fitted curve stays exactly the same. That's also why the sign table can mislead. With b1 > 0 and b2 < 0 the curve peaks at week b1 / (2 × |b2|), and if that falls inside your data, sales are already falling by the end, not just growing more slowly.

Centering the week number (subtract the mean week before squaring) helps a lot. b1 then becomes the slope in the middle of your data, which is much easier to read, and the two terms stop being so correlated, so b1 gets a much smaller standard error. b2 and its p value don't change at all.

One more thing with weekly sales. The residuals are usually autocorrelated and often seasonal, which makes the ordinary p values look better than they are. Newey West standard errors, or at least a look at the residual ACF, are worth doing before you trust any of them.

1

u/Infinite-Low-7721 8h ago

Centering the week variable is a useful tip, especially for interpreting the coefficients. Checking for autocorrelation also seems important before drawing conclusions from the p-values

1

u/AutoModerator 5d ago

Automod prevents all posts from being displayed until moderators have reviewed them. Do not delete your post or there will be nothing for the mods to review. Mods selectively choose what is permitted to be posted in r/DataAnalysis.

If your post involves Career-focused questions, including resume reviews, how to learn DA and how to get into a DA job, then the post does not belong here, but instead belongs in our sister-subreddit, r/DataAnalysisCareers.

Have you read the rules?

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Gauzelin-Abbod 3d ago

You want the F-test (option B) if the question is whether there's any time trend at all. Week and week squared are heavily correlated, so their individual p-values can look insignificant due to multicollinearity even when the overall trend is real