Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65570

Marginsplots of a linear functions of coefficients from a single first-difference regression

$
0
0
I am trying to figure how to plot a linear function of coefficients from a first-difference regression.

Here's a non-sensical example:

Code:
webuse nlswork, clear
xtset idcode year
reg D.(ln_wage hours ttl_exp), cluster(idcode)
Given this model, I would like to plot the function y = 100*(-.0046281+ .0345487)*x for x=1 and x=2, along with the implied confidence interval.

I tried to do it with lincom:

Code:
lincom 100*((_b[D.ttl_exp] + _b[D.hours])*1)
lincom 100*((_b[D.ttl_exp] + _b[D.hours])*2)
but that command does not let you vary x or nor can you combine two lincoms, so there's no way to combine the estimates in a single plot:

I suppose I can save these to a resultset, merge and then combine, but there must be an easier way.

I also tried to do it with margins:
Code:
margins, expression(100*((_b[D.ttl_exp] + _b[D.hours])*D.ttl_exp)) at(D.ttl_exp ==(1 2))
This produces the error "unknown function ()".

Viewing all articles
Browse latest Browse all 65570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>