全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
17893 5
2011-06-10
RT
目前在做一个固定效应的模型,大致是这样的
xtset cnstkcd year
xtreg DV IVs, fe cluster(....)

我想cluster cnstkcd year 两个变量,不知应如何处理。

请高手指点下,谢谢!

P.S. 对于这个模型设定,自己也很不明白,究竟Fixed effect 和cluster是什么意思,什么情况下需要cluster?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2011-6-10 08:39:31
SE/Robust
      vce(vcetype)        vcetype may be conventional, robust, cluster clustvar, bootstrap, or jackknife

一般是用来产生稳健标准误的
常见是这样使用,vce(cluster,id),id是截面识别符
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-6-10 08:40:43
vce(vcetype) specifies the type of standard error reported, which includes types that are derived from asymptotic theory,that are robust to some kinds of misspecification, and that use bootstrap or jackknife methods; see [XT] vce_options.




help xt_vce_options
----------------------------------------------------------------------------------------------------------------------------------

title

    [XT] vce_options -- Variance estimators


Syntax

        estimation_cmd ... [, xt_vce_options ...]

    xt_vce_options                        description
    ----------------------------------------------------------------------------------------------------------------------------
    vce(oim)                              observed information matrix (OIM)
    vce(opg)                              outer product of the gradient (OPG) vectors
    vce(robust)                           Huber/White/sandwich estimator
    vce(cluster clustvar)                 clustered sandwich estimator
    vce(bootstrap [, bootstrap_options])  bootstrap estimation
    vce(jackknife [, jackknife_options])  jackknife estimation

    nmp                                   use divisor N - P instead of the default N
    scale(x2|dev|phi|#)                   override the default scale parameter; available only with population-averaged models
    ----------------------------------------------------------------------------------------------------------------------------


Description

    This entry describes the xt_vce_options, which are common to most xt estimation commands. Not all the options documented
    below work with all xt estimation commands; see the documentation for the particular estimation command.  If an option is
    listed there, it is applicable.

    The vce() option specifies how to estimate the variance-covariance matrix (VCE) corresponding to the parameter estimates.
    The standard errors reported in the table of parameter estimates are the square root of the variances (diagonal elements) of
    the VCE.


Options

        +-----------+
    ----+ SE/Robust +-----------------------------------------------------------------------------------------------------------

    vce(oim) is usually the default for models fit using maximum likelihood.  vce(oim) uses the observed information matrix
        (OIM); see [R] ml.

    vce(opg) uses the sum of the outer product of the gradient (OPG) vectors; see [R] ml.  This is the default VCE when the
        technique(bhhh) option is specified; see [R] maximize.

    vce(robust) uses the robust or sandwich estimator of variance.  This estimator is robust to some types of misspecification
        so long as the observations are independent; see [U] 20.16 Obtaining robust variance estimates.

        If the command allows pweights and you specify them, vce(robust) is implied; see [U] 20.18.3 Sampling weights.

    vce(cluster clustvar) specifies that the standard errors allow for intragroup correlation, relaxing the usual requirement
        that the observations be independent.  That is to say, the observations are independent across groups (clusters) but not
        necessarily within groups.  clustvar specifies to which group each observation belongs, e.g., vce(cluster personid) in
        data with repeated observations on individuals.  vce(cluster clustvar) affects the standard errors and
        variance-covariance matrix of the estimators but not the estimated coefficients; see [U] 20.16 Obtaining robust variance
        estimates.

    vce(bootstrap [, bootstrap_options]) uses a nonparametric bootstrap; see [R] bootstrap.  After estimation with
        vce(bootstrap), see [R] bootstrap postestimation to obtain percentile-based or bias-corrected confidence intervals.

    vce(jackknife [, jackknife_options]) uses the delete-one jackknife; see [R] jackknife.

    nmp specifies that the divisor N-P be used instead of the default N, where N is the total number of observations and P is
        the number of coefficients estimated.

    scale(x2|dev|phi|#) overrides the default scale parameter.  By default, scale(1) is assumed for the discrete distributions
        (binomial, negative binomial, and Poisson), and scale(x2) is assumed for the continuous distributions (gamma, Gaussian,
        and inverse Gaussian).

        scale(x2) specifies that the scale parameter be set to the Pearson chi-squared (or generalized chi-squared) statistic
        divided by the residual degrees of freedom, which is recommended by McCullagh and Nelder as a good general choice for
        continuous distributions.

        scale(dev) sets the scale parameter to the deviance divided by the residual degrees of freedom. This option provides an
        alternative to scale(x2) for continuous distributions and for over- or underdispersed discrete distributions.

        scale(phi) specifies that the scale parameter be estimated from the data.  xtgee's default scaling makes results agree
        with other estimators and has been recommended by McCullagh and Nelder in the context of GLM.  When comparing results
        with calculations made by other software, you may find that the other packages do not offer this feature.  In such
        cases, specifying scale(phi) should match their results.

        scale(#) sets the scale parameter to #. For example, using scale(1) in family(gamma) models results in
        exponential-errors regression (if you use assume independent correlation structure).


Remarks

    When working with panel-data models, we strongly encourage you to use the vce(bootstrap) or vce(jackknife) options instead
    of the corresponding prefix command.  For example, to obtain jackknife standard errors with xtlogit, type

        . webuse clogitid
        . xtlogit y x1 x2, fe vce(jackknife)

    If you wish to specify more options to the bootstrap or jackknife estimation, you can include them within the vce() option.
    Below we refit our model requesting bootstrap standard errors based on 300 replications, we set the random-number seed so
    that our results can be reproduced, and we suppress the display of the replication dots.

        . xtlogit y x1 x2, fe vce(bootstrap, reps(300) seed(123) nodots)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-6-10 22:10:09
3# ywh19860616
谢谢!不过还是不太清楚,VCE(cluster var)时好像没有办法同时cluster两个变量,不知这个应该如何解决
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-7-17 17:20:05
egen newgroup= group( cnstkcd year)
……
xtreg DV IVs, fe cluster(newgroup)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-12-5 07:15:50
right.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群