楼主: 华而不实
13301 13

[作图问题求助] 请教怎么在stata中把两组面板数据的散点图画在同一张图中 [推广有奖]

  • 1关注
  • 5粉丝

已卖:993份资源

教授

84%

还不是VIP/贵宾

-

威望
0
论坛币
584 个
通用积分
0.6981
学术水平
16 点
热心指数
21 点
信用等级
15 点
经验
23553 点
帖子
680
精华
0
在线时间
2576 小时
注册时间
2007-12-10
最后登录
2025-12-30

楼主
华而不实 发表于 2020-4-11 23:38:04 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
请教高人:我现在想在面板数据中通过stata,把中国东部城市y与x的散点图(带拟合线)和内陆地区(中西部地区)城市y与x的散点图(带拟合线)画在同一张图中,以此显示出这两大地区的变量y与x散点图及其拟合线的差异。请问应该怎么输入命令?不胜感激!!!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Stata 面板数据 tata 散点图 张图中

沙发
黃河泉 在职认证  发表于 2020-4-12 06:41:27
1. 请看看 https://bbs.pinggu.org/thread-6799847-1-1.html 是否为你所需。2. 尔后你若要问程序,永远附上相关资料 (请不要用截图);若附上资料,永远用 dataex 印出资料。
•        先 ssc install dataex (并见说明),将原始 Stata 资料中具有”代表性”的一部分资料列出,以供有意回答者实验之用,并能提供具体操作指令。
•        请参考说明 https://bbs.pinggu.org/thread-5048204-1-1.html

藤椅
华而不实 发表于 2020-4-12 10:34:20
黃河泉 发表于 2020-4-12 06:41
1. 请看看 https://bbs.pinggu.org/thread-6799847-1-1.html 是否为你所需。2. 尔后你若要问程序,永远附上 ...
感谢黄老师及时回复!我所需要的图形正是您所示的这种!我的数据简要如下:
id        year        y                         x
1        2006        8.995862834        1.314005749
1        2007        9.134663488        1.313395137
1        2008        9.29189044        1.351067762
1        2009        9.334627855        1.362875546
1        2010        9.445025782        1.386851608
1        2011        9.593772456        1.364758983
1        2012        9.717826282        1.371287472
1        2013        9.755826345        1.381851204
1        2014        9.820893114        1.390423772
1        2015        9.893713607        1.399208604
1        2016        9.95423646        1.405643424
1        2017        9.991276495        1.418281649
2        2006        9.227877874        1.133250337
2        2007        9.319482845        0.99834282
2        2008        9.447084728        1.047884568
2        2009        9.390435157        1.088204624
2        2010        9.499129677        1.021836106
2        2011        9.587368383        0.906230732
2        2012        9.687227305        0.777114453
2        2013        9.755243425        0.769725172
2        2014        9.676034286        0.792944745
2        2015        9.632531359        0.848061083
2        2016        9.64917268        0.957619564
2        2017        9.680537048        1.006143607
3        2006        9.603531119        1.313080596
3        2007        9.793564098        1.352550258
3        2008        9.931200947        1.363923252
3        2009        10.14841748        1.372445978
3        2010        10.27169657        1.33293742
3        2011        10.3885935        1.340521895
3        2012        10.54002063        1.352837675
3        2013        10.63318874        1.384702484
3        2014        10.6373699        1.392465268
3        2015        10.71609878        1.411482685
3        2016        10.71827492        1.437308132
3        2017        10.38508178        1.453949588
4        2006        9.045709092        1.415755701
4        2007        9.143915462        1.424442929
4        2008        9.266309177        1.46974404
4        2009        9.28958391        1.499511881
4        2010        9.482212464        1.497785795
4        2011        9.64995004        1.495011905
4        2012        9.72020662        1.498131227
4        2013        9.701774469        1.507241431
4        2014        9.693730936        1.520240007
4        2015        9.769740975        1.523679446
4        2016        9.783994572        1.524600576
4        2017        9.796046606        1.52874394
5        2006        9.38368694        1.115308884
5        2007        9.474012385        1.197450585
5        2008        9.601117888        1.147874621
5        2009        9.70447685        1.19500342
5        2010        9.873801644        1.156599966
5        2011        10.03501007        1.036605624
5        2012        10.15581199        0.931225537
5        2013        10.02230621        0.944321114
5        2014        9.807226496        0.944661991
5        2015        9.847098899        1.025246199
5        2016        9.825490049        1.084138866
5        2017        9.910633475        1.124877358

其中,id=1,3为东部,id=2,4,5为中西部,请问我该怎么输入相关命令呢?感激不尽啊!

板凳
华而不实 发表于 2020-4-12 10:58:55
黃河泉 发表于 2020-4-12 06:41
1. 请看看 https://bbs.pinggu.org/thread-6799847-1-1.html 是否为你所需。2. 尔后你若要问程序,永远附上 ...
. clear

. input str4 id year y x

            id       year          y          x
  1.
. id      year    y                x
'year' cannot be read as a number
  1. 1       2006    8.995862834     1.314005749
  2. 1       2007    9.134663488     1.313395137
  3. 1       2008    9.29189044      1.351067762
  4. 1       2009    9.334627855     1.362875546
  5. 1       2010    9.445025782     1.386851608
  6. 1       2011    9.593772456     1.364758983
  7. 1       2012    9.717826282     1.371287472
  8. 1       2013    9.755826345     1.381851204
  9. 1       2014    9.820893114     1.390423772
10. 1       2015    9.893713607     1.399208604
11. 1       2016    9.95423646      1.405643424
12. 1       2017    9.991276495     1.418281649
13. 2       2006    9.227877874     1.133250337
14. 2       2007    9.319482845     0.99834282
15. 2       2008    9.447084728     1.047884568
16. 2       2009    9.390435157     1.088204624
17. 2       2010    9.499129677     1.021836106
18. 2       2011    9.587368383     0.906230732
19. 2       2012    9.687227305     0.777114453
20. 2       2013    9.755243425     0.769725172
21. 2       2014    9.676034286     0.792944745
22. 2       2015    9.632531359     0.848061083
23. 2       2016    9.64917268      0.957619564
24. 2       2017    9.680537048     1.006143607
25. 3       2006    9.603531119     1.313080596
26. 3       2007    9.793564098     1.352550258
27. 3       2008    9.931200947     1.363923252
28. 3       2009    10.14841748     1.372445978
29. 3       2010    10.27169657     1.33293742
30. 3       2011    10.3885935      1.340521895
31. 3       2012    10.54002063     1.352837675
32. 3       2013    10.63318874     1.384702484
33. 3       2014    10.6373699      1.392465268
34. 3       2015    10.71609878     1.411482685
35. 3       2016    10.71827492     1.437308132
36. 3       2017    10.38508178     1.453949588
37. 4       2006    9.045709092     1.415755701
38. 4       2007    9.143915462     1.424442929
39. 4       2008    9.266309177     1.46974404
40. 4       2009    9.28958391      1.499511881
41. 4       2010    9.482212464     1.497785795
42. 4       2011    9.64995004      1.495011905
43. 4       2012    9.72020662      1.498131227
44. 4       2013    9.701774469     1.507241431
45. 4       2014    9.693730936     1.520240007
46. 4       2015    9.769740975     1.523679446
47. 4       2016    9.783994572     1.524600576
48. 4       2017    9.796046606     1.52874394
49. 5       2006    9.38368694      1.115308884
50. 5       2007    9.474012385     1.197450585
51. 5       2008    9.601117888     1.147874621
52. 5       2009    9.70447685      1.19500342
53. 5       2010    9.873801644     1.156599966
54. 5       2011    10.03501007     1.036605624
55. 5       2012    10.15581199     0.931225537
56. 5       2013    10.02230621     0.944321114
57. 5       2014    9.807226496     0.944661991
58. 5       2015    9.847098899     1.025246199
59. 5       2016    9.825490049     1.084138866
60. 5       2017    9.910633475     1.124877358
61.
. end

. dataex

----------------------- copy starting from the next line -----------------------
  1. * Example generated by -dataex-. To install: ssc install dataex
  2. clear
  3. input str4 id float(year y x)
  4. "1" 2006  8.995863 1.3140057
  5. "1" 2007  9.134664  1.313395
  6. "1" 2008   9.29189 1.3510678
  7. "1" 2009  9.334628 1.3628756
  8. "1" 2010  9.445025 1.3868515
  9. "1" 2011  9.593773  1.364759
  10. "1" 2012  9.717826 1.3712875
  11. "1" 2013  9.755826 1.3818512
  12. "1" 2014  9.820893 1.3904238
  13. "1" 2015  9.893714 1.3992085
  14. "1" 2016  9.954236 1.4056435
  15. "1" 2017  9.991277 1.4182817
  16. "2" 2006  9.227878 1.1332504
  17. "2" 2007  9.319483  .9983428
  18. "2" 2008  9.447084 1.0478846
  19. "2" 2009  9.390435 1.0882046
  20. "2" 2010  9.499129 1.0218362
  21. "2" 2011  9.587368  .9062307
  22. "2" 2012  9.687227  .7771145
  23. "2" 2013  9.755243  .7697251
  24. "2" 2014  9.676034  .7929447
  25. "2" 2015  9.632531  .8480611
  26. "2" 2016  9.649173  .9576195
  27. "2" 2017  9.680537 1.0061436
  28. "3" 2006  9.603531 1.3130805
  29. "3" 2007  9.793564 1.3525503
  30. "3" 2008  9.931201 1.3639233
  31. "3" 2009 10.148417  1.372446
  32. "3" 2010 10.271697 1.3329375
  33. "3" 2011 10.388594  1.340522
  34. "3" 2012  10.54002 1.3528377
  35. "3" 2013  10.63319 1.3847024
  36. "3" 2014  10.63737 1.3924652
  37. "3" 2015   10.7161 1.4114827
  38. "3" 2016 10.718275  1.437308
  39. "3" 2017 10.385082 1.4539496
  40. "4" 2006  9.045709 1.4157557
  41. "4" 2007  9.143915  1.424443
  42. "4" 2008  9.266309  1.469744
  43. "4" 2009  9.289584  1.499512
  44. "4" 2010  9.482212 1.4977858
  45. "4" 2011   9.64995  1.495012
  46. "4" 2012  9.720206 1.4981313
  47. "4" 2013  9.701775 1.5072415
  48. "4" 2014  9.693731   1.52024
  49. "4" 2015  9.769741 1.5236795
  50. "4" 2016  9.783995 1.5246006
  51. "4" 2017  9.796046  1.528744
  52. "5" 2006  9.383687 1.1153089
  53. "5" 2007  9.474012 1.1974506
  54. "5" 2008  9.601118 1.1478746
  55. "5" 2009  9.704477 1.1950034
  56. "5" 2010  9.873801    1.1566
  57. "5" 2011  10.03501 1.0366056
  58. "5" 2012 10.155812  .9312255
  59. "5" 2013 10.022306  .9443211
  60. "5" 2014  9.807226   .944662
  61. "5" 2015  9.847099 1.0252461
  62. "5" 2016   9.82549 1.0841389
  63. "5" 2017  9.910633 1.1248773
  64. end
复制代码
------------------ copy up to and including the previous line ------------------

Listed 60 out of 60 observations

.
end of do-file

报纸
华而不实 发表于 2020-4-12 13:57:12
黃河泉 发表于 2020-4-12 06:41
1. 请看看 https://bbs.pinggu.org/thread-6799847-1-1.html 是否为你所需。2. 尔后你若要问程序,永远附上 ...
黄老师,我用如下的命令但是完全做不出来想要的效果,因为图中只显示出寥寥几个样本点,我的样本点有几千个的。:twoway (scatter Y X if treatment==1,lp(solid) lc(black) mc(black)) ///
(scatter Y X if treatment==0,lp(dash) lc(black) mc(black)), ///
xline(X1(分组临界值),lpattern(longdash) lwidth(medium thick))ytitle("Y") xtitle("X") legend(label(1 "处理组") label(2 "控制组"))
不知具体什么原因,烦请您不吝赐教!

地板
黃河泉 在职认证  发表于 2020-4-12 16:42:07
华而不实 发表于 2020-4-12 13:57
黄老师,我用如下的命令但是完全做不出来想要的效果,因为图中只显示出寥寥几个样本点,我的样本点有几千 ...
老实说,画图指令我较不熟。

7
黃河泉 在职认证  发表于 2020-4-12 17:09:22
华而不实 发表于 2020-4-12 10:58
. clear

. input str4 id year y x
试试 (你没附上 treatment 变量)
  1. destring id, replace
  2. gen treatment = 0
  3. replace treatment = 1 if id > 3

  4. sepscatter y x , sep(treatment) mc(red blue) addplot(lfit y x if !treatment, lc(red) || lfit y x if treatment, lc(blue)) legend(order(1 2))
复制代码

8
华而不实 发表于 2020-4-12 23:45:25
黃河泉 发表于 2020-4-12 17:09
试试 (你没附上 treatment 变量)
非常感谢黄老师!您给的这个还是不行。treatment就是一个0-1变量,东部为1,内陆为0.
clear

. input str4 id year y x

            id       year          y          x
  1.
. id      year    y               x           treatment
'year' cannot be read as a number
  1. 1       2006    8.995862834     1.314005749     1
  2. 1       2007    9.134663488     1.313395137     1
  3. 1       2008    9.29189044      1.351067762     1
  4. 1       2009    9.334627855     1.362875546     1
  5. 1       2010    9.445025782     1.386851608     1
  6. 1       2011    9.593772456     1.364758983     1
  7. 1       2012    9.717826282     1.371287472     1
  8. 1       2013    9.755826345     1.381851204     1
  9. 1       2014    9.820893114     1.390423772     1
10. 1       2015    9.893713607     1.399208604     1
11. 1       2016    9.95423646      1.405643424     1
12. 1       2017    9.991276495     1.418281649     1
13. 2       2006    9.227877874     1.133250337     0
14. 2       2007    9.319482845     0.99834282      0
15. 2       2008    9.447084728     1.047884568     0
16. 2       2009    9.390435157     1.088204624     0
17. 2       2010    9.499129677     1.021836106     0
18. 2       2011    9.587368383     0.906230732     0
19. 2       2012    9.687227305     0.777114453     0
20. 2       2013    9.755243425     0.769725172     0
21. 2       2014    9.676034286     0.792944745     0
22. 2       2015    9.632531359     0.848061083     0
23. 2       2016    9.64917268      0.957619564     0
24. 2       2017    9.680537048     1.006143607     0
25. 3       2006    9.603531119     1.313080596     1
26. 3       2007    9.793564098     1.352550258     1
27. 3       2008    9.931200947     1.363923252     1
28. 3       2009    10.14841748     1.372445978     1
29. 3       2010    10.27169657     1.33293742      1
30. 3       2011    10.3885935      1.340521895     1
31. 3       2012    10.54002063     1.352837675     1
32. 3       2013    10.63318874     1.384702484     1
33. 3       2014    10.6373699      1.392465268     1
34. 3       2015    10.71609878     1.411482685     1
35. 3       2016    10.71827492     1.437308132     1
36. 3       2017    10.38508178     1.453949588     1
37. 4       2006    9.045709092     1.415755701     0
38. 4       2007    9.143915462     1.424442929     0
39. 4       2008    9.266309177     1.46974404      0
40. 4       2009    9.28958391      1.499511881     0
41. 4       2010    9.482212464     1.497785795     0
42. 4       2011    9.64995004      1.495011905     0
43. 4       2012    9.72020662      1.498131227     0
44. 4       2013    9.701774469     1.507241431     0
45. 4       2014    9.693730936     1.520240007     0
46. 4       2015    9.769740975     1.523679446     0
47. 4       2016    9.783994572     1.524600576     0
48. 4       2017    9.796046606     1.52874394      0
49. 5       2006    9.38368694      1.115308884     0
50. 5       2007    9.474012385     1.197450585     0
51. 5       2008    9.601117888     1.147874621     0
52. 5       2009    9.70447685      1.19500342      0
53. 5       2010    9.873801644     1.156599966     0
54. 5       2011    10.03501007     1.036605624     0
55. 5       2012    10.15581199     0.931225537     0
56. 5       2013    10.02230621     0.944321114     0
57. 5       2014    9.807226496     0.944661991     0
58. 5       2015    9.847098899     1.025246199     0
59. 5       2016    9.825490049     1.084138866     0
60. 5       2017    9.910633475     1.124877358     0
61.
.
. end

. dataex

----------------------- copy starting from the next line -----------------------
  1. * Example generated by -dataex-. To install: ssc install dataex
  2. clear
  3. input str4 id float(year y x)
  4. "1" 2006  8.995863 1.3140057
  5. "1" 2007  9.134664  1.313395
  6. "1" 2008   9.29189 1.3510678
  7. "1" 2009  9.334628 1.3628756
  8. "1" 2010  9.445025 1.3868515
  9. "1" 2011  9.593773  1.364759
  10. "1" 2012  9.717826 1.3712875
  11. "1" 2013  9.755826 1.3818512
  12. "1" 2014  9.820893 1.3904238
  13. "1" 2015  9.893714 1.3992085
  14. "1" 2016  9.954236 1.4056435
  15. "1" 2017  9.991277 1.4182817
  16. "2" 2006  9.227878 1.1332504
  17. "2" 2007  9.319483  .9983428
  18. "2" 2008  9.447084 1.0478846
  19. "2" 2009  9.390435 1.0882046
  20. "2" 2010  9.499129 1.0218362
  21. "2" 2011  9.587368  .9062307
  22. "2" 2012  9.687227  .7771145
  23. "2" 2013  9.755243  .7697251
  24. "2" 2014  9.676034  .7929447
  25. "2" 2015  9.632531  .8480611
  26. "2" 2016  9.649173  .9576195
  27. "2" 2017  9.680537 1.0061436
  28. "3" 2006  9.603531 1.3130805
  29. "3" 2007  9.793564 1.3525503
  30. "3" 2008  9.931201 1.3639233
  31. "3" 2009 10.148417  1.372446
  32. "3" 2010 10.271697 1.3329375
  33. "3" 2011 10.388594  1.340522
  34. "3" 2012  10.54002 1.3528377
  35. "3" 2013  10.63319 1.3847024
  36. "3" 2014  10.63737 1.3924652
  37. "3" 2015   10.7161 1.4114827
  38. "3" 2016 10.718275  1.437308
  39. "3" 2017 10.385082 1.4539496
  40. "4" 2006  9.045709 1.4157557
  41. "4" 2007  9.143915  1.424443
  42. "4" 2008  9.266309  1.469744
  43. "4" 2009  9.289584  1.499512
  44. "4" 2010  9.482212 1.4977858
  45. "4" 2011   9.64995  1.495012
  46. "4" 2012  9.720206 1.4981313
  47. "4" 2013  9.701775 1.5072415
  48. "4" 2014  9.693731   1.52024
  49. "4" 2015  9.769741 1.5236795
  50. "4" 2016  9.783995 1.5246006
  51. "4" 2017  9.796046  1.528744
  52. "5" 2006  9.383687 1.1153089
  53. "5" 2007  9.474012 1.1974506
  54. "5" 2008  9.601118 1.1478746
  55. "5" 2009  9.704477 1.1950034
  56. "5" 2010  9.873801    1.1566
  57. "5" 2011  10.03501 1.0366056
  58. "5" 2012 10.155812  .9312255
  59. "5" 2013 10.022306  .9443211
  60. "5" 2014  9.807226   .944662
  61. "5" 2015  9.847099 1.0252461
  62. "5" 2016   9.82549 1.0841389
  63. "5" 2017  9.910633 1.1248773
  64. end
复制代码
------------------ copy up to and including the previous line ------------------

Listed 60 out of 60 observations

.
end of do-file

如果您有什么改进的命令敬请告知,感激不尽!

9
华而不实 发表于 2020-4-13 10:23:06
华而不实 发表于 2020-4-12 23:45
非常感谢黄老师!您给的这个还是不行。treatment就是一个0-1变量,东部为1,内陆为0.
clear
. clear

. input str4 id year y x  treatment

            id       year          y          x  treatment
  1.
. id      year    y               x           treatment
'year' cannot be read as a number
  1. 1       2006    8.995862834     1.314005749     1
  2. 1       2007    9.134663488     1.313395137     1
  3. 1       2008    9.29189044      1.351067762     1
  4. 1       2009    9.334627855     1.362875546     1
  5. 1       2010    9.445025782     1.386851608     1
  6. 1       2011    9.593772456     1.364758983     1
  7. 1       2012    9.717826282     1.371287472     1
  8. 1       2013    9.755826345     1.381851204     1
  9. 1       2014    9.820893114     1.390423772     1
10. 1       2015    9.893713607     1.399208604     1
11. 1       2016    9.95423646      1.405643424     1
12. 1       2017    9.991276495     1.418281649     1
13. 2       2006    9.227877874     1.133250337     0
14. 2       2007    9.319482845     0.99834282      0
15. 2       2008    9.447084728     1.047884568     0
16. 2       2009    9.390435157     1.088204624     0
17. 2       2010    9.499129677     1.021836106     0
18. 2       2011    9.587368383     0.906230732     0
19. 2       2012    9.687227305     0.777114453     0
20. 2       2013    9.755243425     0.769725172     0
21. 2       2014    9.676034286     0.792944745     0
22. 2       2015    9.632531359     0.848061083     0
23. 2       2016    9.64917268      0.957619564     0
24. 2       2017    9.680537048     1.006143607     0
25. 3       2006    9.603531119     1.313080596     1
26. 3       2007    9.793564098     1.352550258     1
27. 3       2008    9.931200947     1.363923252     1
28. 3       2009    10.14841748     1.372445978     1
29. 3       2010    10.27169657     1.33293742      1
30. 3       2011    10.3885935      1.340521895     1
31. 3       2012    10.54002063     1.352837675     1
32. 3       2013    10.63318874     1.384702484     1
33. 3       2014    10.6373699      1.392465268     1
34. 3       2015    10.71609878     1.411482685     1
35. 3       2016    10.71827492     1.437308132     1
36. 3       2017    10.38508178     1.453949588     1
37. 4       2006    9.045709092     1.415755701     0
38. 4       2007    9.143915462     1.424442929     0
39. 4       2008    9.266309177     1.46974404      0
40. 4       2009    9.28958391      1.499511881     0
41. 4       2010    9.482212464     1.497785795     0
42. 4       2011    9.64995004      1.495011905     0
43. 4       2012    9.72020662      1.498131227     0
44. 4       2013    9.701774469     1.507241431     0
45. 4       2014    9.693730936     1.520240007     0
46. 4       2015    9.769740975     1.523679446     0
47. 4       2016    9.783994572     1.524600576     0
48. 4       2017    9.796046606     1.52874394      0
49. 5       2006    9.38368694      1.115308884     0
50. 5       2007    9.474012385     1.197450585     0
51. 5       2008    9.601117888     1.147874621     0
52. 5       2009    9.70447685      1.19500342      0
53. 5       2010    9.873801644     1.156599966     0
54. 5       2011    10.03501007     1.036605624     0
55. 5       2012    10.15581199     0.931225537     0
56. 5       2013    10.02230621     0.944321114     0
57. 5       2014    9.807226496     0.944661991     0
58. 5       2015    9.847098899     1.025246199     0
59. 5       2016    9.825490049     1.084138866     0
60. 5       2017    9.910633475     1.124877358     0
61.
.
. end

. dataex

----------------------- copy starting from the next line -----------------------
  1. * Example generated by -dataex-. To install: ssc install dataex
  2. clear
  3. input str4 id float(year y x treatment)
  4. "1" 2006  8.995863 1.3140057 1
  5. "1" 2007  9.134664  1.313395 1
  6. "1" 2008   9.29189 1.3510678 1
  7. "1" 2009  9.334628 1.3628756 1
  8. "1" 2010  9.445025 1.3868515 1
  9. "1" 2011  9.593773  1.364759 1
  10. "1" 2012  9.717826 1.3712875 1
  11. "1" 2013  9.755826 1.3818512 1
  12. "1" 2014  9.820893 1.3904238 1
  13. "1" 2015  9.893714 1.3992085 1
  14. "1" 2016  9.954236 1.4056435 1
  15. "1" 2017  9.991277 1.4182817 1
  16. "2" 2006  9.227878 1.1332504 0
  17. "2" 2007  9.319483  .9983428 0
  18. "2" 2008  9.447084 1.0478846 0
  19. "2" 2009  9.390435 1.0882046 0
  20. "2" 2010  9.499129 1.0218362 0
  21. "2" 2011  9.587368  .9062307 0
  22. "2" 2012  9.687227  .7771145 0
  23. "2" 2013  9.755243  .7697251 0
  24. "2" 2014  9.676034  .7929447 0
  25. "2" 2015  9.632531  .8480611 0
  26. "2" 2016  9.649173  .9576195 0
  27. "2" 2017  9.680537 1.0061436 0
  28. "3" 2006  9.603531 1.3130805 1
  29. "3" 2007  9.793564 1.3525503 1
  30. "3" 2008  9.931201 1.3639233 1
  31. "3" 2009 10.148417  1.372446 1
  32. "3" 2010 10.271697 1.3329375 1
  33. "3" 2011 10.388594  1.340522 1
  34. "3" 2012  10.54002 1.3528377 1
  35. "3" 2013  10.63319 1.3847024 1
  36. "3" 2014  10.63737 1.3924652 1
  37. "3" 2015   10.7161 1.4114827 1
  38. "3" 2016 10.718275  1.437308 1
  39. "3" 2017 10.385082 1.4539496 1
  40. "4" 2006  9.045709 1.4157557 0
  41. "4" 2007  9.143915  1.424443 0
  42. "4" 2008  9.266309  1.469744 0
  43. "4" 2009  9.289584  1.499512 0
  44. "4" 2010  9.482212 1.4977858 0
  45. "4" 2011   9.64995  1.495012 0
  46. "4" 2012  9.720206 1.4981313 0
  47. "4" 2013  9.701775 1.5072415 0
  48. "4" 2014  9.693731   1.52024 0
  49. "4" 2015  9.769741 1.5236795 0
  50. "4" 2016  9.783995 1.5246006 0
  51. "4" 2017  9.796046  1.528744 0
  52. "5" 2006  9.383687 1.1153089 0
  53. "5" 2007  9.474012 1.1974506 0
  54. "5" 2008  9.601118 1.1478746 0
  55. "5" 2009  9.704477 1.1950034 0
  56. "5" 2010  9.873801    1.1566 0
  57. "5" 2011  10.03501 1.0366056 0
  58. "5" 2012 10.155812  .9312255 0
  59. "5" 2013 10.022306  .9443211 0
  60. "5" 2014  9.807226   .944662 0
  61. "5" 2015  9.847099 1.0252461 0
  62. "5" 2016   9.82549 1.0841389 0
  63. "5" 2017  9.910633 1.1248773 0
  64. end
复制代码
------------------ copy up to and including the previous line ------------------

Listed 60 out of 60 observations

.
.
end of do-file

补充了treatment。

10
震震果实 发表于 2020-4-13 14:08:22
  1. #delimit ;  
  2. twoway (scatter y x if treatment==1, mc(green) msymbol(square))
  3.        (lfit y x if treatment==1)
  4.        (scatter y x if treatment==0, mc(black))
  5.            (lfit y x if treatment==0,lpattern(longdash) lwidth(medium thick))
  6.            ,
  7.            ytitle("Y")
  8.            xtitle("X")
  9.            legend(label(1 "处理组") label(2 "处理组拟合线") label(3 "控制组") label(4 "控制组拟合线"));
  10. #delimit cr       
复制代码

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-31 07:51