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

Margins at specific values of one variable, expressed/computed as one other variable.

$
0
0
Dear All,

In a panel data set of
50 groups, id_group

and 3 continuous variables:
Y, 10 values by group
X, 10 values by group
Xspecific : results of previous estimation procedures. One unique value, in the range of X, by group.

I regress Y on X . Then I want : margins, at( X = Xspecific )
Ideally I would like to obtain : margins, generate( Xtarget ) at( X = Xspecific )
I know that “at( X = Xspecific )” is a faulty syntax, but it clearly expresses the purpose.

A hopeless variant is:
margins , generate( Xtarget) at( X = gen( X == Xspecific ))

I want to apply the procedure to thousands of groups.


My faulty code is :

forvalues i = 1/50 {
regress Y X if id_group == `i'
margins , generate( Xtarget ) at( X = Xspecific )
}


Of course the following code works:

forvalues i = 1/50 {
regress Y X if id_group == `i'
margins , generate( Xtarget ) at( X = a numeric value in the range of X )
}


Thank you for your help!

Viewing all articles
Browse latest Browse all 73139

Trending Articles



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