全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
10491 3
2013-06-07
如题,请问对横截面数据进行GMM回归在stata中如何实现呢?
二维码

扫码加我 拉你入群

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

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

全部回复
2013-6-11 10:46:07
xtabond depvar indepvar, lag(n) twostep vce(robust)
二维码

扫码加我 拉你入群

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

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

2013-6-11 10:54:44

Title

    [R] ivregress -- Single-equation instrumental-variables regression


Syntax

        ivregress estimator depvar [varlist1] (varlist2 = varlist_iv) [if] [in] [weight] [,
              options]


    estimator               Description
    -----------------------------------------------------------------------------------------------
    2sls                    two-stage least squares (2SLS)
    liml                    limited-information maximum likelihood (LIML)
    gmm                     generalized method of moments (GMM)
    -----------------------------------------------------------------------------------------------

    options                 Description
    -----------------------------------------------------------------------------------------------
    Model
      noconstant            suppress constant term
      hascons               has user-supplied constant

  # GMM
      wmatrix(wmtype)       wmtype may be robust, cluster clustvar, hac kernel, or unadjusted
      center                center moments in weight matrix computation
      igmm                  use iterative instead of two-step GMM estimator
    * eps(#)                specify # for parameter convergence criterion; default is eps(1e-6)
    * weps(#)               specify # for weight matrix convergence criterion; default is
                              weps(1e-6)
    * optimization_options  control the optimization process; seldom used

    SE/Robust
      vce(vcetype)          vcetype may be unadjusted, robust, cluster clustvar, bootstrap,
                              jackknife, or hac kernel

    Reporting
      level(#)              set confidence level; default is level(95)
      first                 report first-stage estimates
      small                 make degrees-of-freedom adjustments and report small-sample statistics
      noheader              display only the coefficient table
      depname(depname)      substitute dependent variable name
      eform(string)         report exponentiated coefficients and use string to label them
      display_options       control column formats, row spacing, line width, and display of omitted
                              variables and base and empty cells

      perfect               do not check for collinearity between endogenous regressors and
                              excluded instruments
      coeflegend            display legend instead of statistics
    -----------------------------------------------------------------------------------------------
    # These options may be specified only when gmm is specified.
    * These options may be specified only when igmm is specified.
    varlist1 and varlist_iv may contain factor variables; see fvvarlist.
    depvar, varlist1, varlist2, and varlist_iv may contain time-series operators; see tsvarlist.
    bootstrap, by, jackknife, rolling, statsby, and svy are allowed; see prefix.
    Weights are not allowed with the bootstrap prefix.
    aweights are not allowed with the jackknife prefix.
    hascons, vce(), noheader, depname(), and weights are not allowed with the svy prefix.
    aweights, fweights, iweights, and pweights are allowed; see weight.
    perfect and coeflegend do not appear in the dialog box.
    See [R] ivregress postestimation for features available after estimation.


Menu

    Statistics > Endogenous covariates > Single-equation instrumental-variables regression


Description

    ivregress fits a linear regression of depvar on varlist1 and varlist2, using varlist_iv (along
    with varlist1) as instruments for varlist2.  ivregress supports estimation via two-stage least
    squares (2SLS), limited-information maximum likelihood (LIML), and generalized method of
    moments (GMM).

    In the language of instrumental variables, varlist1 and varlist_iv are the exogenous variables,
    and varlist2 are the endogenous variables.


Options

        +-------+
    ----+ Model +----------------------------------------------------------------------------------

    noconstant; see [R] estimation options.

    hascons indicates that a user-defined constant or its equivalent is specified among the
        independent variables.

        +-----+
    ----+ GMM +------------------------------------------------------------------------------------

    wmatrix(wmtype) specifies the type of weighting matrix to be used in conjunction with the GMM
        estimator.

        Specifying wmatrix(robust) requests a weighting matrix that is optimal when the error term
        is heteroskedastic.  wmatrix(robust) is the default.

        Specifying wmatrix(cluster clustvar) requests a weighting matrix that accounts for
        arbitrary correlation among observations within clusters identified by clustvar.

        Specifying wmatrix(hac kernel #) requests a heteroskedasticity- and
        autocorrelation-consistent (HAC) weighting matrix using the specified kernel (see below)
        with # lags.  The bandwidth of a kernel is equal to the number of lags plus one.

        Specifying wmatrix(hac kernel opt) requests an HAC weighting matrix using the specified
        kernel, and the lag order is selected using Newey and West's (1994) optimal lag-selection
        algorithm.

        Specifying wmatrix(hac kernel) requests an HAC weighting matrix using the specified kernel
        and N-2 lags, where N is the sample size.

        There are three kernels available for HAC weighting matrices, and you may request each one
        by using the name used by statisticians or the name perhaps more familiar to economists:

            bartlett or nwest requests the Bartlett (Newey-West) kernel;

            parzen or gallant requests the Parzen (Gallant 1987) kernel; and

            quadraticspectral or andrews requests the quadratic spectral (Andrews 1991) kernel.

        Specifying wmatrix(unadjusted) requests a weighting matrix that is suitable when the errors
        are homoskedastic.  The GMM estimator with this weighting matrix is equivalent to the 2SLS
        estimator.

    center requests that the sample moments be centered (demeaned) when computing GMM weight
        matrices.  By default, centering is not done.

    igmm requests that the iterative GMM estimator be used instead of the default two-step GMM
        estimator.  Convergence is declared when the relative change in the parameter vector from
        one iteration to the next is less than eps() or the relative change in the weight matrix is
        less than weps().

    eps(#) specifies the convergence criterion for successive parameter estimates when the
        iterative GMM estimator is used.  The default is eps(1e-6).  Convergence is declared when
        the relative difference between successive parameter estimates is less than eps() and the
        relative difference between successive estimates of the weighting matrix is less than
        weps().

    weps(#) specifies the convergence criterion for successive estimates of the weighting matrix
        when the iterative GMM estimator is used.  The default is weps(1e-6).  Convergence is
        declared when the relative difference between successive parameter estimates is less than
        eps() and the relative difference between successive estimates of the weighting matrix is
        less than weps().

    optimization_options: iterate(), nolog.  iterate() specifies the maximum number of iterations
        to perform in conjunction with the iterative GMM estimator.  The default is 16,000 or the
        number set using set maxiter.  log/nolog specifies whether to show the iteration log.
        These options are seldom used.

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

    vce(vcetype) specifies the type of standard error reported, which includes types that are
        robust to some kinds of misspecification, that allow for intragroup correlation, and that
        use bootstrap or jackknife methods; see [R] vce_option.

        vce(unadjusted), the default for 2sls and liml, specifies that an unadjusted (nonrobust)
        VCE matrix be used. The default for gmm is based on the wmtype specified in the wmatrix()
        option; see wmatrix(wmtype) above.  If wmatrix() is specified with gmm but vce() is not,
        then vcetype is set equal to wmtype.  To override this behavior and obtain an unadjusted
        (nonrobust) VCE matrix, specify vce(unadjusted).

        ivregress also allows the following:

        vce(hac kernel [# | opt]) specifies that an HAC covariance matrix be used.  The syntax used
            with vce(hac kernel ...) is identical to that used with wmatrix(hac kernel ... ); see
            wmatrix(wmtype) above.

        +-----------+
    ----+ Reporting +------------------------------------------------------------------------------

    level(#); see [R] estimation options.

    first requests that the first-stage regression results be displayed.

    small requests that the degrees-of-freedom adjustment N/(N-k) be made to the
        variance-covariance matrix of parameters and that small-sample F and t statistics be
        reported, where N is the sample size and k is the number of parameters estimated.  By
        default, no degrees-of-freedom adjustment is made, and Wald and z statistics are reported.
        Even with this option, no degrees-of-freedom adjustment is made to the weighting matrix
        when the GMM estimator is used.

    noheader suppresses the display of the summary statistics at the top of the output, displaying
        only the coefficient table.

    depname(depname) is used only in programs and ado-files that use ivregress to fit models other
        than instrumental-variables regression.  depname() may be specified only at estimation
        time.  depname is recorded as the identity of the dependent variable, even though the
        estimates are calculated using depvar.  This method affects the labeling of the output --
        not the results calculated -- but could affect later calculations made by predict, where
        the residual would be calculated as deviations from depname rather than depvar.  depname()
        is most typically used when depvar is a temporary variable (see [P] macro) used as a proxy
        for depname.

    eform(string) is used only in programs and ado-files that use ivregress to fit models other
        than instrumental-variables regression.  eform() specifies that the coefficient table be
        displayed in "exponentiated form", as defined in [R] maximize, and that string be used to
        label the exponentiated coefficients in the table.

    display_options:  noomitted, vsquish, noemptycells, baselevels, allbaselevels, cformat(%fmt),
        pformat(%fmt), sformat(%fmt), and nolstretch; see [R] estimation options.

    The following options are available with ivregress but are not shown in the dialog box:

    perfect requests that ivregress not check for collinearity between the endogenous regressors
        and excluded instruments, allowing one to specify "perfect" instruments.  This option
        cannot be used with the LIML estimator.  This option may be required when using ivregress
        to implement other estimators.

    coeflegend; see [R] estimation options.


Examples

    Setup
        . webuse hsng2

    Fit a regression via 2SLS, requesting small-sample statistics
        . ivregress 2sls rent pcturban (hsngval = faminc i.region), small

    Fit a regression using the LIML estimator
        . ivregress liml rent pcturban (hsngval = faminc i.region)

    Fit a regression via GMM using the default heteroskedasticity-robust weight matrix
        . ivregress gmm rent pcturban (hsngval = faminc i.region)

    Fit a regression via GMM using a heteroskedasticity-robust weight matrix, requesting nonrobust
    standard errors
        . ivregress gmm rent pcturban (hsngval = faminc i.region), vce(unadjusted)
二维码

扫码加我 拉你入群

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

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

2013-6-11 13:03:57
建议楼主讲清楚您的变量类型与模型设定,
否则很难介绍。

像alexbig介绍的指令 xtabond,一般是用在dynamic panel。
而蓝色版主介绍的 ivregress gmm相当好,一般是用在横截面数据没错,
但主要方程的被解释变量如果是虚拟变量,可能更通用的指令是gmm

help gmm
指令gmm的写法比较繁琐,但比较通用,建议使用。
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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