Announcement

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

  • Invalid Syntax r(198)

    Hi all,
    I was wondering if anyone can help with egger's and begg's test for subgroups. I used this code for egger's test: by treatment: metabias loghr seloghr, egger
    , it works properly. I used this code for begg's test: by treatment: metabias loghr seloghr, begg
    ,
    but it works only in one subgroup and for the rest of them I get this error: invalid syntax r(198).
    here is the do-file below



  • #2
    If you share the data, members who are interested can try to duplicate the problem, and maybe figure out what is going on. Issue this command to generate code that will allow others to read in your data:

    Code:
    dataex treatment loghr seloghr
    If you have a new enough version of Stata, -dataex- will be there as an official command. If you do not have it, type -findit dataex-, and follow the instructions to install it.
    --
    Bruce Weaver
    Email: [email protected]
    Version: Stata/MP 18.5 (Windows)

    Comment


    • #3
      Thanks for your guidance, here is the code:
      Code:
       dataex treatment loghr seloghr
      
      ----------------------- copy starting from the next line -----------------------
      
      
      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str24 treatment float(loghr seloghr)
      "1" -.17 .27
      "1" -.14 .41
      "1"  .06 .16
      "1"  .72 .36
      "1" -.15 .21
      "1" -.02 .18
      "1"  .05 .22
      "2" -.11 .58
      "3" -.54 .21
      "3" -.23 .38
      "3" -.11 .13
      "3" -.11 .15
      "3" -.33 .52
      "4" -.18 .37
      "5" -.09 .39
      "6"  .06  .3
      "7" -.09 .21
      "7"  .36 .37
      end
      ------------------ copy up to and including the previous line ------------------ Listed 18 out of 18 observations . sort treatment . by treatment: metabias loghr seloghr, egger --------------------------------------------------------------------------------------------------------------------------- -> treatment = 1 Note: data input format theta se_theta assumed. Egger's test for small-study effects: Regress standard normal deviate of intervention effect estimate against its standard error Number of studies = 7 Root MSE = .9887 ------------------------------------------------------------------------------ Std_Eff | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- slope | -.1449189 .2879671 -0.50 0.636 -.885162 .5953241 bias | .7368849 1.290795 0.57 0.593 -2.58121 4.05498 ------------------------------------------------------------------------------ Test of H0: no small-study effects P = 0.593 --------------------------------------------------------------------------------------------------------------------------- -> treatment = 2 Note: data input format theta se_theta assumed. Egger's test for small-study effects: Regress standard normal deviate of intervention effect estimate against its standard error --------------------------------------------------------------------------------------------------------------------------- -> treatment = 3 Note: data input format theta se_theta assumed. Egger's test for small-study effects: Regress standard normal deviate of intervention effect estimate against its standard error Number of studies = 5 Root MSE = .964 ------------------------------------------------------------------------------ Std_Eff | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- slope | -.0374818 .1935478 -0.19 0.859 -.6534372 .5784737 bias | -.9006786 1.012813 -0.89 0.439 -4.1239 2.322543 ------------------------------------------------------------------------------ Test of H0: no small-study effects P = 0.439 --------------------------------------------------------------------------------------------------------------------------- -> treatment = 4 Note: data input format theta se_theta assumed. Egger's test for small-study effects: Regress standard normal deviate of intervention effect estimate against its standard error --------------------------------------------------------------------------------------------------------------------------- -> treatment = 5 Note: data input format theta se_theta assumed. Egger's test for small-study effects: Regress standard normal deviate of intervention effect estimate against its standard error --------------------------------------------------------------------------------------------------------------------------- -> treatment = 6 Note: data input format theta se_theta assumed. Egger's test for small-study effects: Regress standard normal deviate of intervention effect estimate against its standard error --------------------------------------------------------------------------------------------------------------------------- -> treatment = 7 Note: data input format theta se_theta assumed. Egger's test for small-study effects: Regress standard normal deviate of intervention effect estimate against its standard error Number of studies = 2 Root MSE = 0 ------------------------------------------------------------------------------ Std_Eff | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- slope | -.6806251 . . . . . bias | 2.8125 . . . . . ------------------------------------------------------------------------------ Test of H0: no small-study effects P = . . sort treatment . by treatment: metabias loghr seloghr, begg --------------------------------------------------------------------------------------------------------------------------- -> treatment = 1 Note: data input format theta se_theta assumed. Begg's test for small-study effects: Rank correlation between standardized intervention effect and its standard error adj. Kendall's Score (P-Q) = -1 Std. Dev. of Score = 6.66 Number of Studies = 7 z = -0.15 Pr > |z| = 0.881 z = 0.00 (continuity corrected) Pr > |z| = 1.000 (continuity corrected) --------------------------------------------------------------------------------------------------------------------------- -> treatment = 2 Note: data input format theta se_theta assumed. invalid syntax r(198);

      Comment


      • #4
        For some reason, -metabias- with the egger option can handle treatments that have only one observation, but -metabias- with the begg option cannot. The help for -metabias- suggest that you should be able to filter out the treatments only one observation by using an if condition. But when I tried that, it didn't work. So, it appears you'll have to drop the treatments with only one observation from the file to get it working properly. See below. And notice that when treatment takes only integer values, there's no good reason to treat it as a string variable. HTH.



        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input byte treatment float(loghr seloghr)
        1 -.17 .27
        1 -.14 .41
        1  .06 .16
        1  .72 .36
        1 -.15 .21
        1 -.02 .18
        1  .05 .22
        2 -.11 .58
        3 -.54 .21
        3 -.23 .38
        3 -.11 .13
        3 -.11 .15
        3 -.33 .52
        4 -.18 .37
        5 -.09 .39
        6  .06  .3
        7 -.09 .21
        7  .36 .37
        end
        
        tabulate treatment
        
        // If you have Stata 16, try this:
        
        meta set loghr seloghr
        meta summarize, subgroup(treatment)
        
        // by(subgroup) not working for -meta bias- for some reason
        meta bias, egger
        meta bias if treatment==1, egger
        meta bias if treatment==3, egger
        meta bias if treatment==7, egger
        
        meta bias, begg
        meta bias if treatment==1, begg
        meta bias if treatment==3, begg
        meta bias if treatment==7, begg
        
        // If you do not have v16, try this:
        
        bysort treatment: generate byte k = _N // k = # of studies within treatment
        by treatment: metabias loghr seloghr, egger
        * bysort treatment: metabias loghr seloghr if k > 1, begg
        * The help for metabias says if can be used, but the command
        * above is not working.  Therefore, I'll dump the treatments with k < 2.
        keep if k > 1
        by treatment: metabias loghr seloghr, begg


        --
        Bruce Weaver
        Email: [email protected]
        Version: Stata/MP 18.5 (Windows)

        Comment


        • #5
          Dear Bruce,
          I appreciate the information and advice you have shared. It's really a great help for me.

          Comment

          Working...
          X