Skip to content

ENH/design: variance of average effect with extra term, random or fixed exog #8767

Open

Description

@josef-pkt

When we have an average nonlinear effect g_bar = average(g_i) where g_i = g_i(params, exog) is a nonlinear function, then we compute the variance of g_bar using the delta method.

it is possible to add the sample variance of g_i as an extra variance term to the variance of g_bar.

I just saw this in Liu et al #8762 (comment) #7193
and I was puzzled about their variance for average effects.

some articles on background

Greene, Dowd, Norton use only the delta method term, working conditional on the exog in the sample (similar to fixed exog bootstrap)
Terza argues in favor of including the extra sample variance of the effect with the interpretation that it comes from random sampling of exog from a population distribution.

Greene, William H., Bryan E. Dowd, and Edward C. Norton. “Response to ‘Inference Using Sample Means of Parametric Nonlinear Data Transformations.’” Health Services Research 51, no. 3 (2016): 1114–16. https://doi.org/10.1111/1475-6773.12493.

Terza, Joseph V. “Inference Using Sample Means of Parametric Nonlinear Data Transformations.” Health Services Research 51, no. 3 (June 2016): 1109–13. https://doi.org/10.1111/1475-6773.12494.

Dowd, Bryan E., William H. Greene, and Edward C. Norton. “Computation of Standard Errors.” Health Services Research 49, no. 2 (2014): 731–50. https://doi.org/10.1111/1475-6773.12122.

I think so far we only include the delta method term (following Stata and other packages)

I'm not sure how GMM in treatment effect for ATE, POM is treating this. We still use a sandwich covariance that includes the variance of the moment conditions (including definition of ate and pom as moment condition).
(This might be some explanation for what puzzled me in treatment effect when some things were different in my and Stata's GMM implementation of it that did not match up with what I had expected when I checked other ways to compute it. I didn't investigate, I just wanted to match Stata results.)

maybe partially related:
meta-analysis: fixed scale versus WLS scale, usually dressed up as fixed effects versus random effects.

Similar issue:
Fixed design matrix or population distribution of exog in power and sample size computation.
So far I have mainly looked at fixed sample design (except for nobs or nobs-ratios). In the regression setting I have now seen also the case where randomness of sample exog based on a population distribution of exog is taken into account when computing (unconditional) power.

main question: Do we need to add an option for including the second term?
e.g.
get_prediction has an aggregate option but only includes delta method term. same for margins, AFAIU.
extra average effects that we will want to include as post-estimation result, e.g. risk ratio, risk difference in binary models

and document appropriately which version is implicitly or explicitly used.
e.g. what does (nonparametrically identified) causal effect literature use?

Activity

  1. added this to the 0.15 milestone on Apr 3, 2023
  2. josef-pkt commented on Apr 3, 2023

    @josef-pkt
    MemberAuthor

    update
    footnote in Terza article refers to problem 12.17 of Wooldridge ([2010]
    The problem uses an M-estimator with standard sandwich form.
    The variance of the average effect includes the extra term with sample var of individual effects. It takes randomness of individual effects into account.
    The proof is in the solution manual.

    I guess the same applies to GMM.

    Part c) of the question refers to evaluating the average effect out of sample, i.e. "predict" exog are the exog used in the estimation. In this case, the extra term is just adding the variance of the "out-of-sample individual effects"
    In part a) the extra moment condition is correlated with the model moment conditions, and the extra term is not just the simple variance of individual effects.

    My guess this is out-of-sample prediction versus in-sample correlated moment equations. But in both cases, wooldridge takes the extra randomness/heterogeneity in the individual effects into account. (where heterogeneity comes form different exog across individuals)

    maybe another related issue
    Conditioning on sample exog, treats the sample as the population, similar to survey method when we "sample" the entire population. The mean or total of a population does not have a variance, it's just a number.
    Unconditional, we have random exog drawn from a super population, and we want to compute the average effect for the superpopulation.
    (But my knowledge of survey methods is "vague".)

    We have related issues for average effects for out-of-sample (predict) versus in-sample (GMM).
    #8389, ....
    But that should be a bit orthogonal to whether we compute averages conditional on (given) exogs or unconditional.

    AFAIU, ATE is always unconditional, ATT, AT for subpopulation is for the subpopulation (exog) distribution but not conditioning on the specific exog values.

    reading the statements in the problem 12.17 more carefully, it states (with different notation)
    exog is random variable exog w, and
    we want to estimate unconditional effect E(g(w, params)) (expectation both w.r.t w and params )

    Greene, Stata and, so far, statsmodels have E(g(w, params) | W)

    and another update
    consequence for predict:

    var(average_effect for a subpopulation given by x) = var(g_i) + delta method

    however, predict exog might not be the correct sample to compute var(g_i). It will only be correct of the exog are a random draw from the appropriate exog population.
    That is we would have to estimate var(g_i) "in-sample" and use it as a parameter in predict.

    This is similar to variance for prediction interval (se_obs) where we have an additional var term for the individual randomness.

    e.g. in a control chart, we would have to take into account what the individual heterogeneity would be in a new control sample, but how large the heterogeneity is has been estimated with a first stage training sample.
    (an example might be to control some nonlinear statistic that is averaged over several observation points.)

  3. josef-pkt commented on May 23, 2023

    @josef-pkt
    MemberAuthor

    naming problem

    • margeff marginal or partial effect only takes cov_params into account ("overall" or average=True)
    • treatment effect, ATE, average causal effect, partial effect in Wooldridge style, ... takes (in-sample) heterogeneity into account (unconditional, sample population average.

    Both are average partial effects.
    Do we use two different names? which?
    How do we distinguish the two cases? (Users might not be aware of the distinction, as I wasn't)
    Can we rely on that the two effects are computed in different places, function, methods so that it's "obvious"?

    also:
    The first corresponds to predict, the second to extra (in-sample) moment condition (GMM) (or effect parameter estimate).

  4. added
    topic-post_estim
    on Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp-basecomp-discretecomp-statstopic-post_estimtype-enh

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions