面板数据的双集群标准错误

我在R(时间和横截面)中有一个面板数据集,并且想要计算由两个维度聚类的标准误差,因为我的残差是双向相关的.谷歌搜索我发现 http://thetarzan.wordpress.com/2011/06/11/clustered-standard-errors-in-r/提供了这样做的功能.它似乎有点特别,所以我想知道是否有一个已经过测试的包并且这样做了吗?

我知道三明治会产生HAC标准错误,但它不会进行双重聚类(即沿着两个维度).

Frank Harrell的软件包rms(以前称为Design)具有我在集群时经常使用的功能:robcov.

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

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.
相关文章
相关标签/搜索