楼主: 伊妮乐
9860 12

[面板数据求助] 动态面板如何加入个体效应和时间效应呢 [推广有奖]

  • 0关注
  • 0粉丝

大专生

88%

还不是VIP/贵宾

-

威望
0
论坛币
3097 个
通用积分
6.0000
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
3933 点
帖子
2
精华
0
在线时间
133 小时
注册时间
2015-4-1
最后登录
2024-9-6

楼主
伊妮乐 发表于 2017-3-23 15:07:41 |AI写论文
50论坛币
求助一个动态面板的问题
我的模型包含被解释变量的一阶滞后项,也包含个体效应和时间效应(ui、aj)那么应该怎么写命令行呢?
我之前没有加入个体变量和时间变量的时候用的是系统GMM:xtdpdsys y l1.y2 x z...,lags(1) maxdep(2) twostep vce(robust)
现在想要加入个体变量和时间变量,参考静态面板,想用双向固定效应,不知道要怎么写命令,我自己写的xtdpdsys y l1.y2 x z...,lags(1) maxdep(2) i.id i.year fe r 然后运行不了,说fe无效,求问该怎么写?

关键词:动态面板 时间效应 如何加入 个体效应 xtdpdsys 动态 如何 模型

沙发
tianxinyang7 发表于 2019-11-7 12:54:45
楼主 你解决了吗 如何在GMM中控制时间效应和个体效应?

藤椅
gaoshang70800 在职认证  发表于 2019-12-9 15:59:26
tianxinyang7 发表于 2019-11-7 12:54
楼主 你解决了吗 如何在GMM中控制时间效应和个体效应?
同问????动态面板是不是没法控制个体效应鸭

板凳
gaoshang70800 在职认证  发表于 2019-12-9 15:59:34
tianxinyang7 发表于 2019-11-7 12:54
楼主 你解决了吗 如何在GMM中控制时间效应和个体效应?
同问????动态面板是不是没法控制个体效应鸭

报纸
你来看此花时88 发表于 2020-1-13 18:29:40
请问 楼主解决了吗,最近也遇到这个问题

地板
燕子矶hj 发表于 2020-3-25 22:48:31
gaoshang70800 发表于 2019-12-9 15:59
同问????动态面板是不是没法控制个体效应鸭
您解决了吗

7
燕子矶hj 发表于 2020-3-25 22:49:01
你来看此花时88 发表于 2020-1-13 18:29
请问 楼主解决了吗,最近也遇到这个问题
同问,您解决了吗,如果解决了,请赐教哈,谢谢

8
pineberries 学生认证  发表于 2020-4-12 14:14:24
我也遇到了这个问题,但是我觉得动态面板可能不需要控制这个不可观测的个体效应和时间效应。以差分动态面板方法来看,差分后,不可观测的个体效应就消除了;另外,对于剩余的误差项,则采用了工具变量法进行内生性问题的解决,所以个体效应和时间效应是不是就可以不用考虑了吧

9
pineberries 学生认证  发表于 2020-4-12 14:29:39
这是 help xtabond2后的描述
Description

    xtabond2 can fit two closely related dynamic panel data models.  The first is the Arellano-Bond (1991) estimator, which
    is also available with xtabond, though without the two-step standard error correction described below.  It is sometimes
    called "difference GMM." The second is an augmented version outlined by Arellano and Bover (1995) and fully developed
    by Blundell and Bond (1998).  It is known as "system GMM." Roodman (2006) provides a pedagogic introduction to linear
    GMM, these estimators, and xtabond2.  The estimators are designed for dynamic "small-T, large-N" panels that may
    contain fixed effects and--separate from those fixed effects--idiosyncratic errors that are heteroskedastic and
    correlated within but not across individuals.  Consider the model:

    y_it = x_it * b_1 + w_it * b_2 + u_it      i=1,...,N;     t=1,...,T
    u_it = v_i + e_it,

where

    v_i are unobserved individual-level effects;

    e_it are the observation-specific errors;

    x_it is a vector of strictly exogenous covariates (ones dependent on neither current nor past e_it);

    w_it is a vector of predetermined covariates (which may include the lag of y) and endogenous covariates, all of which
            may be correlated with the v_i (Predetermined variables are potentially correlated with past errors.
            Endogenous ones are potentially correlated with past and present errors.);

    b_1 and b_2 are vectors of parameters to be estimated;

    and E[v_i]=E[e_it]=E[v_i*e_it]=0, and E[e_it*e_js]=0 for each i, j, t, s, i<>j.

    First-differencing the equation removes the v_i, thus eliminating a potential source of omitted variable bias in
    estimation.  However, differencing variables that are predetermined but not strictly exogenous makes them endogenous
    since the w_it in some D.w_it = w_it � w_i,t-1 is correlated with the e_i,t-1 in D.e_it.  Following Holt-Eakin, Newey,
    and Rosen (1988), Arellano and Bond (1991) develop a Generalized Method of Moments estimator that instruments the
    differenced variables that are not strictly exogenous with all their available lags in levels.  (Strictly exogenous
    variables are uncorrelated with current and past errors.) Arellano and Bond also develop an appropriate test for
    autocorrelation, which, if present, can render some lags invalid as instruments.

    A problem with the original Arellano-Bond estimator is that lagged levels are poor instruments for first differences if
    the variables are close to a random walk.  Arellano and Bover (1995) describe how, if the original equation in levels
    is added to the system, additional instruments can be brought to bear to increase efficiency.  In this equation,
    variables in levels are instrumented with suitable lags of their own first differences.  The assumption needed is that
    these differences are uncorrelated with the unobserved country effects.  Blundell and Bond show that this assumption in
    turn depends on a more precise one about initial conditions.

    xtabond2 implements both estimators--twice.  The version in Stata�s ado programming language is slow but compatible
    with Stata 7 and 8.  The Mata version is usually faster, and runs in Stata 9.1 or later.  (Upgrading from 9.0 to 9.1 is
    free.) The xtabond2 option nomata prevents the use of Mata even when it is available.

    The Mata version also includes the option to use the forward orthogonal deviations transform instead of first
    differencing.  Proposed by Arellano and Bover (1995) the orthogonal deviations transform, rather than subtracting the
    previous observation, subtracts the average of all available future observations.  The result is then multiplied by a
    scale factor chosen to yield the nice but relatively unimportant property that if the original e_it are i.i.d., then so
    are the transformed ones (see Arellano and Bover (1995) and Roodman (2006)).  Like differencing, taking orthogonal
    deviations removes fixed effects.  Because lagged observations of a variable do not enter the formula for the
    transformation, they remain orthogonal to the transformed errors (assuming no serial correlation), and available as
    instruments.  In fact, for consistency, the software stores the orthogonal deviation of an observation one period late,
    so that, as with differencing, observations for period 1 are missing and, for an instrumenting variable w, w_i,t-1
    enters the formula for the transformed observation stored at i,t.  With this move, exactly the same lags of variables
    are valid as instruments under the two transformations.

    On balanced panels, GMM estimators based on the two transforms return numerically identical coefficient estimates,
    holding the instrument set fixed (Arellano and Bover 1995).  But orthogonal deviations has the virtue of preserving
    sample size in panels with gaps.  If some e_it is missing, for example, neither D.e_it nor D.e_i,t+1 can be computed.
    But the orthogonal deviation can be computed for every complete observation except the last for each individual.
    (First differencing can do no better since it must drop the first observation for each individual.) Note that
    "difference GMM" is still called that even when orthogonal deviations are used.  We will refer to the equation in
    differences or orthogonal deviations as the transformed equation.  In system GMM with orthogonal deviations, the levels
    or untransformed equation is still instrumented with differences as described above.

    xtabond2 reports the Arellano-Bond test for autocorrelation, which is applied to the differenced residuals in order to
    purge the unobserved and perfectly autocorrelated v_i.  AR(1) is expected in first differences, because D.e_i,t = e_i,t
    - e_i,t-1 should correlate with D.e_i,t-1 = e_i,t-1 - e_i,t-2 since they share the e_i,t-1 term.  So to check for AR(1)
    in levels, look for AR(2) in differences, on the idea that this will detect the relationship between the e_i,t-1 in
    D.e_i,t and the e_i,t-2 in D.e_i,t-2.  This reasoning does not work for orthogonal deviations, in which the residuals
    for an individual are all mathematically interrelated, thus contaminated from the point of view of detecting AR in the
    e_it.  So the test is run on differenced residuals even after estimation in deviations.  Autocorrelation indicates that
    lags of the dependent variable (and any other variables used as instruments that are not strictly exogenous), are in
    fact endogenous, thus bad instruments.  For example, if there is AR(s), then y_i,t-s would be correlated with e_i,t-s,
    which would be correlated with D.e_i,t-s, which would be correlated with D.e_i,t.

    xtabond2 also reports tests of over-identifying restrictions--of whether the instruments, as a group, appear exogenous.
    For one-step, non-robust estimation, it reports the Sargan statistic, which is the minimized value of the one-step GMM
    criterion function.  The Sargan statistic is not robust to heteroskedasticity or autocorellation.  So for one-step,
    robust estimation (and for all two-step estimation), xtabond2 also reports the Hansen J statistic, which is the
    minimized value of the two-step GMM criterion function, and is robust.  xtabond2 still reports the Sargan statistic in
    these cases because the J test has its own problem: it can be greatly weakened by instrument proliferation.  The Mata
    version goes further, reporting difference-in-Sargan statistics (really, difference-in-Hansen statistics, except in
    one-step robust estimation), which test for whether subsets of instruments are valid.  To be precise, it reports one
    test for each group of instruments defined by an ivstyle() or gmmstyle() option (explained below).  So replacing
    gmmstyle(x y) in a command line with gmmstyle(x) gmmstyle(y) will yield the same estimate but distinct
    difference-in-Sargan/Hansen tests.  In addition, including the split suboption in a gmmstyle() option in system GMM
    splits an instrument group in two for difference-in-Sargan/Hansen purposes, one each for the transformed equation and
    levels equations.  This is especially useful for testing the instruments for the levels equation based on lagged
    differences of the dependent variable, which are the most suspect in system GMM and the subject of the "initial
    conditions" in the title of Blundell and Bond (1998).  In the same vein, in system GMM, xtabond2 also tests all the
    GMM-type instruments for the levels equation as a group.  All of these tests, however, are weak when the instrument
    count is high.  Difference-in-Sargan/Hansen tests are are computationally intensive since they involve re-estimating
    the model for each test; the nodiffsargan option is available to prevent them.

    As linear GMM estimators, the Arellano-Bond and Blundell-Bond estimators have one- and two-step variants.  But though
    two-step is asymptotically more efficient, the reported two-step standard errors tend to be severely downward biased
    (Arellano and Bond 1991; Blundell and Bond 1998).  To compensate, xtabond2 makes available a finite-sample correction
    to the two-step covariance matrix derived by Windmeijer (2005).  This can make two-step robust estimations more
    efficient than one-step robust, especially for system GMM.

    Standard errors can also be "bootstrapped"--but not with the bootstrap command. That command builds temporary data sets
    by sampling the real one with replacement. And having multiple observations for a given observational unit and time
    period violates panel structure. Instead, use jacknife, perhaps with the cluster() option, clustering on the panel
    identifier variable, in order to drop each observational unit in turn.

    The syntax of xtabond2 differs substantially from that of xtabond.  xtabond2 almost completely decouples specification
    of regressors from specification of instruments.  As a result, most variables used will appear twice in an xtabond2
    command line.  xtabond2 requires the initial varlist of the command line to include all regressors except for the
    optional constant term, be they strictly exogenous, predetermined, or endogenous.  Variables used to form instruments
    then appear in gmmstyle() or ivstyle() options after the comma.  The result is a loss of parsimony, but fuller control
    over the instrument matrix.  Variables can be used as the basis for "GMM-style" instrument sets without being included
    as regressors, or vice versa.

    The gmmstyle() and ivstyle() options also have suboptions that allow further customization of the instrument matrix.
    But a warning: these suboptions, along with the h() and arlevels options, can be confusing to new users and are usually
    not needed in standard applications.  They are best ignored when first learning xtabond2.

10
pineberries 学生认证  发表于 2020-4-12 14:31:02
可以看help xtabond2后,可以清楚一点
Description

    xtabond2 can fit two closely related dynamic panel data models.  The first is the Arellano-Bond (1991) estimator, which
    is also available with xtabond, though without the two-step standard error correction described below.  It is sometimes
    called "difference GMM." The second is an augmented version outlined by Arellano and Bover (1995) and fully developed
    by Blundell and Bond (1998).  It is known as "system GMM." Roodman (2006) provides a pedagogic introduction to linear
    GMM, these estimators, and xtabond2.  The estimators are designed for dynamic "small-T, large-N" panels that may
    contain fixed effects and--separate from those fixed effects--idiosyncratic errors that are heteroskedastic and
    correlated within but not across individuals.  Consider the model:

    y_it = x_it * b_1 + w_it * b_2 + u_it      i=1,...,N;     t=1,...,T
    u_it = v_i + e_it,

where

    v_i are unobserved individual-level effects;

    e_it are the observation-specific errors;

    x_it is a vector of strictly exogenous covariates (ones dependent on neither current nor past e_it);

    w_it is a vector of predetermined covariates (which may include the lag of y) and endogenous covariates, all of which
            may be correlated with the v_i (Predetermined variables are potentially correlated with past errors.
            Endogenous ones are potentially correlated with past and present errors.);

    b_1 and b_2 are vectors of parameters to be estimated;

    and E[v_i]=E[e_it]=E[v_i*e_it]=0, and E[e_it*e_js]=0 for each i, j, t, s, i<>j.

    First-differencing the equation removes the v_i, thus eliminating a potential source of omitted variable bias in
    estimation.  However, differencing variables that are predetermined but not strictly exogenous makes them endogenous
    since the w_it in some D.w_it = w_it � w_i,t-1 is correlated with the e_i,t-1 in D.e_it.  Following Holt-Eakin, Newey,
    and Rosen (1988), Arellano and Bond (1991) develop a Generalized Method of Moments estimator that instruments the
    differenced variables that are not strictly exogenous with all their available lags in levels.  (Strictly exogenous
    variables are uncorrelated with current and past errors.) Arellano and Bond also develop an appropriate test for
    autocorrelation, which, if present, can render some lags invalid as instruments.

    A problem with the original Arellano-Bond estimator is that lagged levels are poor instruments for first differences if
    the variables are close to a random walk.  Arellano and Bover (1995) describe how, if the original equation in levels
    is added to the system, additional instruments can be brought to bear to increase efficiency.  In this equation,
    variables in levels are instrumented with suitable lags of their own first differences.  The assumption needed is that
    these differences are uncorrelated with the unobserved country effects.  Blundell and Bond show that this assumption in
    turn depends on a more precise one about initial conditions.

    xtabond2 implements both estimators--twice.  The version in Stata�s ado programming language is slow but compatible
    with Stata 7 and 8.  The Mata version is usually faster, and runs in Stata 9.1 or later.  (Upgrading from 9.0 to 9.1 is
    free.) The xtabond2 option nomata prevents the use of Mata even when it is available.

    The Mata version also includes the option to use the forward orthogonal deviations transform instead of first
    differencing.  Proposed by Arellano and Bover (1995) the orthogonal deviations transform, rather than subtracting the
    previous observation, subtracts the average of all available future observations.  The result is then multiplied by a
    scale factor chosen to yield the nice but relatively unimportant property that if the original e_it are i.i.d., then so
    are the transformed ones (see Arellano and Bover (1995) and Roodman (2006)).  Like differencing, taking orthogonal
    deviations removes fixed effects.  Because lagged observations of a variable do not enter the formula for the
    transformation, they remain orthogonal to the transformed errors (assuming no serial correlation), and available as
    instruments.  In fact, for consistency, the software stores the orthogonal deviation of an observation one period late,
    so that, as with differencing, observations for period 1 are missing and, for an instrumenting variable w, w_i,t-1
    enters the formula for the transformed observation stored at i,t.  With this move, exactly the same lags of variables
    are valid as instruments under the two transformations.

    On balanced panels, GMM estimators based on the two transforms return numerically identical coefficient estimates,
    holding the instrument set fixed (Arellano and Bover 1995).  But orthogonal deviations has the virtue of preserving
    sample size in panels with gaps.  If some e_it is missing, for example, neither D.e_it nor D.e_i,t+1 can be computed.
    But the orthogonal deviation can be computed for every complete observation except the last for each individual.
    (First differencing can do no better since it must drop the first observation for each individual.) Note that
    "difference GMM" is still called that even when orthogonal deviations are used.  We will refer to the equation in
    differences or orthogonal deviations as the transformed equation.  In system GMM with orthogonal deviations, the levels
    or untransformed equation is still instrumented with differences as described above.

    xtabond2 reports the Arellano-Bond test for autocorrelation, which is applied to the differenced residuals in order to
    purge the unobserved and perfectly autocorrelated v_i.  AR(1) is expected in first differences, because D.e_i,t = e_i,t
    - e_i,t-1 should correlate with D.e_i,t-1 = e_i,t-1 - e_i,t-2 since they share the e_i,t-1 term.  So to check for AR(1)
    in levels, look for AR(2) in differences, on the idea that this will detect the relationship between the e_i,t-1 in
    D.e_i,t and the e_i,t-2 in D.e_i,t-2.  This reasoning does not work for orthogonal deviations, in which the residuals
    for an individual are all mathematically interrelated, thus contaminated from the point of view of detecting AR in the
    e_it.  So the test is run on differenced residuals even after estimation in deviations.  Autocorrelation indicates that
    lags of the dependent variable (and any other variables used as instruments that are not strictly exogenous), are in
    fact endogenous, thus bad instruments.  For example, if there is AR(s), then y_i,t-s would be correlated with e_i,t-s,
    which would be correlated with D.e_i,t-s, which would be correlated with D.e_i,t.

    xtabond2 also reports tests of over-identifying restrictions--of whether the instruments, as a group, appear exogenous.
    For one-step, non-robust estimation, it reports the Sargan statistic, which is the minimized value of the one-step GMM
    criterion function.  The Sargan statistic is not robust to heteroskedasticity or autocorellation.  So for one-step,
    robust estimation (and for all two-step estimation), xtabond2 also reports the Hansen J statistic, which is the
    minimized value of the two-step GMM criterion function, and is robust.  xtabond2 still reports the Sargan statistic in
    these cases because the J test has its own problem: it can be greatly weakened by instrument proliferation.  The Mata
    version goes further, reporting difference-in-Sargan statistics (really, difference-in-Hansen statistics, except in
    one-step robust estimation), which test for whether subsets of instruments are valid.  To be precise, it reports one
    test for each group of instruments defined by an ivstyle() or gmmstyle() option (explained below).  So replacing
    gmmstyle(x y) in a command line with gmmstyle(x) gmmstyle(y) will yield the same estimate but distinct
    difference-in-Sargan/Hansen tests.  In addition, including the split suboption in a gmmstyle() option in system GMM
    splits an instrument group in two for difference-in-Sargan/Hansen purposes, one each for the transformed equation and
    levels equations.  This is especially useful for testing the instruments for the levels equation based on lagged
    differences of the dependent variable, which are the most suspect in system GMM and the subject of the "initial
    conditions" in the title of Blundell and Bond (1998).  In the same vein, in system GMM, xtabond2 also tests all the
    GMM-type instruments for the levels equation as a group.  All of these tests, however, are weak when the instrument
    count is high.  Difference-in-Sargan/Hansen tests are are computationally intensive since they involve re-estimating
    the model for each test; the nodiffsargan option is available to prevent them.

    As linear GMM estimators, the Arellano-Bond and Blundell-Bond estimators have one- and two-step variants.  But though
    two-step is asymptotically more efficient, the reported two-step standard errors tend to be severely downward biased
    (Arellano and Bond 1991; Blundell and Bond 1998).  To compensate, xtabond2 makes available a finite-sample correction
    to the two-step covariance matrix derived by Windmeijer (2005).  This can make two-step robust estimations more
    efficient than one-step robust, especially for system GMM.

    Standard errors can also be "bootstrapped"--but not with the bootstrap command. That command builds temporary data sets
    by sampling the real one with replacement. And having multiple observations for a given observational unit and time
    period violates panel structure. Instead, use jacknife, perhaps with the cluster() option, clustering on the panel
    identifier variable, in order to drop each observational unit in turn.

    The syntax of xtabond2 differs substantially from that of xtabond.  xtabond2 almost completely decouples specification
    of regressors from specification of instruments.  As a result, most variables used will appear twice in an xtabond2
    command line.  xtabond2 requires the initial varlist of the command line to include all regressors except for the
    optional constant term, be they strictly exogenous, predetermined, or endogenous.  Variables used to form instruments
    then appear in gmmstyle() or ivstyle() options after the comma.  The result is a loss of parsimony, but fuller control
    over the instrument matrix.  Variables can be used as the basis for "GMM-style" instrument sets without being included
    as regressors, or vice versa.

    The gmmstyle() and ivstyle() options also have suboptions that allow further customization of the instrument matrix.
    But a warning: these suboptions, along with the h() and arlevels options, can be confusing to new users and are usually
    not needed in standard applications.  They are best ignored when first learning xtabond2.

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-2-1 17:44