2013-04-29 147 views
0

这是关于Stata中的用户命令Concindexi,其用于计算concentration index。有关Concindexi的定义和详细信息对于回答以下问题不是必需的。Stata中的用户命令concindexi中的输出矩阵

为了解释这个问题,我使用Stata库中的自动数据(这个函数不是为了这种类型的数据,而是用于家庭数据)。

以下是语法:

concindexi [varlist] [if] [in] [weight] [ , welfarevar(varname) format(format) 
    curve convenient clean } 

我使用的weightrank作为welfare variable

sysuse auto 
egen weightrank=rank(weight) 
sort weightrank 

price浓度指数被给定为

concindexi price, welfarevar(weightrank) 

输出(迄今没问题)

Concentration index estimation using the covariance/formula method 

Final matrice of Concentration Indices on Individual (Micro) Data. 

      CIF  CISEF 
price .14318137 .02934612 


CIF : Concentration index using formula/covariance method 
CIC : Concentration index using convenient regression method 
CISEF : Standard errors of the concentration index using formula/covariance method 
CISEC : Standard errors of the concentration index convenient regression method 

这里的问题是:如果我重复使用相同的命令相同的变量price(无需重新启动Stata),它现在将给予2 * 2的矩阵(结果得到累积)。

concindexi price, welfarevar(weightrank) 

输出:

Concentration index estimation using the covariance/formula method 



Final matrice of Concentration Indices on Individual (Micro) Data. 


      CIF  CISEF 
price .14318137 .02934612 
price .14318137 .02934612 


CIF : Concentration index using formula/covariance method 
CIC : Concentration index using convenient regression method 
CISEF : Standard errors of the concentration index using formula/covariance method 
CISEC : Standard errors of the concentration index convenient regression method 

如果我再次重复同样的命令,我有3×2矩阵。

concindexi price, welfarevar(weightrank) 

Concentration index estimation using the covariance/formula method 



Final matrice of Concentration Indices on Individual (Micro) Data. 


      CIF  CISEF 
price .14318137 .02934612 
price .14318137 .02934612 
price .14318137 .02934612 


CIF : Concentration index using formula/covariance method 
CIC : Concentration index using convenient regression method 
CISEF : Standard errors of the concentration index using formula/covariance method 
CISEC : Standard errors of the concentration index convenient regression method 

通常情况下,我们预计1×2矩阵不论多少次执行该命令而在Stata同一会话[就拿命令regress。但是,如果我们每次重新启动Stata,问题就会消失。

这个问题对于这里提到的例子并不严重。但是,如果变量的数量很大(它可以容纳大的变量)和/或如果我必须引导,问题就会变得非常严重。例如,在我有13个变量和20000个观测值的数据中,[bootstrapping]中的复制可能只有29次,但对于2个变量,对应的数字是100.任何解决此问题的想法都将得到高度赞赏。

回答

2

concindexi是SSC提供的用户编写的命令(非功能)。

在Stata中,命令和功能非常独特。

在Stata的讨论中,指出命令来自何处是有帮助的;这对于Statalist来说肯定是强有力的建议(见http://www.stata.com/support/faqs/resources/statalist-faq/),这似乎是对其他论坛的公平要求。

解决方案已记录在案。有一个选项cleanconcindexi,它删除以前由程序创建的矩阵和标量。据推测,作者建立在结果积累上是他(可能还有他的用户)想要的一个特征。作为一种Stata编程风格,这是不寻常的行为。我们可以讨论它是多么好的风格,但作为提供覆盖它的一种方式,这归结于个人的品味。显然你对这种行为感到惊讶,我也会这么做,因为它只是通过clean选项间接记录。

严格来说,“关于concindexi的定义和细节对于回答问题来说并不是必需的”,这是相当不正确的。答案取决于寻找代码并阅读它的文档,这种行为不会引发Stata问题。

+0

@ Nick:我同意你的意见。非常感谢! – Metrics 2013-04-29 16:02:58

+0

@ Nick:我用'question'中的命令替换了函数。 – Metrics 2013-04-29 16:04:41

+0

感谢您的修复。 – 2013-04-29 16:06:46