Announcement

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

  • Wald test on STATA to show that distribution among two groups is statistically different as a result of a parameter.

    How do I perform a wald test on STATA to achieve the following? I have a table of that look like the one below. I am trying to write down the distribution of people with 0,1,2,3,4,5 cardiovascular disease risk factors in my sample. Under "All" I will write number of people with these risk factors and under "smoking" and "non-smoking" I will write how many of these people smoke and how many don't. Now, I want to show that the distribution of smokers and non-smokers is significantly different in each row to show that that smoking plays a role in the number of risk factors and wanted to do so with a Wald type test. I wanted help on how I could perform this.
    No. of Risk Factors **** All **** Smoking ***** Not smoking
    0
    1
    2
    3
    4
    5


  • #2
    Tia:
    why not -reshape-ing your data in -long- format and going -poisson- here?
    Code:
    poissson <CVD_risk_factor> i.smoker
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      That makes sense, I will do that. Thank you. However, if I were asked to do a Wald test, how do you suggest I go about it? Asking because I was asked to do a wald test to figure this out although I feel there may be other alternatives.

      Comment


      • #4
        Tia:
        if you mean a Wald test to check whether coefficients of -poisson-regression show evidence of a statistically significant difference, plese see the following toy-example:
        Code:
        use "C:\Program Files\Stata16\ado\base\a\auto.dta"
        . poisson rep78 i.foreign
        
        Iteration 0:   log likelihood = -112.88724 
        Iteration 1:   log likelihood = -112.88724 
        
        Poisson regression                              Number of obs     =         69
                                                        LR chi2(1)        =       6.58
                                                        Prob > chi2       =     0.0103
        Log likelihood = -112.88724                     Pseudo R2         =     0.0283
        
        ------------------------------------------------------------------------------
               rep78 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
             foreign |
            Foreign  |   .3497545   .1341926     2.61   0.009     .0867418    .6127672
               _cons |   1.105533   .0830455    13.31   0.000     .9427666    1.268299
        ------------------------------------------------------------------------------
        
        . test 0.foreign=1.foreign
        
         ( 1)  [rep78]0b.foreign - [rep78]1.foreign = 0
        
                   chi2(  1) =    6.79
                 Prob > chi2 =    0.0092
        
        .
        Otherwise, if you want to stop at counts and related proportions of the CVD risk factor in smokers and non-smokers, elaborating on the previous toy-example you may want to consider somethng along the following lines:
        Code:
        use "C:\Program Files\Stata16\ado\base\a\auto.dta"
        . tabulate foreign rep78, chi2 expected
        
        +--------------------+
        | Key                |
        |--------------------|
        |     frequency      |
        | expected frequency |
        +--------------------+
        
                   |                   Repair Record 1978
          Car type |         1          2          3          4          5 |     Total
        -----------+-------------------------------------------------------+----------
          Domestic |         2          8         27          9          2 |        48
                   |       1.4        5.6       20.9       12.5        7.7 |      48.0
        -----------+-------------------------------------------------------+----------
           Foreign |         0          0          3          9          9 |        21
                   |       0.6        2.4        9.1        5.5        3.3 |      21.0
        -----------+-------------------------------------------------------+----------
             Total |         2          8         30         18         11 |        69
                   |       2.0        8.0       30.0       18.0       11.0 |      69.0
        
                  Pearson chi2(4) =  27.2640   Pr = 0.000
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          This clears things up a lot...thank you so much for the swift and very helpful response. I will follow up if I have further questions.

          Comment


          • #6
            Hello, so I could perform a poisson regression and use the wald p-value to determine if two coefficients show a statistically significant difference. Is there a way to do a prevalence ratio and use wald pvalue to determine the statistical difference between smokers and non smokers for each risk factor level?

            Comment


            • #7
              Tia:
              1) if you only have CVD risk-factor and -i.smoking- (and the latter is your only predictor), you can go:
              Code:
              bysort <CVD_risk>: poisson <CVD_risk> i.smoking
              2) if your regressand is a categorical variable such as -disease_yes_no-, you can go -logit- or -logistic- and interact CVD risk-factor with smoking addiction:
              Code:
              logit <disease_yes_no> i.CVD_risk##i.smoking
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment

              Working...
              X