Announcement

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

  • Unadjusted group mean

    I have a dataset where twenty subjects with fever blisters were recruited and randomly assigned to either placebo or treatment. There are two outcomes: number of days to heal and whether blisters decrease or not. The variables are days(continuous) and reduced (binary; 1= yes, 0=no). The other variables are id (1-20), treatment (1=treatment, 0=placebo), history(1=prior history of blister, 0=no history), and age(1=20-30, 2=31-40, 3=41-50). I'm trying to figure out what command to use to find the unadjusted treatment group mean (as a decimal and in percent) for both outcomes?

  • #2
    Code:
    bys treatment: days reduced
    If this does not work, try to provide an example of your dataset using -dataex

    Comment


    • #3
      Emil Alnor That does not work. got the following when I tried that "command days is unrecognized"

      This is an example of the dataset

      Code:
      * Example generated by -dataex-. For more info, type help dataex
      clear
      input int(id treatment reduced days history age)
       1 1 1  5 1 3
       2 0 1  6 0 3
       3 0 0  9 0 1
       4 0 0  9 1 3
       5 1 1  4 1 2
       6 1 1  4 1 1
       7 0 0 11 0 2
       8 1 0  8 1 3
       9 1 1  5 0 1
      10 0 0  9 0 1
      11 1 1  6 1 1
      12 1 1  4 0 2
      13 0 1  6 1 3
      14 1 1  5 0 2
      15 1 1  5 0 3
      16 1 1  5 0 2
      17 0 0  8 1 1
      18 0 0 10 1 2
      19 1 1  4 0 1
      20 0 0  7 1 1
      end
      Last edited by Amber Pong; 05 Apr 2023, 09:44.

      Comment


      • #4
        Amber:
        do you mean something along the following lines (that elaborates on Emil's suggestion)?:
        Code:
        . bys treatment: sum days reduced
        
        ------------------------------------------------------------------------------------------------------------------------------------------
        -> treatment = 0
        
            Variable |        Obs        Mean    Std. dev.       Min        Max
        -------------+---------------------------------------------------------
                days |          9    8.333333    1.732051          6         11
             reduced |          9    .2222222    .4409586          0          1
        
        ------------------------------------------------------------------------------------------------------------------------------------------
        -> treatment = 1
        
            Variable |        Obs        Mean    Std. dev.       Min        Max
        -------------+---------------------------------------------------------
                days |         11           5    1.183216          4          8
             reduced |         11    .9090909    .3015113          0          1
        
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thanks, Carlo Lazzaro. I'm trying to get the unadjusted treatment (when treatment=1) group mean (as a decimal and %). I did the regression models for both outcomes adjusting for history and age and got the coefficients and standard error. But I also want the unadjusted treatment (when treatment=1) group mean. Is this something I can find in the model output?
          Last edited by Amber Pong; 05 Apr 2023, 09:54.

          Comment


          • #6
            Amber:
            sorry, but I do not follow you, especially as far as as a decimal and % are concerned (by the way, % makes me think about a log-linear regression model).
            That said, what happens if you do not adjust your main predictors for history and age in your regression?
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Carlo, I think a simple descriptive of the treatment mean is what I'm looking for. Thanks for the guidance.
              Last edited by Amber Pong; 05 Apr 2023, 11:22.

              Comment


              • #8
                Amber:
                I would follow this approach:
                Code:
                . bys treatment: tabstat days, stat(count mean sd p25 p50 p75 min max)
                
                ------------------------------------------------------------------------------------------------------------------------------------------
                -> treatment = 0
                
                    Variable |         N      Mean        SD       p25       p50       p75       Min       Max
                -------------+--------------------------------------------------------------------------------
                        days |         9  8.333333  1.732051         7         9         9         6        11
                ----------------------------------------------------------------------------------------------
                
                ------------------------------------------------------------------------------------------------------------------------------------------
                -> treatment = 1
                
                    Variable |         N      Mean        SD       p25       p50       p75       Min       Max
                -------------+--------------------------------------------------------------------------------
                        days |        11         5  1.183216         4         5         5         4         8
                ----------------------------------------------------------------------------------------------
                
                . bys treatment: tabstat reduced, stat(count mean sd p25 p50 p75 min max)
                
                ------------------------------------------------------------------------------------------------------------------------------------------
                -> treatment = 0
                
                    Variable |         N      Mean        SD       p25       p50       p75       Min       Max
                -------------+--------------------------------------------------------------------------------
                     reduced |         9  .2222222  .4409586         0         0         0         0         1
                ----------------------------------------------------------------------------------------------
                
                ------------------------------------------------------------------------------------------------------------------------------------------
                -> treatment = 1
                
                    Variable |         N      Mean        SD       p25       p50       p75       Min       Max
                -------------+--------------------------------------------------------------------------------
                     reduced |        11  .9090909  .3015113         1         1         1         0         1
                ----------------------------------------------------------------------------------------------
                
                .
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment

                Working...
                X