Plotting Quadratic Moderating Effects using Regression Coefficients in Stata
๐ฆ 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 formatsNo download links available.