Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • testparm vs. contrast

    Dear Listers,

    I am looking into the difference between testparm and contrast following a regression model. Reading online, it seems that testparm computes a Wald test which determines whether the variable improves the model while contrast produces comparisons akin to ANOVA tests.

    I am interested in the impact of different therapies on anxiety scores. I have three treatments I am comparing but to get my head around what is happening I start with comparing 2 of them only and I adjust for baseline scores of anxity. My model looks like this in Stata 16:

    regress anxiety i.treatment anxiety_base

    The regression coefficient for treatment is 0.69 (95%CI:-0.41 to 1.85), p = .22

    if I type testparm i.treatment, I get

    F(1, 134) = 1.46, p = .22 which is in line with the regression coefficient

    when I type contrast i.product (or r.product which eventually I plan to use when comparing all 3 treatments), I get: F(1) = 7.6, p = .007

    why is the contrast so different and what approach should be used to compare contrasts between specific treatments? Feel free to point me to any relevant resource.

    Thanks in advance
    Last edited by Laura Myles; 20 Aug 2020, 07:36.

  • #2
    You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. Being able to replicate your problem would really help us help you.

    If what you wrote is right, then in one of the test your testing something about treatment and the other about product.

    When I tried a toy regression, I got Precisely the same results for the two tests.


    . reg capx i.t

    Source | SS df MS Number of obs = 272,804
    -------------+---------------------------------- F(1, 272802) = 65895.20
    Model | 9.0223e+10 1 9.0223e+10 Prob > F = 0.0000
    Residual | 3.7352e+11 272,802 1369182.72 R-squared = 0.1946
    -------------+---------------------------------- Adj R-squared = 0.1946
    Total | 4.6374e+11 272,803 1699901.97 Root MSE = 1170.1

    ------------------------------------------------------------------------------
    capx | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    1.t | 1755.412 6.838365 256.70 0.000 1742.009 1768.815
    _cons | 126.98 2.391261 53.10 0.000 122.2932 131.6668
    ------------------------------------------------------------------------------
    r; t=0.57 11:37:31

    . testparm i.t

    ( 1) 1.t = 0

    F( 1,272802) =65895.20
    Prob > F = 0.0000
    r; t=0.02 11:37:38

    . contrast i.t

    Contrasts of marginal linear predictions

    Margins : asbalanced

    ------------------------------------------------
    | df F P>F
    -------------+----------------------------------
    t | 1 65895.20 0.0000
    |
    Denominator | 272802
    ------------------------------------------------
    r; t=0.11 11:37:48

    Comment

    Working...
    X