Hello,
I trying to generate a plot that has the YSM on the x-axis and the native-migrants LFP differences on the y-axis, and with the lines representing the assimilation profiles of migrants with x5 variable at 25th and 75th percentile.
The regression that I'm running is
Code:
 regress LFP age agea2 c.YSM c.YSMSQ c.YSMCB c.x5#c.YSM c.x5#c.YSMSQ c.x5#c.YSMCB
Where LFP is labor force participation, YSM , YSMSQ and YSMCB are years since migration linear, squared and cubic. For natives x5 and YSM variables take the value of 0.
I have tried using margins and predict command but none of them give the right outcome.
Using margins I did the following:

Code:
_pctile x5 if brncntr==2, perc(25 75) \\ brncntr==2 means that the individual is a migrant 
local w25=r(r1)
local w75=r(r2)
margins , at(x5=(`w25' `w75'))
marginsplot
[ATTACH]temp_20795_1608679184560_610[/ATTACH]
However, I would like to get the YSM on the x-axis, not the variable x5 25 and 75 the percentiles.
I have tried adding YSM into the margins command, but because I wrote it in the regression as a continuous variable It doesn't work. I've also tried changing my YSM variable into a factor variable but due to multicollinearity, they are deleted from the regression output.
Code:
margins YSM , at(x5=(`w25' `w75'))
marginsplot
factor 'YSM' not found in list of covariates

I would highly appreciate so help,
Thank you