Announcement

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

  • forest plot

    Hello i m yannis, medical student

    I m working on my thesis about the psychiatric disease in prison.
    I made a meta analysis of proportion from prevalence and i want to make a forest plot with it, i don't practice metan and i did it with advices from good guy.

    this is my command line:

    clear

    input study cases total

    1 4 415

    2 2 80

    3 29 800

    4 58 320

    5 5 102

    6 3 193

    7 1 290

    8 13 1008

    9 9 1350

    10 5 495

    11 9 184

    12 38 707

    13 6 500

    14 5 98

    end

    gen p = .

    gen se = .

    // get proportions and std errors

    forv i =1(1)14 {

    cii total[`i'] cases[`i']

    qui replace p = r(mean) in `i'

    qui replace se = r(se) in `i'

    }

    // get the inverse variance-weighted proportion

    // use the official Stata -vwls- command

    gen cons =1

    vwls p cons, sd(se)

    // use the user written -metan- command

    // for fixed-effects meta-analysis

    metan p se, nograph fixed

    // for random-effects meta-analysis

    metan p se, nograph random





    hth,

    bw


    Furthermore, i think that metaprop is easier to use isn t it?

    Thanx

  • #2
    It may be helpful to provide information about the version of Stata you use. Here I present with Stata/IC 14.2.

    Provide -prop- in the immediate command for confidence interval as:

    Code:
    cii prop total[`i'] cases[`i']
    In general, to plot a forestplot, remove the -nograph- in your command line

    The command line below should work

    Code:
    clear
    
    input study cases total
    
    1 4 415
    
    2 2 80
    
    3 29 800
    
    4 58 320
    
    5 5 102
    
    6 3 193
    
    7 1 290
    
    8 13 1008
    
    9 9 1350
    
    10 5 495
    
    11 9 184
    
    12 38 707
    
    13 6 500
    
    14 5 98
    
    end
    
    gen p = .
    
    gen se = .
    
    // get proportions and std errors
    
    forv i =1(1)14 {
    
    cii prop total[`i'] cases[`i']
    
    qui replace p = r(mean) in `i'
    
    qui replace se = r(se) in `i'
    
    }
    
    // get the inverse variance-weighted proportion
    
    // use the official Stata -vwls- command
    
    gen cons =1
    
    vwls p cons, sd(se)
    
    // use the user written -metan- command
    
    // for fixed-effects meta-analysis
    
    metan p se, fixed
    
    // for random-effects meta-analysis
    
    metan p se, random

    Regards,








    Comment


    • #3
      Hello Thx i run with stata 14.0

      it don t work, maybe i didn't explain myself enough. I want to get the forest plot graph
      when i put your command, this is stata says:

      . input study cases total

      study cases total
      1.
      . 1 4 415
      2.
      . 2 2 80
      3.
      . 3 29 800
      4.
      . 4 58 320
      5.
      . 5 5 102
      6.
      . 6 3 193
      7.
      . 7 1 290
      8.
      . 8 13 1008
      9.
      . 9 9 1350
      10.
      . 10 5 495
      11.
      . 11 9 184
      12.
      . 12 38 707
      13.
      . 13 6 500
      14.
      . 14 5 98
      15.
      . end

      .
      . gen p = .
      (14 missing values generated)

      .
      . gen se = .
      (14 missing values generated)

      .
      . // get proportions and std errors
      / is not a valid command name
      r(199);

      .
      . forv i =1(1)14 {
      2.
      . cii prop total[`i'] cases[`i']
      3.
      . qui replace p = r(mean) in `i'
      4.
      . qui replace se = r(se) in `i'
      5.
      . }
      prop not found
      r(111);

      .
      . // get the inverse variance-weighted proportion
      / is not a valid command name
      r(199);

      .
      . // use the official Stata -vwls- command
      / is not a valid command name
      r(199);

      .
      . gen cons =1

      .
      . vwls p cons, sd(se)
      no observations
      r(2000);

      .
      . // use the user written -metan- command
      / is not a valid command name
      r(199);

      .
      . // for fixed-effects meta-analysis
      / is not a valid command name
      r(199);

      .
      . metan p se, nograph fixed
      Insufficient data to perform this meta-analysis

      .
      . // for random-effects meta-analysis
      / is not a valid command name
      r(199);

      .
      . metan p se, nograph random
      Insufficient data to perform this meta-analysis

      .
      .
      .
      .
      .
      . hth,
      command hth is unrecognized
      r(199);

      .
      . bw
      command bw is unrecognized
      r(199);

      .
      .

      Comment


      • #4
        prop not found..

        ii m not familiar with stata

        Thx a lot
        Last edited by abdelkrim yannis; 16 May 2018, 08:10.

        Comment


        • #5
          ok it works thank you very much just remove nograph

          Comment


          • #6
            Sorry juste one last question
            how to put the study name in the forest plot?

            Thx

            Comment


            • #7
              Among the options, the study name could be a label of the variable. Check how to use - label define - command.
              Best regards,

              Marcos

              Comment

              Working...
              X