Monday, January 30, 2017

Fixed effects vs. cluster-adjusted standard error

Both approaches, using group fixed effects and/or cluster-adjusted standard error, take into account different issues related to clustered (or panel) data. They are distinct approaches, but often you want to use both of them.

First of all, cluster-adjusted standard errors account for within-cluster correlation or heteroscedasticity which the fixed-effects estimator does not take into account unless you are willing to make further assumptions. If you do not want to model the variance-covariance matrix and you suspect that within-cluster correlation is present, I advise using clustered robust standard error because the bias in your SE may be severe (much more problematic than for heteroscedasticity). But you need enough cluster (Angrist and Pischke say 40-50 as a role of thumb). Cluster-adjusted standard errors take into account standard error but leave your point estimates unchanged (standard errors will usually go up)!

Fixed-effects estimation takes into account unobserved time-invariant heterogeneity. This can be good or bad: On the hand, you need fewer assumptions to get consistent estimations. On the other hand, you throw away a lot of variances which might be useful. Some people like Andrew Gelman prefer hierarchical modeling to fixed effects but here opinions differ. Fixed-effects estimation will change both, point and interval estimates (also here standard error will usually be higher).

To sum up: Cluster-robust standard errors are an easy way to account for possible issues related to clustered data if you do not want to bother with modeling inter- and intra-cluster correlation (and there are enough clusters available). Fixed-effects estimation will take use only certain variation, so it depends on your model whether you want to make estimates based on less variation or not. But without further assumptions, fixed-effects estimation will not take care of the problems related to intra-cluster correlation for the variance matrix. Neither will cluster-robust standard error take into account problems related to the use of fixed-effects estimation.

Monday, January 23, 2017

雾霾红色警报!中国现在的空气质量到底有多差?




北京空气红色预警了!2015年12月8日早7时持续到12月10号正午12时,北京启动了建立空气质量检测红橙黄蓝四种颜色预警制度以来首次红色预警;紧接着在12月19日7时至22日24时启动了第二次。2016年12月16日,北京再次迎来了红色预警。


近年来,空气质量几乎成了一个全民关心的一个话题,网上传播的文章也越来越多。大部分人感觉空气一年不如一年。那么我们是不是应该尽量减少室外活动,呆在家里降低新陈代谢做个乖宝宝呢?拿着美国使馆的PM2.5数据,我们来详细分析一下近年来北京及其他城市空气质量的走势。

所感并不一定等于事实。

近年来,北京以及其他中国城市的空气质量是在逐渐好转的。之前已经有文章分析美国使馆的PM2.5数据得出类似的结论。但是为什么北京接二连三的启动红色警报,而好多人深切地体会到了空气质量的恶化呢?本文的目的在于比较详尽的从多角度分析空气质量数据,让读者对空气质量的走势有一个更全面的认识,并分析一下为什么我们感觉雾霾一直在加重。

1 美国大使馆PM2.5数据

PM2.5是是大气当中直径小于2.5微米的悬浮物小到只能通过显微镜才能看到,并且不仅能够进入人的肺,还有可能通过循环进入人的血液。在北京以及中国大部分城市,PM2.5是最重要的污染物。下面的两个表展示了美国所定义的空气质量指数(Air Quality Index, AQI) 及对应的污染物浓度指数。

美国空气质量指数及对应的污染物浓度表

为了更直观的表现数据,在下面图当中,我们将PM2.5密度值按照空气质量的分级表为不同的颜色。下面的图中把PM2.5的密度按照相应的空气质量指数(AQI)用好到坏分别标为绿色、黄色,橙色,红色,紫色,枣红色,和黑色。红色以上已经会影响正常人的身体健康。

空气质量分级


在中国观测PM2.5,确实是美国人先行的。有人说是美国驻华大使骆家辉推动了美国使馆监测和公布PM2.5数据,其实远在骆家辉上任之前的2008年,监测就开始了。记得刚开始公布数据时还有阴谋论的说法,和当时的国际好运会运动员抵京是戴着口罩一起论事,说外国人就是怕死事儿多,更有人说帝国主义亡我之心不死,整天在中国挑事。其实,人家美使馆一开始监测只是因为美国的外事人员补贴是和派遣到的地区的生活环境相关联的,不过是为了多赚几美刀的补贴而已。当然,中国马上开始意识到PM10已经不能完全衡量空气适量,于是马上跟进了PM2.5的监测并且制定并实施了监测标准。

美国大使馆公布的PM2.5数据是在使馆区内测量的数据。北京的数据从2008年4月8日起至今,但是2008年11月中旬到和2009年2月中旬没有记录 (可能由于使馆放假的缘故?)。其他领事馆也相继开始记录并公布PM2.5数据:广州从2011年11月21日起;上海从 2011年12月28日起; 成都从2012年5月14日起;沈阳从2013年4月22日起。这些全部是公开的,可以在stateair.net查看和下载相应的csv文件。到此文章发布为止,大使馆和各领事馆2016年12月的数据还没有公布,所以下面的分析没有包括2016年12月的数据。 根据以往经验,当月数据要等到1个多月之后才会整理公布。


美国使馆PM2.5监测数据下载(文末有下载链接)

从2013年开始,美国使馆也开始监测印度各大城市的PM2.5情况。本以为分析一下新德里的数据可以膨胀一下自己对中国的空气质量的信息,但是印度的数据只有PDF格式,而手动转换成csv文件估计要花不止一天的时间——还是多花些时间去发表我的论文,这种闲情逸致的事情就留给各位有识之士来弄吧。


美国使馆印度城市PM2.5监测数据

2 北京各年份空气质量走势

下面的几个自己做的图展示了北京从2008年到2016年的PM2.5走势。观察几幅图,我们能发现几个有趣的现象和趋势。

从图中我们看到,近几年比较大型的国内国际活动召开前后,例如奥运会,大阅兵,APEC等,空气质量会有明显的改善。可以推测,这都是政府花大力气整治而取得的结果。比如大阅兵前后,不止北京,连北京周边地区的城市都采取了停工限号的措施。

这说明如果政府大力整治,空气质量可以马上好转。但是我们在呼吁整体采取相应措施之前要明确意识到这种“整治”是需要代价的,我们不可能一直采取限号限制人们的出行,也不可能让所有的工厂停工工人离职失去稳定的工作。空气质量不好的一个重要原因就是大量的人口往城市聚集,所以不止北京,世界上其他的大城市都有相应的污染。但是正是由于这种人口的聚集是大规模的协作导致的经济增长成为可能,我们要做的并不是要不要经济增长或者要不要环境的这种非黑即白的选择,而是要做出权衡,找到一个平衡点。如果我们认为环境已经恶化影响生活质量,我们当然要在经济发展上做出一些牺牲来换取环境,但是这也并非一蹴而就的事情。











从图中我们也能明显地看到,冬季的空气质量明显要差一些。有多差呢?下图按月份展示了北京从2008年到2016年的空气污染状况。不同的颜色代表了相应空气质量等级的天数在当月的比例。比如绿色代表了空气质量优秀的天数在当月所占比例,而枣红色代表了严重污染的天数在当月所占比例。


从中我们可以看到,PM2.5爆表的严重污染几乎完全出现在10月到3月之间。下图按月份展示了北京从2008年到2016年每月的平均PM2.5密度,从另外一个角度展现了冬季的空气质量相对差一些。这里顺便说一句,有些人提到冬季空气差是由于统一供暖的原因。但是我们发现,在还没有开始统一供暖的10月 (北京从11月中旬开始统一供暖),空气质量已经明显不如9月了,这暗示着气候的变化,而不是统一供暖,是导致冬天空气质量差的主要原因。



如果我们仔细观察对比北京各年的空气质量走势,可以发现,从08年开始,空气质量在恶化,但是从2013年开始,夏天的空气质量开始有好转。尤其是2016年夏天,完全没有出现严重污染的状况,甚至优于2008年夏天。从2014年开始,冬季的污染也开始逐年好转。

下图列出了北京市各年份的平均PM2.5密度。我们看到,自2013年开始,空气质量是明显好转的。

为了能够直观的看出北京逐年的空气污染状况走势,下图按年份展示了北京从2008年到2016年的空气污染等级分布。我们可以看到,自2010年以来,5级以上污染(PM2.5>150)的比例是有下降趋势的。6级以上污染(PM2.5>250)在2014年达到峰值,之后也在减少。这里需要指出的是,2016年的数据当中没有污染相对严重的12月,因此实际情况可能并没有图中展现的那么乐观。但是,即便做最保守的估计将整个12月都设定为5级以上污染,还是能够与2015年基本持平。所以,空气质量好转的趋势是比较明显的。


3 其他城市各年份空气质量走势

下面的图列出了上海、广州、成都和沈阳的空气质量走势图。可以明显地看出广州和上海的空气质量要远远优于成都和沈阳,而成都和沈阳要远远优于北京。当然,我们还是能看到在各个城市,夏天的空气质量要远远优于冬天。



下面几幅图列出了几座城市逐年的空寂污染等级分布。我们也可以直观的看出,在各个城市,空气质量都有逐渐好转的趋势。







4 小结

雾霾治理是一项系统工程,并非政府一声令下就能在明天解决的。政府处理的是一个多目标优化问题。比如上半年政府进行供给侧改革减少煤炭产量,是一项治理污染的重要举措。由于减产,煤炭价格上升。在经济学家看来,供给下降导致价格上升再正常不过,正式减产成功的标志。但是煤炭价格上升会导致各种工业成本上升,很有可能影响GDP的增长,所以下半年政府又放松管制释放产能。我们很可能难以理解这种政策的反复,不过这也正说明,环境的治理需要巨大的决心和魄力,也是有代价的。

从上面的图是我们可以直观地看到,在中国各大城市,空气质量是有所好转的。线性回归分析(有兴趣的专业读者可以参见附录)表明,从图中观察到的空气质量好转是有统计支持的。拿北京来说,非冬季的PM2.5的平均值在2015和2016年甚至要好于2008年,冬季的PM2.5均值在2013年后虽然没有显著降低,在2015年甚至有些提高。同样,2015和2016年非冬季遭受三级以上污染的概率也要明显低于2008年,但是冬季的污染概率没有,与2014年相比,2015年还略有回升。正如环保部陈吉宁所言,空气污染的状况有所好转,只是冬季污染基本无改善。

那么,为什么我们会感觉雾霾在加重呢?主要原因可能是从2015年开始,北京几次启动了之前没有启动过的红色预警。但是可能只是意味着我国的空气质量监测和预警机制在逐渐完善。从上面的图示可以看出,北京空气雾霾最严重的时段出现在2013年一月,但是在2013年1月28日,PM2.5才首次成为气象部门霾预警指标,因此在污染最严重的2013年1月我们并没有启动预警。此外,即便建立了预警机制之后,各个省市不情愿启动红色预警。橙色与红色预警的最大区别在于是否执行最严格的强制措施,包括严格限号,停产,停工,停课等等。红色预警所附带的强制性措施对于城市生活的干扰是显而易见的。一次红警牵涉多个政府职能部门,会明显的增加政府的行政负担。2015年,在环保部出手后,在公众和中央政府的双重压力之下,北京才于2015年12月7日发布了史上第一个空气重污染红色预警。

心理学研究表明,坏事在人们心目当中留下的印象要远远比好事深刻 (Bad is stronger than good)。人们之所以进化出这样的心理机制是因为它能够驱使人们在坏事情发生的时候能够积极主动地做出行动。我们印象当中的雾霾在逐渐严重,很有可能就是最近两年开始发生的红色预警,以及红色预警所带来的限号停产停工停课等等措施让我们深刻感受到了雾霾带来的对我们生活的诸多影响。

所以,我们感受到的雾霾严重,可能只是冬季雾霾的改善不明显,而政府应对雾霾的措施和预警机制在逐渐规范的结果。


相关资源和文章

附录:线性回归分析








依人之洲 ∣ 心境和知识的交流
 微信ID:YiRenTimes  
见闻 · 见识 · 见解

用微信扫描下方二维码添加公众号




转载请注明出处

Wednesday, May 4, 2016

Incomplete vs. Imperfect Information

Incomplete and imperfect information are two important concepts in game theory. They are similar but have quite different meanings.

Under imperfect information, players are simply unaware of the actions chosen by other players. However, they know who the other players are, what their possible strategies/actions are, and the preferences/payoffs of these other players. For example, you may not be able to perfectly observe the actions chosen by the other players (imperfect monitoring), or the implemented actions of other players may be different from their intentions.

Under incomplete information, players may or may not know some information about the other players, e.g. their “type”, their strategies, payoffs etc.

Tuesday, February 23, 2016

Social Distance and Judgment Biases

Judgment biases are consistently observed when people evaluate probabilistic information. Specifically, people usually overrate events that are unlikely to happen, such as winning five million on the lottery, having a child with a genetic disease, or being involved in a traffic accident. Such overrating leads to impulsive purchase of lottery tickets and overinvestment in insurance. The emergence and reduction of these judgment biases needs to be investigated to help people make rational decisions.
Judgment biases become inevitable when decision makers become too attached to certain outcomes (Williams, Stein, & Galguera, 2014). Therefore, such biases can potentially be reduced by increasing the social distance between the decision maker and the beneficiary. Such principle is well recognized in the medical profession. For example, the Ethics Manual of the American College of Physicians prescribes that physicians must avoid treating themselves, close friends, or family members (Snyder, 2012). Similarly, the Code of Medical Ethics of the American Medical Association suggests that physicians must not treat themselves or members of their immediate families because their personal feelings may unduly influence their professional medical judgment, thereby interfering with the care being delivered (American Medical Association, 2014).

In one of my research project, my coauthors and I investigate whether increased social distance can reduce judgment biases. As it turns out, social distance can indeed reduce these biases, because as the social distance increases, people are less stimulated emotionally, making them better utilize available information to make better decisions.

Friday, January 8, 2016

An Anecdote about chess and Napoleon

An escape plan had been hatched whereby a French soldier would bring a chess set to Napoleon. Inside one of the pieces were hidden plans to help him escape. The soldier never made it to St. Helena, dying of a heart attack while the ship was enroute. So Napoleon never found out about the plans, even though he played the chess all the time.

Saturday, November 14, 2015

Error bars and statistical significance: can we infer the statistical significance of the difference by looking at the error bars of two bar graphs?

Look at the following graph showing the averages and the corresponding error bars. Can we conclude whether the difference between the means of the two groups is statistically significant?


Well, the short answer is yes and no. A longer answer is, if the error bars provide the corresponding 95% confidence interval, the values in these two groups are normally distributed, then the difference is statistically significant at a 5% level using an unpaired t-test.

Now the long answer...

If we are really picky about the terms, we can say that statistical significance depends on the significance level you choose. So the answer of course depends on the level of significance.

Let's choose 5% significance level, which is usually assumed when the significance level is not specified..

The answer? Still not definitive -- because error bars can represent different things. Some people simply plot the standard deviation of the sample, others use them to represent standard errors of the mean, and still others put confidence intervals there. Depending on the nature of the error bars, we may or may not be able to infer the statistical significance of the difference of the mean.

Some words on standard deviation, standard error of the mean, and the confidence interval. Standard deviation simply measures the variability of a data set, without considering the sample size. When the sample size is large enough, it is a good estimate of the population standard deviation. However, when we conduct a statistical test, we are usually investigating whether the means are different in the two groups. In that sense, the standard errors of the means are more informative. 

If data are normally distributed, the standard errors are less than the standard deviation $\sigma$ -- indeed, the standard error of the mean SEM = $\sigma / \sqrt{n}$.  Now as shown below, the standard error bars do not overlap, is the difference between group means statistically significant?

It is hard to tell. However, when we have the error bars represent the 95% confidence intervals, then we can conclude that the difference is statistically significant at 5% if the bars don't overlap. BUT, the opposite is not necessarily true---two 95% confidence intervals that overlap may be significantly different at the 95% confidence level.


                         

What we can tell is whether the sample mean is statistically significant from a specific value by checking whether that value is within the confidence interval or not. For example, the sample mean is significantly different from 0 at 5\% level if and only if 0 is not contained in the 95% confidence interval.

The confidence interval is larger than the standard error bar -- $t_{(1+\alpha)/2}$ times the error bar width, where $t_{(1+\alpha)/2}$ represents the $\frac{1+\alpha}{2}$ quantile of a t-distribution. When the sample size is large, its value is approximately 1.96, which is the quantile for a normal distribution.

Therefore, we can easily conclude whether the difference is statistically significant when the error bars represent confidence intervals. If the error bars represent standard errors of the means, however, we can conclude that the difference is not statistically significant if they overlap.

P.S.: The meaning of a 95% confidence interval? Some people understand it as the population mean of the distribution is in the confidence interval with probability 0.95. Well, that is a wrong interpretation. The mean is a fixed value, it is either in that interval or not, and there is no randomness involved. The correct interpretation? Consider drawing the sample with the same size many times, and each time you have a 95% confidence interval. Then 95% of those confidence intervals (one for each sample) will cover the population mean -- in other words, the population mean falls into 95% of those confidence intervals.

P.P.S.: Sample s1 consists of 19 observations drawn from the normal distribution $N(5, 1^1)$, and sample s2 consists of 100 observations drawn from the normal distribution $N(6,2^2)$.

Tuesday, November 10, 2015

Mediator vs. Moderator variables


I have a co-author who is a psychologist. As we are collaborating on a paper, I found myself unclear about some of the terms, not just in psychology, but also in statistical analysis. One example is the concepts of mediator (mediating variable) and moderator (moderating variable).

As an economist, these two terms are foreign to me. But after googling them, they can be easily explained in terms of econometrics.

Psychologists use this concept of mediating variable to refer to the underlying psychological factor ($x_m$) that can explain why some external factor ($x_e$) lead to a change in a dependent variable ($y$).
Consider a regression of the dependent variable y on the independent variable $x_e$. If we add $x_m$ to the regression significantly change the direct effect of $x_e$, then $x_m$ can be considered as a mediating variable.





The concept of moderator variables, on the other hand, is closely related to interaction terms in econometrics. When we find that the effect of x1 on y depends on the value of x2, then we call x2 a moderator variable, and it has a moderating effect on the relationship between x1 and y. Moderators are usually categorical variables. Back to the above example, we find altruism x1 influences bidding behavior, but the effect is more pronounced for females. Then here gender x2 is a moderating variable that influences the relationship between altruism x1 and bidding in an all-auction y.

In a regression model,  the relationships between y, x1, and x2 can be expressed as the following relationship:
    $y = b_0 + b_1 x_1 + b_2 (x_1 \times x_2) + \epsilon$

The moderating effect of x2 is measured by b2.

P.S.: Biddings in all-pay auctions provide a measure of competitiveness. The above example is essentially saying that altruistic people are less likely to be competitive, but the effect is more significant for female. In other words, we can say that men seem to care less about the opponent in a competitive environment. How do we measure people's altruism? You can use a dictator game in the lab.