Back to Browse

Plotting Quadratic Moderating Effects using Regression Coefficients in Stata

223 views
Apr 8, 2026
9:54

๐Ÿ“ฆ ssc install qmodplot If you've ever run a moderated regression with a quadratic term and wondered how to visualise it properly, this is for you. โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” WHAT IT DOES โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” qmodplot handles three models: โ–ธ Model 1 โ€” linear x with a moderator โ–ธ Model 2 โ€” U-shaped (quadratic) x with a moderator โ–ธ Model 3 โ€” fully moderated curvature, where the moderator changes not just the vertex of the parabola but the steepness of the curve itself For every call it produces two graphs: โœ… Conditional curves โ€” y = f(x) at several moderator reference points โœ… Marginal effect curves โ€” dy/dx across the x range, with a zero reference line โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” WHAT MAKES IT DIFFERENT โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ๐Ÿ“Œ Any number of moderator reference points โ€” not just the standard low/medium/high. Binary (0 1), ordinal (1 2 3 4 5), or continuous cut-points (2000 3000 4000). Or let the data pick quantiles automatically. ๐Ÿ“Œ Delta-method confidence bands โ€” semi-transparent shading so you can see the curves and overlapping bands at the same time. ๐Ÿ“Œ Turning-point table โ€” reports exactly where the vertex of each parabola falls and whether it lies within your data range. ๐Ÿ“Œ Observation scatter โ€” plots each data point (or panel-unit mean) as a labelled dot over the model curves. ๐Ÿ“Œ Reads straight from e(b)/e(V) after regress โ€” no manual coefficient copying. โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” QUICK START โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” sysuse auto, clear gen mpgsq = mpg^2 gen mpgwt = mpg * weight regress price mpg mpgsq weight mpgwt qmodplot, model(2) fromereturn \\ xvar(mpg) xsqvar(mpgsq) mvar(weight) xmvar(mpgwt) \\ xname(MPG) mname(Weight) yname(Price) \\ xrange(12 41) mdata(weight) nquantiles(3) \\ ci cutstats combine โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ๐Ÿ”— GitHub: github.com/nomanarshed/qmodplot ๐Ÿ“– Install: ssc install qmodplot Feedback, bug reports, and feature requests are very welcome โ€” open an issue on GitHub or drop a comment below. #Stata #Econometrics #StatisticalSoftware #OpenSource #ResearchMethods #DataVisualization #AcademicResearch #QuantitativeResearch #SSC #Moderation #Interaction #QuadraticRegression

Download

0 formats

No download links available.

Plotting Quadratic Moderating Effects using Regression Coefficients in Stata | NatokHD