[关闭]
@fanxy 2016-09-19T20:20:14.000000Z 字数 8321 阅读 1783

第三讲 财税体制改革与“营改增”

樊潇彦 复旦大学经济学院 中级宏观


  1. # 准备工作
  2. install.packages("readxl") # 读取excel数据
  3. install.packages("stringr") # 处理字符串
  4. install.packages("corrplot") # 作相关关系图
  5. install.packages("igraph") # 作网络图
  6. install.packages("forecast") # 作季节调整
  7. library(readxl) # 读取excel数据
  8. library(stringr) # 字符串处理
  9. library(corrplot)
  10. library(igraph)
  11. library(forecast)
  12. library(stats) # 基础包,不用安装直接调用
  13. library(dplyr)
  14. library(tidyr)
  15. library(data.table)
  16. library(foreign)
  17. library(readstata13)
  18. library(haven)
  19. library(ggplot2)
  20. library(ggrepel)
  21. library(dygraphs)
  22. library(plotrix)
  23. library(lubridate)
  24. library(zoo)
  25. library(mFilter)
  26. setwd("D:\\...") # 设定工作目录
  27. rm(list=ls())

1. 财政发展与变迁

  1. total=read_excel("Ch03_Data.xls",sheet="total", skip=1,
  2. col_names=T,col_types=c("date",rep("numeric",4)))
  3. gdp=read_excel("../Ch02/Ch02_Data.xlsx",col_names=T,sheet="gdp_idx")
  4. gdp=gdp%>%filter(!is.na(year))%>%select(year,GDP)
  5. tax_str=total%>%
  6. mutate(year=year(`指标名称`))%>%
  7. left_join(gdp,by="year")%>%
  8. mutate(`国家财政收入/GDP`=`国家财政收入`/GDP)%>%
  9. mutate(`国家财政赤字/GDP`=(`国家财政收入`-`国家财政支出`)/GDP)%>%
  10. select(year,`国家财政收入/GDP`,`国家财政赤字/GDP`,`中央财政收入:占比`,`中央财政支出:占比`)%>%
  11. arrange(year)%>%
  12. gather(var,share,-year)%>%
  13. filter(!is.na(share))
  14. ggplot(tax_str[tax_str$var %in% c("国家财政收入/GDP","国家财政赤字/GDP"),],
  15. aes(year,share,color=var))+geom_line(size=1)+
  16. geom_vline(xintercept=1958,linetype = "dotdash",col="black")+
  17. geom_vline(xintercept=1978,linetype = "dotdash",col="black")+
  18. geom_vline(xintercept=1984,linetype = "dotdash",col="black")+
  19. geom_vline(xintercept=1994,linetype = "dotdash",col="red")+
  20. labs(title="国家财政收入与赤字占GDP的比重",x="",y="")+
  21. scale_x_continuous(breaks = c(1952, 1958, 1978, 1984, 1994, 2015))+
  22. guides(color = guide_legend(title = NULL)) +
  23. theme_bw()+ theme(legend.position = 'bottom')
  24. ggplot(tax_str[tax_str$var %in% c("中央财政收入:占比","中央财政支出:占比"),],
  25. aes(year,share,color=var))+geom_line(size=1)+
  26. geom_vline(xintercept=1958,linetype = "dotdash",col="black")+
  27. geom_vline(xintercept=1978,linetype = "dotdash",col="black")+
  28. geom_vline(xintercept=1984,linetype = "dotdash",col="black")+
  29. geom_vline(xintercept=1994,linetype = "dotdash",col="red")+
  30. labs(title="中央财政收入和支出占比(%)",x="",y="")+
  31. scale_x_continuous(breaks = c(1952, 1958, 1978, 1984, 1994, 2015))+
  32. guides(color = guide_legend(title = NULL)) +
  33. theme_bw()+ theme(legend.position = 'bottom')

2. 各级财政税收收入占比

  1. class=read_excel("Ch03_Data.xls",sheet="class",
  2. col_names=T,col_types=c(rep("text",2),rep("numeric",66)))
  3. colnames(class)=c("varid","var",1950:2015)
  4. class_var=class[,c(1,2)]
  5. class=class%>%
  6. select(-varid)%>%
  7. gather(year,value,-var)%>%
  8. filter(!is.na(value))%>%
  9. mutate(year=as.numeric(year))%>%
  10. mutate(level=substr(var,1,2))%>%
  11. mutate(item=sub(".*:","",var))%>%
  12. mutate(var=sub(".*公共财政支出.*","公共财政支出",var))%>%
  13. mutate(var=sub(".*公共财政收入:税收收入.*","公共财政收入:税收",var))%>%
  14. mutate(var=sub(".*公共财政收入:非税收收入.*","公共财政收入:非税收",var))%>%
  15. mutate(item=sub("事务","",item))%>%
  16. mutate(item=sub("医疗卫生与计划生育","医卫计生",item))%>%
  17. mutate(item=sub("社会保障和就业","社保就业",item))%>%
  18. arrange(level, var, item, year)
  19. inc_str=class%>%
  20. filter((var=="公共财政收入:非税收" | var=="公共财政收入:税收") &
  21. item!="合计" & year>=2007)%>%
  22. group_by(year,level, var)%>%
  23. summarise(total_inc=sum(value))%>%
  24. spread(var,total_inc)%>%
  25. mutate(tax_share=`公共财政收入:税收`/(`公共财政收入:税收`+`公共财政收入:非税收`))
  26. ggplot(inc_str,aes(year,tax_share,color=level))+geom_line(size=1)+
  27. labs(title="各级财政税收收入占比",x="",y="")+
  28. guides(color=guide_legend(title=NULL))+
  29. theme_bw()+theme(legend.position="bottom")

3. 各级财政税收收入结构

3.1 分税种

  1. tax_str=class%>%
  2. filter(var=="公共财政收入:税收" & item!="合计" & year %in% c(2010,2015))%>%
  3. group_by(year,level)%>%
  4. mutate(total_inc=sum(value))%>%
  5. mutate(share=value/total_inc)%>%
  6. select(year,level,item, share)%>%
  7. mutate(rk=ifelse(year==2015,n()+1-min_rank(share),0))%>%
  8. group_by(level,item)%>%
  9. mutate(rk=max(rk))%>%
  10. filter(rk<=7 & rk>0)%>%
  11. group_by()%>%
  12. arrange(year,level,rk)
  13. labs=tax_str$item[tax_str$year==2015 & tax_str$level=="全国"]
  14. names(labs)=tax_str$rk[tax_str$year==2015 & tax_str$level=="全国"]
  15. ggplot(tax_str[tax_str$level=="全国",],aes(rk,share,fill=as.factor(year)))+
  16. geom_bar(stat="identity", position = "dodge")+
  17. labs(title="全国财政税收收入结构",x="",y="")+
  18. guides(fill=guide_legend(title=NULL))+
  19. scale_x_continuous(breaks=1:length(labs),labels=labs)+
  20. theme_bw()+theme(legend.position="bottom")
  21. labs=tax_str$item[tax_str$year==2015 & tax_str$level=="地方"]
  22. names(labs)=tax_str$rk[tax_str$year==2015 & tax_str$level=="地方"]
  23. ggplot(tax_str[tax_str$level=="地方",],aes(rk,share,fill=as.factor(year)))+
  24. geom_bar(stat="identity", position = "dodge")+
  25. labs(title="地方财政税收收入结构",x="",y="")+
  26. guides(fill=guide_legend(title=NULL))+
  27. scale_x_continuous(breaks=1:length(labs),labels=labs)+
  28. theme_bw()+theme(legend.position="bottom")
  29. labs=tax_str$item[tax_str$year==2015 & tax_str$level=="中央"]
  30. names(labs)=tax_str$rk[tax_str$year==2015 & tax_str$level=="中央"]
  31. ggplot(tax_str[tax_str$level=="中央",],aes(rk,share,fill=as.factor(year)))+
  32. geom_bar(stat="identity", position = "dodge")+
  33. labs(title="中央财政税收收入结构",x="",y="")+
  34. guides(fill=guide_legend(title=NULL))+
  35. scale_x_continuous(breaks=1:length(labs),labels=labs)+
  36. theme_bw()+theme(legend.position="bottom")

3.2 分行业

  1. ind=read_excel("Ch03_Data.xls",sheet="ind",
  2. col_names=T,col_types=c(rep("text",2),rep("numeric",5)))
  3. colnames(ind)=c("varid","var",2010:2014)
  4. ind_var=ind[,c(1,2)]
  5. ind=ind%>%
  6. mutate(level=sub("税收收入:","",var))%>%
  7. mutate(industry=sub(".*:","",level))%>%
  8. mutate(level=sub(":.*","",level))%>%
  9. mutate(level=ifelse(level==industry,"全国合计",level))%>%
  10. select(-varid,-var)
  11. ind_total=ind%>%
  12. filter(level=="全国合计" &
  13. !industry %in% c("第一产业","第二产业","第三产业"))%>%
  14. select(-level)%>%
  15. gather(year,inc,-industry)%>%
  16. mutate(year=as.numeric(year))%>%
  17. filter(year %in% c(2010,2014))%>%
  18. group_by(year)%>%
  19. mutate(total=sum(inc))%>%
  20. mutate(share=inc/total)%>%
  21. mutate(rk=ifelse(year==2014,n()+1-min_rank(share),0))%>%
  22. group_by(industry)%>%
  23. mutate(rk=max(rk))%>%
  24. filter(rk<=7 & rk>0)%>%
  25. arrange(year,rk)
  26. labs=ind_total$industry[ind_total$year==2014]
  27. names(labs)=ind_total$rk[ind_total$year==2014]
  28. ggplot(ind_total,aes(rk,share,fill=as.factor(year)))+
  29. geom_bar(stat="identity", position = "dodge")+
  30. labs(title="税收收入行业结构",x="",y="")+
  31. guides(fill=guide_legend(title=NULL))+
  32. scale_x_continuous(breaks=1:length(labs),labels=labs)+
  33. theme_bw()+theme(legend.position="bottom")

3.3 分国地

  1. ind_guo=ind%>%
  2. filter(level=="国家税务局"&
  3. !industry %in% c("第一产业","第二产业","第三产业"))%>%
  4. gather(year,guo,-level,-industry)%>%
  5. mutate(id=paste(industry,year,sep=""))%>%
  6. select(-level)
  7. ind_di=ind%>%
  8. filter(level=="地方税务局"&
  9. !industry %in% c("第一产业","第二产业","第三产业"))%>%
  10. gather(year,di,-level,-industry)%>%
  11. mutate(id=paste(industry,year,sep=""))%>%
  12. select(-level,-industry,-year)
  13. relative=merge(ind_guo,ind_di,by="id")
  14. relative=relative%>%
  15. filter(year %in% c("2010","2014"))%>%
  16. mutate(diff=guo-di)%>%
  17. select(-id,-guo,-di)%>%
  18. spread(year,diff)
  19. ggplot(relative,aes(`2010`,`2014`))+geom_point(size=2,color="red")+
  20. geom_text_repel(aes(label=industry))+
  21. labs(title="国家与地方税务局税收收入差额",x="2010年",y="2014年")+theme_bw()

4. 各级财政支出结构

  1. exp_str=class%>%
  2. filter(var=="公共财政支出" & year %in% c(2010,2015))%>%
  3. group_by(year,level)%>%
  4. mutate(total_exp=sum(value))%>%
  5. mutate(share=value/total_exp)%>%
  6. select(year,level,item,share)%>%
  7. mutate(rk=ifelse(year==2015,n()+1-min_rank(share),0))%>%
  8. group_by(level,item)%>%
  9. mutate(rk=max(rk))%>%
  10. filter(rk<=7 & rk>0)%>%
  11. arrange(year,level,rk)
  12. labs=exp_str$item[exp_str$year==2015 & exp_str$level=="全国"]
  13. names(labs)=exp_str$rk[exp_str$year==2015 & exp_str$level=="全国"]
  14. ggplot(exp_str[exp_str$level=="全国",],aes(rk,share,fill=as.factor(year)))+
  15. geom_bar(stat="identity", position = "dodge")+
  16. labs(title="全国财政支出结构",x="",y="")+
  17. guides(fill=guide_legend(title=NULL))+
  18. scale_x_continuous(breaks=1:length(labs),labels=labs)+
  19. theme_bw()+theme(legend.position="bottom")
  20. labs=exp_str$item[exp_str$year==2015 & exp_str$level=="地方"]
  21. names(labs)=exp_str$rk[exp_str$year==2015 & exp_str$level=="地方"]
  22. ggplot(exp_str[exp_str$level=="地方",],aes(rk,share,fill=as.factor(year)))+
  23. geom_bar(stat="identity", position = "dodge")+
  24. labs(title="地方财政支出结构",x="",y="")+
  25. scale_x_continuous(breaks=1:length(labs),labels=labs)+
  26. guides(fill=guide_legend(title=NULL))+
  27. theme_bw()+theme(legend.position="bottom")
  28. labs=exp_str$item[exp_str$year==2015 & exp_str$level=="中央"]
  29. names(labs)=exp_str$rk[exp_str$year==2015 & exp_str$level=="中央"]
  30. ggplot(exp_str[exp_str$level=="中央",],aes(rk,share,fill=as.factor(year)))+
  31. geom_bar(stat="identity", position = "dodge")+
  32. labs(title="中央财政支出结构",x="",y="")+
  33. scale_x_continuous(breaks=1:length(labs),labels=labs)+
  34. guides(fill=guide_legend(title=NULL))+
  35. theme_bw()+theme(legend.position="bottom")

5. 补充阅读

  1. 20130603-中信证券-宏观经济专题:七大服务行业“营改增”受益估算.pdf398.6kB
  2. 20160426-国泰君安-国泰君安供给侧改革专题研究之六十:营改增,降税负,促进服务业发展.pdf704.2kB
  3. 20160510-国联证券-营改增试点专题报告:营改增收官战,谁是大赢家?.pdf1017.7kB
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注