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
Issue with teffects IPWRA-I am hoping someone can help with this, I am using the following code with a hospital administrative…
Deleting household member when panelist and moving other household members into the gapHi, I’ve been working on a large panel study. We’ve reshaped a database for the entire population by…
Counting unique ID who taught a course in a given district and schoolHi, I imagine this question has already been answered but I cannot seem to find it. I want to figure…
over time per country graphI am working with panel data. Panel is consist of 170 countries and time period 1970 to 2020. I want…
Year Month From Numeric VariableI want to reformat a time series variable. Code: * Example generated by -dataex-. For more info, ty…
Subscribe to:
Post Comments (Atom)
0 Response to Scatter of a local
Post a Comment