![]() X is the independent variable of interest. The idea works really well, so long as you have Stata 11 or later ( margins was introduced in Stata 11). plot_margins will call parmest, so you need to have it installed to run this function.) (To download parmest.do, type " net install st0043.pkg " at the command line in Stata. Reed's idea was to then use Stata 11's new margins command to evaluate the response of Y to X and X^2 at several points along the support of X, and then to use parmest to plot the result. (Check out Stata's documentation on factor variables if this isn't familiar to you.) Is the notation to regress Y on X and X^2. ado file that you can call easily.īasically, the idea is that you run any regression using Stata's factor variable notation, where you tell Stata that a variable X is continous and should be interacted with itself, eg Reed Walker actually came up with this idea in an email exchange we had last year. Added bonuses: It plots the confidence interval you specify and can handle control variables (which are not plotted) ![]() It takes a polynomial that you use in a regression, and plots the response function. Here's my function plot_margins.ado that does it. We use high-degree polynomial's all the time, but we just don't plot them very often (I think this is because there is no built-in command do it for us). Sometimes I just want a function that is flexibly non-linear, but still smooth (so not lowess) and something I can easily write down analytically (so not fpfit or lpoly) and perhaps not symmetric (so not qfit). Stata has built in functions like lowess, fpfitci and lpolyci that will plot very flexible functions, but those tend to be too flexible for many purposes. It always bugged me that I could easily plot a linear or quadratic fit in Stata, but if I used a third-order polynomial I could no longer plot the results easily. I'll try to post something useful that I've written from the past year each day. ![]() To kick start us back in gear, I'm making good on one resolution by making this FE Week-of-Code. FE has been a little sluggish to recover from break. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |