Hi, is it not possible to create a scatter of a local variable? I'm evaluating the difference in the probabilities of Y btn men and women for a range of other variables. Through some loops I get a list of that, but when trying to plot it, I can't. Is not possible to make a scatter of a local?
This code is working (with it I get the mentioned list):
quietly {
logit pmvotegrp lrself male retnat income age edulevel
local maleA=0
local incomeA=3
local lrselfA=5
local edulevelA=3
local retnatA=3
local maleB=1
local incomeB=3
local lrselfB=5
local edulevelB=3
local retnatB=3
capture drop predA
capture drop predB
foreach nn of numlist 1/100 {
local ageA=`nn'
local ageB=`nn'
# delimit ;
local sysA=_b[_cons]+
_b[lrself]*`lrselfA'+
_b[male]*`maleA'+
_b[retnat]*`retnatA'+
_b[income]*`incomeA'+
_b[age]*`ageA'+
_b[edulevel]*`edulevelA';
local sysB=_b[_cons]+
_b[lrself]*`lrselfB'+
_b[male]*`maleB'+
_b[retnat]*`retnatB'+
_b[income]*`incomeB'+
_b[age]*`ageB'+
_b[edulevel]*`edulevelB';
local predA=exp(`sysA')/(1+exp(`sysA'));
local predB=exp(`sysB')/(1+exp(`sysB'));
# delimit cr
local diffBA=`predB'-`predA'
noisily: display in r "Case `nn' (Age `ageB'): `diffBA' "
}
}
When changing the noisily part for what follows, I get nothing:
noisily: twoway scatter `diffBA' age, msize(small) mcolor(red)
, name(dd_age, replace) legend(off)
title("Probability of voting PM's party, diff btn men and women", size(vsmall))
xtitle("Age") ytitle("Diff prob men and women")
nodraw
xlabel(0(1)100,grid angle(45) labsize(vsmall))
ylabel(1(0.001)1,grid labsize(vsmall))
Even if just coding scatter `diffBA' age, I get nothing. Any advice?
Related Posts with Scatter of a local
Firm-Sector Multilevel generalised structural equation modeling or control variable or sector control variable?- …
Ramsey Test - ARDL ModelHi Everyone, My ardl model has passed every test (eg Jarque-Bera normality test, White test and LM …
Combine the values of several obserationsDear Stata users, Can someone help me to combine data of same month but different dates into one. …
Extracting a subset of a varlist using wildcards such as *I am writing a command which takes a varlist as anargument. The variables correspond to different dr…
Combine the values of several obserationsDear Stata users, Can someone help me to combine data of same month but different dates into one. …
Subscribe to:
Post Comments (Atom)
0 Response to Scatter of a local
Post a Comment