- 阅读权限
- 255
- 威望
- 3 级
- 论坛币
- 34526 个
- 通用积分
- 56166.6176
- 学术水平
- 3539 点
- 热心指数
- 3700 点
- 信用等级
- 2923 点
- 经验
- 308806 点
- 帖子
- 14520
- 精华
- 12
- 在线时间
- 7406 小时
- 注册时间
- 2016-7-9
- 最后登录
- 2024-11-4
大师
还不是VIP/贵宾
- 威望
- 3 级
- 论坛币
- 34526 个
- 通用积分
- 56166.6176
- 学术水平
- 3539 点
- 热心指数
- 3700 点
- 信用等级
- 2923 点
- 经验
- 308806 点
- 帖子
- 14520
- 精华
- 12
- 在线时间
- 7406 小时
- 注册时间
- 2016-7-9
- 最后登录
- 2024-11-4
|
相似文件
换一批
经管之家送您一份
应届毕业生专属福利!
求职就业群
感谢您参与论坛问题回答
经管之家送您两个论坛币!
+2 论坛币
刚刚看看 Joseph Coveney 之建议的图,还蛮有趣的,与大家方享:
其程序为:
- clear *
- sysuse auto, clear
- quietly summarize mpg if foreign
- local var1mean: display %6.2f r(mean)
- local var1sd: display %6.2f r(sd)
- local var1min: display %6.2f r(min)
- local var1max: display %6.2f r(max)
- quietly summarize mpg if !foreign
- local var2mean : display %6.2f r(mean)
- local var2sd: display %6.2f r(sd)
- local var2min: display %6.2f r(min)
- local var2max: display %6.2f r(max)
- graph twoway ///
- (histogram mpg if !foreign, start(10) width(2) frequency bfcolor(brown%20) blcolor(brown)) ///
- (histogram mpg if foreign, frequency start(10) width(2) barw(1.8) bfcolor(navy%20) blcolor(navy)) ///
- (function y=normalden(x, `var1mean', `var1sd') * `var1max' , range(`var1min' `var1max') lcolor(navy)) ///
- (function y=normalden(x, `var2mean', `var2sd') * `var2max' , range(`var2min' `var2max') lcolor(brown)) ///
- , xlabel(10(5)45, labsize(small)) ylabel(, angle(horizontal) labsize(vsmall) format(%3.0f)) ///
- legend(order(1 "Domestic" 2 "Foreign") pos(2) ring(0) col(1)) ///
- note(" " "MPG Domestic: {it:M} = `var2mean' {it:SD} = `var2sd'" ///
- "MPG Foreign: {it:M} = `var1mean' {it:SD} = `var1sd'", size(vsmall)) ///
- scheme(s1color) name(HistPlusNormal1)
-
- graph twoway ///
- (histogram mpg if !foreign, start(10) width(2) fraction bfcolor(brown%20) blcolor(brown)) ///
- (histogram mpg if foreign, fraction start(10) width(2) barw(1.8) bfcolor(navy%20) blcolor(navy)) ///
- (function y=normalden(x, `var1mean', `var1sd') , range(`var1min' `var1max') lcolor(navy)) ///
- (function y=normalden(x, `var2mean', `var2sd') , range(`var2min' `var2max') lcolor(brown)) ///
- , xlabel(10(5)45, labsize(small)) ylabel(, angle(horizontal) labsize(vsmall) format(%3.2f)) ///
- legend(order(1 "Domestic" 2 "Foreign") pos(2) ring(0) col(1)) ///
- note(" " "MPG Domestic: {it:M} = `var2mean' {it:SD} = `var2sd'" ///
- "MPG Foreign: {it:M} = `var1mean' {it:SD} = `var1sd'", size(vsmall)) ///
- scheme(s1color) name(HistPlusNormal2)
-
- graph combine HistPlusNormal1 HistPlusNormal2, xcommon
复制代码
扫码加我 拉你入群
请注明:姓名-公司-职位
以便审核进群资格,未注明则拒绝
|
|
-
总评分: 经验 + 10
论坛币 + 20
学术水平 + 2
热心指数 + 2
信用等级 + 2
查看全部评分
|