面板数据的双聚类标准错误 [英] Double clustered standard errors for panel data

查看:388
本文介绍了面板数据的双聚类标准错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在R中(时间和横截面)有一个面板数据集,并希望计算由二维聚类的标准误差,因为我的残差在两个方向上都是相关的.我在Google上四处搜寻,发现 http://thetarzan.wordpress. com/2011/06/11/clustered-standard-errors-in-r/提供了执行此操作的功能.似乎是临时的,所以我想知道是否有经过测试的软件包,这可以吗?

I have a panel data set in R (time and cross section) and would like to compute standard errors that are clustered by two dimensions, because my residuals are correlated both ways. Googling around I found http://thetarzan.wordpress.com/2011/06/11/clustered-standard-errors-in-r/ which provides a function to do this. It seems a bit ad-hoc so I wanted to know if there is a package that has been tested and does this?

我知道sandwich确实会发生HAC标准错误,但不会进行双重聚类(即沿两个维度).

I know sandwich does HAC standard errors, but it doesn't do double clustering (i.e. along two dimensions).

推荐答案

弗兰克·哈雷尔(Frank Harrell)的软件包rms(以前称为Design)具有在群集时经常使用的功能:robcov.

Frank Harrell's package rms (which used to be named Design) has a function that I use often when clustering: robcov.

例如,请参见?robcov的这一部分.

See this part of ?robcov, for example.

cluster: a variable indicating groupings. ‘cluster’ may be any type of
      vector (factor, character, integer).  NAs are not allowed.
      Unique values of ‘cluster’ indicate possibly correlated
      groupings of observations. Note the data used in the fit and
      stored in ‘fit$x’ and ‘fit$y’ may have had observations
      containing missing values deleted. It is assumed that if any
      NAs were removed during the original model fitting, an
      ‘naresid’ function exists to restore NAs so that the rows of
      the score matrix coincide with ‘cluster’. If ‘cluster’ is
      omitted, it defaults to the integers 1,2,...,n to obtain the
      "sandwich" robust covariance matrix estimate.

这篇关于面板数据的双聚类标准错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆