我正在尝试这个代码(就在下面),Stata似乎在阅读它 - 它没有显示任何错误 - 但它不会生成任何变量。这是:
cumul price if dummy==1, gen(cprice1)
cumul price if dummy==0, gen (cprice2)
line cprice1 cprice2 price
答案 0 :(得分:2)
如果您不需要存储变量,cdfplot
就可以了。如果没有,cumul
似乎工作正常:
sysuse auto, clear
/* Without Storing Variables */
ssc install cdfplot
cdfplot price, by(foreign) saving(cdfplot, replace)
/* With Variable Creation */
cumul price if foreign == 0, gen(cprice0)
cumul price if foreign == 1, gen(cprice1)
tw conn cprice* price, sort connect(J J) ms(none none) saving(cumulplot, replace)
/* Compare the two methods */
graph combine cdfplot.gph cumulplot.gph