这是金融综合上的一道题目,参考答案给出了一些原因,还列举了一些数据,所以自己就想自己收集一些数据看一下是不是那样的。
本文所有代码的do文件下载:2016年以来人民币贬值分析.do
2016年以来人民币贬值的主要成因有
- 宏观经济走势上行乏力。2015年中国经济增速放缓,增速25年来首次回落7%以下,外贸进出口6年来首次出现双降。汇率作为国民经济发展的反映,可以反映除人民币贬值的压力陡升。
- 中国外汇储备大大减少。2015年我国的外汇储备字1992年以来首次缩水,20多年的高速增长也画上了句号。导致外汇储备减少的原因大致如下:首先,中国对外直接投资增加,2015年来首次突破万亿美元的大关;其次,国际套利资金在美国加息预期以及对中国经济看空双重压力下外逃;再次,2015年中国境外旅游规模第一次超过亿万人次,达到1.07亿人次,中国境外的消费规模在扩大;最后,国内民众因各种原因(如境外求学、资产保值增值等)在国外购置房屋投资等导致各种资金外流。对外投资及消费的增加,对外汇需求上升,这必然会从人民币汇率上反映出来。
- 中美利差收窄。自2015年下半年后,对美国加息因美国率先从次贷危机中恢复而甚嚣尘上。中国民众在此心理的作用下,甚至排队购汇,赚取汇率差价。
- 流动性过剩对人民币贬值有压力。自2008年来我国的货币供应量不断扩大,M2总量从2008年的47万亿增至130万亿,M2/GDP的倍率从1.5倍升至1.9倍,货币供应量持续高于GDP的增长导致资金外流。
- 外贸出口疲软。外贸出口曾经是我国一段时间经济发展中的最重要的推动力之一。但美国次贷危机之后的几年,主要的发达国家(如欧元区)等经济尚处于经济自我结构调整和恢复期,经济复苏缓慢,而我国的出口受外界市场环境的影响很大。另外,随着我国人力资本及经营成本的增加,近几年外资纷纷撤出中国到成本更低的越南、印度等地设厂,我国的出口成本优势丧失,也导致我国的外贸持续步入增长乏力阶段。
GDP&GDP增速
获取数据
首先安装我昨天新更新的R包messyr
:
1
| devtools::install_github("czxa/messyr")
|
然后回到Stata,运行下面的命令即可调用messyr包的get_gdp()函数然后把数据返回给Stata:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| clear all rcall: setwd("~/Desktop"); library(messyr); df <- get_gdp(); write.table(df, file = "GDP.csv", sep = ',', row.name = F) import delimited "~/Desktop/GDP.csv", encoding(utf8) clear varn(1) erase GDP.csv save GDP_temp, replace
use GDP_temp, clear keep if index(数据日期, "一至四季度") replace 数据日期 = subinstr(数据日期, "年一至四季度", "", .) replace gdp绝对额 = subinstr(gdp绝对额, ",", "", .) replace gdp同比增减 = subinstr(gdp同比增减, "%", "", .) replace 第一产业gdp绝对额 = subinstr(第一产业gdp绝对额, ",", "", .) replace 第一产业gdp同比增减 = subinstr(第一产业gdp同比增减, "%", "", .) replace 第二产业gdp绝对额 = subinstr(第二产业gdp绝对额, ",", "", .) replace 第二产业gdp同比增减 = subinstr(第二产业gdp同比增减, "%", "", .) replace 第三产业gdp绝对额 = subinstr(第三产业gdp绝对额, ",", "", .) replace 第三产业gdp同比增减 = subinstr(第三产业gdp同比增减, "%", "", .) destring, replace force save GDP, replace
|
虽然这个函数里面设置了直接保存的功能,但是那样保存的csv文件中的中文是乱码的,所以我还是单独运行了保存为csv文件的命令。
绘制年度GDP的走势图
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| use GDP, clear replace gdp绝对额 = gdp绝对额 / 10000 ren gdp绝对额 gdp ren 数据日期 date ren gdp同比增减 gdprate tw line gdp date, xti(年份) yti(GDP绝对额(亿元人民币)) xla(1952(5)2020) yla(0(10)90) xline(2017) yline(82.71217) || pcarrowi 65 2000 82.7 2017, leg(off) lc(red*0.8) lw(*2) mlw(*2) mfc(red*0.8) mc(red*0.8) text(60 1997 "2017年GDP总额为""82.71万亿(RMB)") gre gdptrend
|

GDP同比增速的走势图
1 2 3 4 5 6 7 8 9 10 11 12 13
| tw line gdprate date if date >= 1990, xti(年份) yti(GDP同比增速(%)) xla(1990(5)2020) yla(3(2)15) xline(1991) yline(7.0) || scatteri 6.9 2015, m(D) mc(red*0.8) ||, text(5 1993 "1991年""9.2%") leg(off)|| pcarrowi 11 2015 7 2015, leg(off) lc(red*0.8) lw(*1.5) mlw(*1.2) mfc(red*0.8) mc(red*0.8) text(12 2015 "2015年GDP增速为6.9%""自1991年以来首次低于7%") gre gdpratetrend
|

外贸进出口变化
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| clear all rcall: setwd("~/Desktop"); library(messyr); df <- get_custom(); write.table(df, file = "custom.csv", sep = ',', row.name = F) import delimited "~/Desktop/custom.csv", encoding(utf8) clear varn(1) erase custom.csv save custom_temp, replace
use custom_temp, clear replace 当月进口额总金额 = subinstr(当月进口额总金额, ",", "", .) replace 当月进口额同比增长 = subinstr(当月进口额同比增长, "%", "", .) replace 当月出口额总金额 = subinstr(当月出口额总金额, ",", "", .) replace 当月出口额同比增长 = subinstr(当月出口额同比增长, "%", "", .) replace 累计进口额总金额 = subinstr(累计进口额总金额, ",", "", .) replace 累计进口额同比增长 = subinstr(累计进口额同比增长, "%", "", .) replace 累计出口额总金额 = subinstr(累计出口额总金额, ",", "", .) replace 累计出口额同比增长 = subinstr(累计出口额同比增长, "%", "", .) gen date = date(数据日期, "YM") drop 数据日期 order date destring, replace force format date %tdCY-N gen year = year(date) order year bysort year: egen import = total(当月进口额总金额) bysort year: egen export = total(当月出口额总金额) keep year import export duplicates drop year, force tw line import export year if year < 2018, xla(2001(3)2017) xline(2009) xti("年份") yti(进口总额和出口总额) || scatteri 16807.9 2015 || scatteri 22824.5 2015 ||, leg(order(1 "进口" 2 "出口")) text(20000 2005 "2015年""进口总额和出口""总额均下降") leg(off)|| pcarrowi 20000 2007 16807.9 2015, leg(off) lc(red*0.8) lw(*1.5) mlw(*1.2) mfc(red*0.8) mc(red*0.8) || pcarrowi 20000 2007 22824.5 2015, leg(off) lc(red*0.8) lw(*1.5) mlw(*1.2) mfc(red*0.8) mc(red*0.8) text(7000 2010 "2009年") gre imex
|

人民币汇率变化
1 2 3 4 5 6 7 8 9
| set fredkey ee68c644abe109ecaadaa3cfcf92ab41, permanently import fred DEXCHUS, clear format daten %tdCY/N/D tw line DEXCHUS daten, xla(#8) yla(0(2)10) xti(日期) yti(人民币汇率) caption("注:美元标价法""上升表示人民币贬值,下降表示人民币贬值") gre exrate
|

外汇储备
1 2 3 4 5 6 7 8 9 10 11 12 13
| import fred TRESEGCNM052N, clear replace TRESEGCNM052N = TRESEGCNM052N/1000000000000 format daten %tdCY/N/D gen temp_date = daten tw line TRESEGCNM052N daten, xla(#8) yla(0(0.5)4.5) xti(日期) yti(中国美元储备(万亿美元)) || pcarrowi 4.0108337 16741 4.0108337 19875, leg(off) lc(red*0.8) lw(*1.5) mlw(*1.2) mfc(red*0.8) mc(red*0.8) text(4 14741 "2014年6月1日达""到最高点4.01万亿") gre dollorreserve
|

境外旅游规模
这个数据我并没有找到,不过我在国泰安数据库找到了居民出境总人次的数据。为了方便使用,我把这个数据存入了我的cuse数据库,文件名为tourism.dta
:
1 2 3 4 5 6
| cuse tourism, clear tw line 国内居民出境总人数 年份 if 年份 > 1993, xla(1993(2)2015) yla(0(3000)15000) yti(国内居民出境总人数(万人次)) gre tourism
|

中美利差趋势
美国的利率选择联邦基金利率自然最好,中国的基础利率根据我之前的课程报告《Shibor VS. 回购利率——中国货币市场基准利率的选择》中的研究,我就选择SHIBOR吧!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| clear all rcall: setwd("~/Desktop"); library(messyr); df <- iborpro("SHIBOR-CNY-1W"); write.table(df, file = "shibor.csv", sep = ',', row.name = F) import delimited "~/Desktop/shibor.csv", encoding(utf8) clear varn(1) erase shibor.csv save shibor_temp, replace gen date = date(日期, "YMD") format date %tdCY-N-D drop 日期 涨跌幅 ren 利率 shibor save shibor, replace
import fred DFF, clear ren daten date format date %tdCY-N-D drop datestr merge 1:1 date using shibor keep if _m == 3 drop _m
tw line shibor DFF date, leg(order(1 "1周SHIBOR" 2 "联邦基金利率") pos(2) ring(0)) xti(日期) yti(利率%) yla(0(2)14) gre shiborvsDFF
|

M2走势及增速
M2走势
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| clear all rcall: setwd("~/Desktop");library(messyr); df <- get_money(); write.table(df, file = "money.csv", sep = ',', row.name = F) import delimited "~/Desktop/money.csv", encoding(utf8) clear varn(1) erase money.csv gen date = date(数据日期, "YM") keep date m2数量 m2同比 m2环比 replace m2数量 = subinstr(m2数量, ",", "", .) replace m2环比 = subinstr(m2环比, "%", "", .) replace m2同比 = subinstr(m2同比, "%", "", .) destring, replace force format date %tdCY-N order date gen date_temp = date replace m2数量 = m2数量/10000 tw line m2数量 date if date > 13118, xti("月份") yti("M2数量(万亿)") || pcarrowi 100 16437 47.51666 17867, leg(off) lc(red*0.8) lw(*1.5) mlw(*1.2) mfc(red*0.8) mc(red*0.8) text(120 15837 "2008年12月""M2总量为47.5万亿") || pcarrowi 170 18167 139.2278 20423, leg(off) lc(red*0.8) lw(*1.5) mlw(*1.2) mfc(red*0.8) mc(red*0.8) text(180 17167 "2015年12月""M2总量为139.2万亿") || pci 47.51666 17867 47.51666 21867, lp(dash) lc(black)|| pci 139.2278 20423 139.2278 21867, lp(dash) lc(black)|| pcarrowi 47.51666 21467 80 21467, lp(solid) lc(black) mc(black)|| pcarrowi 139.2278 21467 105 21467, lp(solid) lc(black) mc(black)||, text(95 21067 "6年间M2增加193%!") gre m2
|

M2环比增速
1 2 3 4 5 6 7 8
| tw line m2同比 date if date > 13118 || pcarrowi 29.74 16202 29.74 18202, leg(off) lc(red*0.8) lw(*1.5) mlw(*1.2) mfc(red*0.8) mc(red*0.8) text(29.74 15202 "2009年11月""M2环比增速为29.74%") ||, xti(月份) yti(M2环比增速(%)) gre m2rate
|

M2/GDP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| gen month = month(date) keep if month == 12 replace date = year(date) format date %6.0f keep date m2数量 save m2, replace use GDP, clear ren 数据日期 date keep date gdp绝对额 replace gdp绝对额 = gdp绝对额 / 10000 merge 1:1 date using m2 keep if _m == 3 drop _m drop if m2 == . gen m2gdprate = m2/gdp tw line m2gdprate date, xti(年份) yti(M2/GDP) xla(1990(3)2017) yla(0.8(0.2)2.2, format(%6.1f)) || pcarrowi 1.2 2005 1.513051 2008, leg(off) lc(red*0.8) lw(*1.5) mlw(*1.2) mfc(red*0.8) mc(red*0.8) text(1.1 2003 "2008年M2/GDP""倍率为1.51") || pcarrowi 2.027234 2005 2.027234 2017, leg(off) lc(red*0.8) lw(*1.5) mlw(*1.2) mfc(red*0.8) mc(red*0.8) text(2.027234 2003 "2017年M2/GDP""倍率为2.02") gre m2gdprate
|

看到这个图让我觉得很困惑,2008年的1.51实际上是低于历史趋势的,而2017年的2.02算是基本符合历史趋势,那么到底什么比值才是货币超发,还是说国家一直在超发货币?
外商直接投资
1 2 3 4 5 6 7 8 9 10 11 12 13
| clear all rcall: setwd("~/Desktop");library(messyr); df <- get_fdi(); write.table(df, file = "fdi.csv", sep = ',', row.name = F) import delimited "~/Desktop/fdi.csv", encoding(utf8) clear varn(1) erase fdi.csv keep 数据日期 当月实际使用外资亿美元 当月实际使用外资同比增减 gen date = date(数据日期, "YM") gen fdi = subinstr(当月实际使用外资亿美元, ",", "", .) gen fdirate = subinstr(当月实际使用外资同比增减, "%", "", .) keep date fdi fdirate destring, replace force format date %tdCY-N tw line fdi date, xti(月份) yti(当月实际使用外资(亿美元)) gre fdimonth
|

感觉很不明显,下面是同比增速:
1 2
| tw line fdirate date, xti(月份) yti(当月实际使用外资同比增减(%)) gre fdirate
|

同样不明显。
1 2 3 4 5
| gen year = year(date) bysort year: egen fdiyear = total(fdi) duplicates drop year, force tw line fdiyear year, xti(年份) yti(当年实际使用外资(亿美元)) gre fdiyear
|

299个城市的职工平均薪酬
最后我想用299个城市的职工平均薪酬来反映名义人力成本,数据来自国泰安,为了便于使用,我也将它存入我的cuse数据库,文件名为pjw.dta
:
1 2 3 4 5 6 7 8 9 10 11 12 13
| cuse pjw, c
codebook 城市代码
keep 年度 全部职工年均人数 职工平均工资 bysort 年度标识: egen avgwage = wtmean(职工平均工资), weight(全部职工年均人数) duplicates drop 年度标识, force keep 年度标识 avgwage tw line avgwage 年度标识, xti("年份") yti("299个城市的职工平均工资") gre avgwage
|
