全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
1599 1
2019-10-20
stata中xttest xttest1 xttest2 xttest3这几个命令是可用的,可以用来做什么,使用时需要注意什么
二维码

扫码加我 拉你入群

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

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

全部回复
2020-3-31 14:06:43
Title

    [XT] xtreg postestimation -- Postestimation tools for xtreg


Description

    The following postestimation commands are of special interest after
    xtreg:

    command        description
    -------------------------------------------------------------------------
    xttest0        Breusch and Pagan LM test for random effects
    -------------------------------------------------------------------------

    The following standard postestimation commands are also available:

    command          description
    -------------------------------------------------------------------------
    (1) estat        AIC, BIC, VCE, and estimation sample summary
        estimates    cataloging estimation results
        hausman      Hausman's specification test
        lincom       point estimates, standard errors, testing, and inference
                       for linear combinations of coefficients
        lrtest       likelihood-ratio test
        margins      marginal means, predictive margins, marginal effects,
                       and average marginal effects
        nlcom        point estimates, standard errors, testing, and inference
                       for nonlinear combinations of coefficients
        predict      predictions, residuals, influence statistics, and other
                       diagnostic measures
        predictnl    point estimates, standard errors, testing, and inference
                       for generalized predictions
        test         Wald tests of simple and composite linear hypotheses
        testnl       Wald tests of nonlinear hypotheses
    -------------------------------------------------------------------------
    (1) estat ic is not appropriate with xtreg, be, xtreg, pa, or xtreg, re.


Special-interest postestimation commands

    xttest0, for use after xtreg, re, presents the Breusch and Pagan Lagrange
    multiplier test for random effects, a test that Var(v_i)=0.


Syntax for predict

    For all but the population-averaged model

        predict [type] newvar [if] [in] [, statistic nooffset]


    Population-averaged model

        predict [type] newvar [if] [in] [, PA_statistic nooffset]


    statistic      description
    -------------------------------------------------------------------------
    Main
      xb           xb, fitted values; the default
      stdp         calculate standard error of the fitted values
      ue           u_i + e_it, the combined residual
    * xbu          xb + u_i, prediction including effect
    * u            u_i, the fixed- or random-error component
    * e            e_it, the overall error component
    -------------------------------------------------------------------------
    Unstarred statistics are available both in and out of sample; type
      predict ... if e(sample) ... if wanted only for the estimation sample.
      Starred statistics are calculated only for the estimation sample, even
      when if e(sample) is not specified.

    PA_statistic   description
    -------------------------------------------------------------------------
    Main
      mu           probability of depvar; considers the offset()
      rate         probability of depvar
      xb           calculate linear prediction
      stdp         calculate standard error of the linear prediction
      score        first derivative of the log likelihood with respect to xb
    -------------------------------------------------------------------------
    These statistics are available both in and out of sample; type predict
      ... if e(sample) ... if wanted only for the estimation sample.


Menu

    Statistics > Postestimation > Predictions, residuals, etc.


Options for predict

        +------+
    ----+ Main +-------------------------------------------------------------

    xb calculates the linear prediction, that is, a + bx_it.  This is the
        default for all except the population-averaged model.

    stdp calculates the standard error of the linear prediction.  For the
        fixed-effects model, this excludes the variance due to uncertainty
        about the estimate of u_i.

    mu and rate both calculate the predicted probability of depvar.  mu takes
        into account the offset(), and rate ignores those adjustments.  mu
        and rate are equivalent if you did not specify offset().  mu is the
        default for the population-averaged model.

    ue calculates the prediction of u_it + e_it.

    xbu calculates the prediction of a + bx_it + u_i, the prediction
        including the fixed or random component.

    u calculates the prediction of u_i, the estimated fixed or random effect.

    e calculates the prediction of e_it.

    score calculates the equation-level score.

    nooffset is relevant only if you specified offset(varname) for xtreg.  It
        modifies the calculations made by predict so that they ignore the
        offset variable; the linear prediction is treated as xb rather than
        xb + offset.


Syntax for xttest0

        xttest0


Menu

    Statistics > Longitudinal/panel data > Linear models > Lagrange
        multiplier test for random effects


Examples

    Setup
        . webuse nlswork
        . xtset idcode

    Fit random-effects model
        . xtreg ln_w grade age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure
            c.tenure#c.tenure 2.race not_smsa south, re

    Store random-effects results for later use
        . estimates store random_effects

    Breusch and Pagan Lagrangian multiplier test for random effects
        . xttest0

    Fit fixed-effects model
        . xtreg ln_w grade age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure
            c.tenure#c.tenure 2.race not_smsa south, fe

    Hausman specification test
        . hausman . random_effects

   

   

Title

    xttest1 -- Specification tests for linear panel-data models


Syntax

        xttest1 [, unadjusted]

    xttest1 is for use after xtreg, re; see [XT] xtreg.
    You must tsset your data before using xttest1; see [TS] tsset.


Description

    xttest1 offers several specification tests for error-component models. It
    includes the Breusch and Pagan (1980) Lagrange multiplier test for random
    effects; the Baltagi-Li (1995) test for first-order serial correlation;
    the Baltagi-Li (1991) joint test for serial correlation and random
    effects; and the family of robust tests in Bera, Sosa-Escudero, and Yoon
    (2001).  xttest1 is an extension of xttest0. The procedure handles
    unbalanced panels as long as there are no "gaps" in the series; that is,
    individual time series may differ in their start and end period but
    cannot have missing values in intermediate periods.

    If you have not read [TS] tsset, please do so now. Consider the
    standard-error component model allowing for possible first-order serial
    correlation:

                y[i,t] = a + B*x[i,t] + u[i] + e[i,t]

                e[i,t] = rho e[i,t-1] + v[i,t]

    Typically, researchers are interested in the hypothesis of no random
    effects (Var(u[i])=0), no serial correlation (rho=0), or both. After
    fitting a balanced random-effects model using xtreg, re, xttest0 produces
    seven specification tests:

        1) LM test for random effects, assuming no serial correlation
        2) Adjusted LM test for random effects, which works even under serial
            correlation
        3) One-sided version of the LM test for random effects
        4) One-sided version of the adjusted LM test for random effects
        5) LM joint test for random effects and serial correlation
        6) LM test for first-order serial correlation, assuming no random
            effects
        7) Adjusted test for first-order serial correlation, which works even
            under random effects

    Tests 1, 2, 6, and 7 have asymptotic chi-squared distribution with one
    degree of freedom under the null hypothesis. Test 5 has asymptotic
    chi-squared distribution with two degrees of freedom under the null
    hypothesis, and tests 3 and 4 have standard normal distribution under the
    null.


Option

    unadjusted shows all -- unadjusted, adjusted, and joint -- test
        statistics.  The default output shows the adjusted and joint test
        statistics.


References

    Baltagi, B. H., and Q. Li. 1991. A joint test for serial correlation and
        random individual effects. Statistics and Probability Letters 11:
        277-280.

    Baltagi, B. H., and Q. Li. 1995. Testing AR (1) against MA (1)
        disturbances in an error component model. Journal of Econometrics 68:
        133-151.

    Bera, A., W. Sosa-Escudero, and M. Yoon. 2001. Tests for the error
        component model in the presence of local misspecification.  Journal
        of Econometrics 101: 1-23.

    Breusch, T., and A. Pagan. 1980. The Lagrange multiplier test and its
        applications to model specification in econometrics.  Review of
        Economic Studies 47: 239-253.


Examples

    . xtreg ln_w grade age* ttl_exp tenure*, re
    . xttest1
    . xttest1, unadjusted


Also see

    Article: Stata Journal, volume 8, number 1: sg164_1
             Stata Technical Bulletin 61: sg164

    Manual:  [XT] xtreg

    Online:  [XT] xtreg

   

   

   

xttest2


xttest2 is for use with cross-section time-series data, following use of
xtreg, fe or xtgls, and requiring prior use of tis or tsset.


Description
-----------

xttest2 calculates the Breusch-Pagan statistic for cross-sectional
independence in the residuals of a fixed effect regression model, following
Greene (2000, 601). xtreg, fe estimates this model assuming independence
of the errors. A likely deviation from independent errors in the context of
pooled cross-section time-series data (or panel data) is likely to be
contemporaneous correlations across cross-sectional units. These correlations
are those exploited by Zellner's seemingly unrelated regression (SUR)
estimator, and this test is provided by sureg, corr in that context.
xttest2 tests the hypothesis that the residual correlation matrix, computed
over observations common to all cross-sectional units, is an identity matrix
of order N_g, where N_g is the number of cross-sectional units. The resulting
test statistic is distributed Chi-squared(d), where d=N_g * (N_g - 1) /2,
under the null hypothesis of cross-sectional independence.

In the context of an unbalanced panel, the observations used to calculate
the test statistic are those available for all cross-sectional units. The
number of available observations is reported, as is the estimated correlation
matrix of the residuals over cross-sectional units.

Since this routine makes use of Stata's matrix language, it cannot compute
the test if the number of panels in the data exceeds the current matsize
(help matsize).

The test statistic, degrees of freedom and number of available observations
are placed in the return array.

Note that this Breusch-Pagan test is not that commonly employed to test for
heteroskedasticity.


Example
-------

        . use http://fmwww.bc.edu/ec-p/data/greene2000/tbl15-1.dta,clear

        . tsset firm year
      
        . xtreg i f c,fe
      
        . xttest2
               
        . xtgls i f c, p(h)
      
        . xttest2







  xttest3


xttest3 is for use with cross-section time-series data, following use of
xtreg, fe or xtgls.


Description
-----------

xttest3 calculates a modified Wald statistic for groupwise heteroskedasticity
in the residuals of a fixed effect regression model, following Greene
(2000, p. 598). xtreg, fe estimates this model assuming homoskedasticity.
The most likely deviation from homoskedastic errors in the context of pooled
cross-section time-series data (or panel data) is likely to be error variances
specific to the cross-sectional unit. xttest3 tests the hypothesis that
sigma^2(i)==sigma for i=1,N_g, where N_g is the number of cross-sectional
units. The resulting test statistic is distributed Chi-squared(N_g) under the
null hypothesis of homoskedasticity.

Greene's discussion of Lagrange multiplier, likelihood ratio and standard Wald
test statistics points out that these statistics are sensitive to the
assumption of normality of the errors. The modified Wald statistic computed
here is workable when the assumption of normality is violated, at least in
asymptotic terms. In terms of small sample properties, simulations of the test
statistic have shown that its power is very low in the context of fixed effects
>
with "large N, small T" panels. In that circumstance, the test should be used
with caution.

One modification to Greene's formulae has been applied to allow for unbalanced
panels (in which T(i), the number of observations per cross-sectional unit, is
not constant across units). All sums are computed over the actual T(i)
for the cross-sectional unit.

The test statistic, degrees of freedom and p-value are placed in the return
array.


Example
-------

        . use http://fmwww.bc.edu/ec-p/data/greene2000/tbl15-1.dta,clear

        . iis firm
      
        . xtreg i f c if firm!=2,fe
      
        . xttest3
      
        . xtgls i f c if firm!=2, p(h)
      
        . xttest3

二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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