2014년 5월 18일 일요일

통일관련 국내외 연구

http://choonsik.blogspot.kr/2014/05/40.html?spref=fb&m=1 에서 인용한 글++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

통일 관련 국내 및 해외 연구 보고서 40여 건 총정리

(※ 국내·외에서 발간된 통일의 경제적 효과 분석 보고서 40여 건의 목록과 링크를 대외경제정책연구원이 정리한 것이다. 아래 내용을 다시 사용할 경우 이 블로그 이름이나 대외경제정책연구원을 출처로 밝혀주십시오.)

국립외교원
통일 전후 독일 경제 상황과 독일 통일이 한반도에 주는 함의 (2014.02)


국회예산정책처
통일비용에 대한 기존연구 검토 (2011.08)

메리츠종금증권 리서치센터
향후 남북통일에 따른 한국경제 및 금융시장 파급효과 (2014.03)

산업연구원
독일 통일 20년의 경제적 교훈과 시사점 (2010.09)

세계경제연구원
통일 독일의 경제•정치적 위상과 한국에 대한 시사점 (2013.08)
통일 이후 독일 경제침체의 교훈 (2007.02)

제주평화연구원
독일통일의 쟁점과 한반도 통일에의 시사점 (2011.02)

키움증권 리서치센터
독일 통일 후 경제 및 금융시장 (2011.03)

통일연구원
정치•사회•경제 분야 통일 비용•편익 연구 (2013.12)
통일 비용•편익의 분석모형 구축 (2012.12)
통일 비용•편익 추계를 위한 북한 공식경제부문의 실태연구 (2011.12)

한국개발연구원(KDI)
통일 비용⋅편익 논의의 재조명 (2014.03)
남북통합의 경제적 기초: 이론, 이슈, 정책 (2013.11)
남북한 경제통합 연구: 북한경제의 장기발전전략 (2013.10)
남북한 경제통합 연구: 북한경제의 한시적 분리 운영방안 (2013.05)

한국경제학회
통일 후 독일경제의 교훈 (2013년 6권 1호)

한국수출입은행
독일통일실태 보고서: 독일연방하원 앙케이트위원회 보고서 (2011.11)

한국은행
통일 이후 남북한 경제통합방식에 대한 연구 (2007.01)

한국조세재정연구원
통일재원 조달 방식에 대한 연구 (2011.12)

현대경제연구원
통일 한국의 경제적 잠재력 추정 (2014.04)
2013년 북한 GDP 추정과 남북한의 경제•사회상 비교 (2014.03)

Centre for Eastern Studies (OSW)
One country, two societies? Germany twenty years after reunification (2011.02)

Centre for Economic Policy Research (CEPR)
Fiscal Federalism in Germany: Stabilization and Redistribution Before and After Unification (2009.04)
The Costs of Remoteness: Evidence from German Division and Reunification (2005.04)

CESifo
Labor Market Effects of Economic Integration - The Impact of Re-Unification in German Border Regions (2004.04)

Deutsche Bundesbank
Trend and cycle features in German residential investment before and after reunification (2010.10)
Private consumption in Germany since reunification (2007.09)

Hamburg Institute of International Economics (HWWI)
The effect of market access on the labor market: Evidence from German reunification (2012.09)

International Centre for the Study of East Asian Development, Kitakyushu
The Political Economy of Re-unification between Two Koreas (2009.04)

International Economic Journal
Korean Economic Integration: Prospects and Pitfalls (2012 V.26 N.3)

Kiel Institute for the World Economy (IFW)
The Caring Hand that Cripples: The East German Labor Market After Reunification (2006.05)

Levy Economics Institute of Bard College
The Economic Consequences of German Unification (2001.11)
On the “Burden” of German Unification (2001.05)

National Bureau of Economic Research (NBER)
Learning Capitalism the Hard Way—Evidence from Germany's Reunification (2013.07)
The Fiscal Burden of Korean Reunification: A Generational Accounting Approach (2004.08)

Peterson Institute for International Economics (PIIE)
Going Beyond Economic Engagement: Why South Korea Should Press the North on Labor Standards and Practices (2014.04)
Modeling Korean Unification (1999.07)
The Costs and Benefits of Korean Unification (1998)
The Economics of Korean Unification (1997)

RAND
North Korean Paradoxes : Circumstances, Costs, and Consequences of Korean Unification (2005)

Wirtschaftsordnung und Sozialpolitik, Universitt Wrzburg
Reunification, Restructuring, Recessions and Reforms – The German Economy over the Last Two Decades (2008)

2014년 3월 25일 화요일

[Stata] 지도를 이용한 그래프 그리기

Stata 에서 지도 이용한 그래프 그리기


 
가끔씩 데이타들을 위 그림과 같이 지도로 이용해서 보여주면 편리할 때가 있습니다.
 
뭐라 부르는 것이 정확한 용어인지 모르겠지만, Stata 에서 지도를 이용해서 그래프 그리는 법 소개하겠습니다.
 
아래 두 링크 참조했는데, 링크에 소개된 방법을 그대로 따르면 제 컴퓨터에서는 몇 가지 에러가 납니다 (예를 들면 그럴 필요가 없어 보이는데, x 좌표의 범위를 (-20,20)으로 한정하라든지, dta 확장자를 안 넣어주면 에러가 난다든지). 아래 소개하는 예는, 최소한 제 컴에서는 아무런 문제 없이 돌아갔습니다. 쓰시는 컴 사양과 데이타에 맞춰서 알아서 쓰시기 바랍니다.
 
- How do I graph data onto a map? (http://www.stata.com/support/faqs/graphics/tmap.html)
 
 
1. 먼저 tmap, shp2dta, mif2dta 세 가지 파일이 필요합니다. 만약에 이 파일들이 없을 경우, Stata 명령어창에서
 
ssc install tmap
ssc install shp2dta
ssc install mif2dta
 
차례로 쳐 주면 알아서 깔립니다. 인터넷 연결이 되어 있어야 합니다.
 
tmap 은 본인의 데이타와 좌표 정보를 이용해서 그래프를 그려주는 프로그램입니다.
 
좌표를 비롯해서 여러 정보를 포함한 지도 파일에는 ESRI (Enviroment Systems Research Institute) 에서 개발한 shapefile (확장자 shp)과 MapInfo interchange format (확장자 mif)이 있는데, shp2dta 와 mif2dta 는 shp 파일과 mif 파일을 Stata 에서 쓸 수 있게끔 만들어 주는 명령어들입니다. 즉, shp 파일을 쓰면 shp2dta를, mif 파일을 쓰면 mif2dta 를 쓰면 됩니다. 이 예제에서는 shapefile 을 이용하기 때문에 mif2dta 는 쓸 필요 없습니다.
 
 
2. 필요한 지도를 찾아야 합니다. 보통 google 에서 "필요한 나라/지역 + shapefile" 치면 대부분 찾아집니다. 미국의 경우 "United States + shapefile" 하면 주별 경계가 표시된 shp 파일 찾을 수 있습니다. 세계 각국의 지도는 http://www.cdc.gov/epiinfo/shape.htm 에 있습니다. 여기서는 한국지도를 쓰겠습니다.
 
http://www.cdc.gov/epiinfo/asia.htm 에서 South Korea 를 클릭하면 자동압축 파일이 나오는데, 편리한 폴더(제 경우는 c:\data)에 풀어 놓으면 5개의 파일이 생깁니다. 파일 중 ks.shp 가 있는데 이 파일을 Stata 에 맞게끔 바꿔줘야 합니다.
 
cd c:\data                           
 
먼저 작업폴더를 바꿔줍니다. 다음 shp2dta 를 이용하면 두 가지 파일이 생깁니다. 하나는 국가이름, 지역이름 등의 정보를 가진 파일이고, 또 하나는 (x,y) 좌표정보를 가진 파일입니다.
 
shp2dta using ks, database(skdb) coordinates(kcord) genid(id)          
 
shp파일을 변환합니다. ks는 다운 받은 shp 파일 이름입니다. database ( ) 안에는 국가이름, 지역이름 등의 정보를 포함할 파일 이름을 지정해주고, coordinates (  ) 안에는 좌표 정보를 포함할 파일 이름을 지정해 줍니다. 그리고, genid (  ) 안에는 ID identifier 역할을 할 변수 이름을 정해줍니다. 이 경우, 대한민국의 14개 시도가 id = 1,2,3,...,14 로 표시됩니다. 
 
shp2dta 명령어 실행후 생성된 파일을 보면, skdb.dta 에는 국가이름 = 한국, 14개 시도의 이름, id 등의 정보가 들어가 있습니다. kcord.dta 에는 id 와 (x,y) 좌표 정보가 들어가 있습니다.
 
skdb.dta 는 이렇게 생겼습니다.
 
 
kcord.dta 는 이렇게 생겼구요. 좌표정보가 보이지요.
 
 
 
3. 본인의 데이타와 위 파일들을 merge 명령어를 써서 합쳐야 합니다. 제가 쓸 데이타 파일은 kdata.dta 인데  id 변수를 고리로 skdb.dta, kcord.dta 와 연결되니 id 변수를 반드시 가지고 있어야 합니다.
 
id 변수가 있고, x 라는 변수를 편의상 1부터 14까지 만들었습니다. x 변수에 시/도별 인구, 기독교인 비율, 산업생산량 등 사용할 변수를 입력해서 쓰시면 됩니다.

 
use kdata, clear
 
kdata.dta 파일을 불러 옵니다 (이 예제와 똑같이 우리나라 14개 시/도 지도를 쓰시면 첨부된 kdata-5296-ergodic.dta 를 kdata.dta 로 이름 바꾸고, x 변수에 관련 변수값을 넣어주면 됩니다)
 
merge id using skdb, sort unique
 
id 변수를 매개로 kdata.dta 와 skdb.dta 를 합치는 명령어입니다. 성공적으로 합쳐졌는지 확인하려면 tab _mergedrop if _merge!=3 을 차례로 실행하면 됩니다.
 
아래 그림을 보면 skdb.dta 에 우리의 관심 변수인 x 가 포함되었습니다.
 

 
 
4. tmap 명령어를 이용해서 x 변수를 지도에 그립니다.
 
tmap choropleth x, id(id) map(kcord.dta) palette(Blues)
 
tmap choropleth 다음에는 지도 위에 그릴 변수 이름을 표시해줍니다. id ( )에는 14개 시/도의 identifier 변수 이름을, map ( )에는 좌표정보를 가지고 있는 파일 이름을 넣어줍니다. palette(Blues)는 파란 색 계열로 지도를 표시하라는 옵션입니다.
 
결과물입니다.
특정 시/도를 제외하고 싶으면 해당되는 id 를 이용하면 됩니다. 예를 들어 서울을 제외하고 싶으면, 서울의 id 번호 7을 이용해서 아래와 같이 실행하면 됩니다.
 
tmap choropleth x if id!=7, id(id) map(kcord.dta) palette(Blues)

2014년 3월 9일 일요일

[Stata] Export tables to Excel

In the spotlight: Export tables to Excel®

A new feature in Stata 13, putexcel, allows you to easily export matrices, expressions, and stored results to an Excel file. Combining putexcel with a Stata command’s stored results allows you to create the table displayed in your Stata Results window in an Excel file. Let me show you.
A stored result is simply a scalar, macro, or matrix stored in memory after you run a Stata command. The two main types of stored results are e-class (for estimation commands) and r-class (for general commands). You can list a command’s stored results after it has been run by typing ereturn list (for estimation commands) or return list (for general commands). Let’s try a simple example by loading the auto dataset and running correlate on the variables foreign and mpg:
. sysuse auto
(1978 Automobile Data)

. correlate foreign mpg
(obs=74)
foreign mpg
foreign 1.0000
mpg 0.3934 1.0000
Because correlate is not an estimation command, we use return list to see its stored results.
. return list

scalars:
                  r(N) =  74
                r(rho) =  .3933974152205484

matrices:
                  r(C) :  2 x 2
Now we can use putexcel to export these results to Excel. The basic syntax of putexcel is
putexcel excel_cell=(expression) ... using filename [, options]
If you are working with matrices, the syntax is
putexcel excel_cell=matrix(expression) ... using filename [, options]
It is easy to build the above syntax in the putexcel dialog. We have a helpful video on our YouTube channel about the dialog. Let's list the matrix r(C) to see what it contains.
. matrix list r(C)

symmetric r(C)[2,2]
           foreign        mpg
foreign          1
    mpg  .39339742          1
To re-create the table in Excel, we need to export the matrix r(C) with the matrix row and column names. In your Stata Command window, type
. putexcel A1=matrix(r(C), names) using corr
To export the matrix row and column names, we used the names option after we specifed the matrix r(C). When we open the file corr.xlsx in Excel, the table below is displayed.

Next let’s try a more involved example. Reload the auto dataset, and run a tabulation on the variable foreign. Because tabulate is not an estimation command, we use return list to see its stored results.
. sysuse auto
(1978 Automobile Data)

. tabulate foreign
Car type Freq. Percent Cum.
Domestic 52 70.27 70.27
Foreign 22 29.73 100.00
Total 74 100.00
. return list scalars: r(N) = 74 r(r) = 2
tabulate is different from most commands in Stata: it does not automatically save all the results we need into the stored results. We need to use the matcell() and matrow() options of tabulate to save its results into two Stata matrices.
. tabulate foreign, matcell(freq) matrow(names)
Car type Freq. Percent Cum.
Domestic 52 70.27 70.27
Foreign 22 29.73 100.00
Total 74 100.00
. matrix list freq freq[2,1] c1 r1 52 r2 22 . matrix list names names[2,1] c1 r1 0 r2 1
The putexcel commands below create a basic tabulation table in Excel.
. putexcel A1=("Car type") B1=("Freq.") C1=("Percent") using results, replace
. putexcel A2=matrix(names) B2=matrix(freq) C2=matrix(freq/r(N)) using results, modify
Here is the resulting Excel table:

You probably noticed that this table does not include cumulative percentages or the total number of cars. Moreover, our “Car type” column contains the numeric values of the foreign variable rather than the value labels Domestic and Foreign.
With a bit of programming, you can overcome these limitations. On the Stata Blog, I have posted a short do-file that exports the table by tabulate exactly as it appears in the Stata Results Window. With that program, we get this Excel spreadsheet:

In the blog post, I also provide a simple command that combines tabulate and putexcel into one handy command. I explain how to use putexcel to format the exported Excel tables in another blog post. You can also learn how to quickly export estimation results here.
—Kevin Crow
Senior Software Developer