Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to make scatter plot for temperature variation against fixed year gdp data in stata?

    I need to render scatter plot for temperature variation of the different period against fixed year's GDP data. Here is the how my data looks like:
    index year nuts_name ln_gdp_percapita temp prec prec100
    de111 1980 Stuttgart, Stadtkreis 3.4437037 8.862431 655.6 6.556
    de111 1981 Stuttgart, Stadtkreis 3.4817245 9.583781 849.6 8.496
    de111 1982 Stuttgart, Stadtkreis 3.5455165 9.98537 794.1 7.941
    de111 1983 Stuttgart, Stadtkreis 3.6261413 10.07422 808.7 8.087
    de111 1984 Stuttgart, Stadtkreis 3.6849778 8.962295 717.8 7.178
    de111 1985 Stuttgart, Stadtkreis 3.7324193 8.735041 678 6.78
    de111 1986 Stuttgart, Stadtkreis 3.7853408 9.22126 879.3 8.793
    de111 1987 Stuttgart, Stadtkreis 3.8146739 8.896849 812.8 8.128
    de111 1988 Stuttgart, Stadtkreis 3.8334374 10.19284 932.8 9.328
    de111 1989 Stuttgart, Stadtkreis 3.8368673 10.38375 625.1 6.251
    de111 1990 Stuttgart, Stadtkreis 3.8764558 10.49575 788.9 7.889
    de111 1991 Stuttgart, Stadtkreis 3.8976591 9.680164 548.3 5.483
    de111 1992 Stuttgart, Stadtkreis 3.8858478 10.43615 794 7.94
    de111 1993 Stuttgart, Stadtkreis 3.8010154 9.924466 818.3 8.183
    de111 1994 Stuttgart, Stadtkreis 3.7982504 11.28066 817.9 8.179
    de111 1995 Stuttgart, Stadtkreis 3.8177345 10.11049 853.7 8.537
    de111 1996 Stuttgart, Stadtkreis 3.8330691 8.610082 749.8 7.498
    de111 1997 Stuttgart, Stadtkreis 3.8768728 10.17825 672.3 6.723
    de111 1998 Stuttgart, Stadtkreis 3.8482862 10.2949 764.5 7.645
    de111 1999 Stuttgart, Stadtkreis 3.8863356 10.536 877.6 8.776
    de111 2000 Stuttgart, Stadtkreis 3.8961155 11.12235 739.8 7.398
    de111 2001 Stuttgart, Stadtkreis 3.9580305 10.43556 868.8 8.688
    de111 2002 Stuttgart, Stadtkreis 3.9719806 10.81953 991.3 9.913
    de111 2003 Stuttgart, Stadtkreis 3.9900637 10.94255 572.1 5.721
    de111 2004 Stuttgart, Stadtkreis 3.9716761 10.01566 637.8 6.378
    de111 2005 Stuttgart, Stadtkreis 3.9472859 9.911068 681 6.81
    de111 2006 Stuttgart, Stadtkreis 3.9852297 10.46386 696.9 6.969
    de111 2007 Stuttgart, Stadtkreis 4.0218077 10.7291 719.8 7.198
    de111 2008 Stuttgart, Stadtkreis 4.0313649 10.28653 703.8 7.038
    de112 1980 Böblingen 3.0586741 7.69183 1488.4 14.884
    de112 1981 Böblingen 3.0882099 8.428877 1654.5 16.545
    de112 1982 Böblingen 3.1358278 8.909945 1887.5 18.875
    de112 1983 Böblingen 3.2095358 8.994438 1603 16.03
    de112 1984 Böblingen 3.2570221 7.783634 1715.9 17.159
    de112 1985 Böblingen 3.296165 7.583616 1521.9 15.219
    de112 1986 Böblingen 3.4947195 8.016233 2034.7 20.347
    de112 1987 Böblingen 3.4863713 7.781698 1666.8 16.668
    de112 1988 Böblingen 3.5022166 8.976803 2002.6 20.026
    de112 1989 Böblingen 3.5046608 9.162287 1266.2 12.662
    de112 1990 Böblingen 3.5416462 9.227931 1627.9 16.279
    de112 1991 Böblingen 3.5449257 8.407698 1084 10.84
    de112 1992 Böblingen 3.5189314 9.259044 1663.3 16.633
    de112 1993 Böblingen 3.4293458 8.735822 1655.7 16.557
    de112 1994 Böblingen 3.4145873 10.05866 1713.7 17.137
    de112 1995 Böblingen 3.4220197 8.898904 1873.4 18.734
    de112 1996 Böblingen 3.4238458 7.541024 1466 14.66
    de112 1997 Böblingen 3.5559866 8.995603 1393.8 13.938
    de112 1998 Böblingen 3.5294514 9.155246 1598 15.98
    de112 1999 Böblingen 3.5783181 9.330466 1820.2 18.202
    de112 2000 Böblingen 3.5441277 10.01178 1548.7 15.487
    de112 2001 Böblingen 3.6095285 9.377534 1825 18.25
    de112 2002 Böblingen 3.5546341 9.763835 2215.1 22.151
    de112 2003 Böblingen 3.5538101 9.726986 1196.4 11.964
    de112 2004 Böblingen 3.5117028 8.911011 1338.4 13.384
    de112 2005 Böblingen 3.4041421 8.777123 1374.6 13.746
    de112 2006 Böblingen 3.5497153 9.413219 1401.2 14.012
    de112 2007 Böblingen 3.5854375 9.661603 1569.8 15.698
    de112 2008 Böblingen 3.5930941 9.233224 1478.1 14.781
    To get desired expected scatter plot, I used following stata command:

    Code:
    egen average_first5 = mean(temp) if inrange(year,1980,1984)
    egen average_last5 = mean(temp) if inrange(year,2004,2008)
    then I used stata' graphics tools to render scatter plot, there is no plot shown there.

    How can I get my scatter plot like this?

    Here is the desired scatter plot for temperature:
    Click image for larger version

Name:	temp1.JPG
Views:	1
Size:	42.8 KB
ID:	1449120



    here is expected scatter plot for precipitation change over the different time period:
    Click image for larger version

Name:	prec1.JPG
Views:	1
Size:	47.8 KB
ID:	1449121



    Is there anyone knows which stata command can does this job? Any quick idea on that? Thanks in advance

  • #2
    Unfortunately, the data was note shared under code delimiters, as recommend in the FAQ, hence we cannot work with it. That said, I gather you fiddle with range plots.
    Best regards,

    Marcos

    Comment

    Working...
    X