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
stripplot specificationsDear colleagues I have a variable named Total Compensation1 and another called Affiliationindex1 (f…
Export browse table to ExcelHi there, is there a command that exports the whole data currently in memory to Excel? Practically,…
graph pie with some of percentagesHow to display the fraction when percentage is above 20%, I know how to display all percentages Cod…
Missing values, but no gaps in the dataDear All, I have the following data: Code: * Example generated by -dataex-. To install: ssc inst…
Rolling regression or loops - missing valuesDear All I have a peculiar issue I wish to share with you, in the hope of receiving some advice. I …
Subscribe to:
Post Comments (Atom)
0 Response to Scatter of a local
Post a Comment