Announcement

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

  • Set Star Levels

    Hi Statalisters,

    I'm trying to create a table of my regression output with stars. The default stars are not what I would like to use and instead I want to set mine at: ( * 0.10 ** 0.05 *** 0.010) for the respective p values.

    This is what I'm using but I keep getting an "invalid syntax" error.

    estout OLS_pol OLS_econ OLS_inst, cells(b(star fmt(7) label(Coef.)) se(par fmt(2) label(std.errors)))
    label star( * 0.10 ** 0.05 *** 0.010) label stats(N r2 bic, labels ("No. of Obs."
    "R-Squared" "IC" ) fmt(3 0 1))

    I have tried "starlevels" many times and stata gives me an "unrecognized command" error.

    estout OLS_pol OLS_econ OLS_inst, cells(b(star fmt(7) label(Coef.)) se(par fmt(2) label(std.errors)))
    starlevels( * 0.10 ** 0.05 *** 0.010) stats(N r2 bic, labels ("No. of Obs."
    "R-Squared" "IC" ) fmt(3 0 1))

    Please help!

    Thank you,
    Gina

  • #2
    It appears to me that you are spreading your command out over three lines without using line continuation characters.

    That's at best a guess, because I cannot see your actual Stata output - just your recounting of it and the error messages. I cannot know whether you ran it from a do-file, in which case the comment on line continuation characters is appropriate, or from the Command window, in which case you should have typed your command as one long line, allowing it to wrap within the window.

    Please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. See especially sections 9-12 on how to best pose your question. Section 12.1 is particularly pertinent

    12.1 What to say about your commands and your problem

    Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!
    It's particularly helpful to copy commands and output from your Stata Results window and paste them into your Statalist post using CODE delimiters, as described in section 12 of the FAQ. For example, the following:

    [code]
    // sample code
    sysuse auto, clear
    describe
    [/code]

    will be presented in the post as the following:
    Code:
    // sample code
    sysuse auto, clear
    describe

    Comment


    • #3
      Stata thinks that label and starlevels are new commands because they follow on a separate line. You can use delimiters with long commands.
      Code:
      #delimit ;
      
      estout OLS_pol OLS_econ OLS_inst, cells(b(star fmt(7) label(Coef.)) se(par fmt(2) label(std.errors)))
      label star( * 0.10 ** 0.05 *** 0.010) label stats(N r2 bic, labels ("No. of Obs."
      "R-Squared" "IC" ) fmt(3 0 1));
      
      estout OLS_pol OLS_econ OLS_inst, cells(b(star fmt(7) label(Coef.)) se(par fmt(2) label(std.errors)))
      starlevels( * 0.10 ** 0.05 *** 0.010) stats(N r2 bic, labels ("No. of Obs."
      "R-Squared" "IC" ) fmt(3 0 1));
      
      #delimit cr
      You can read more about this in
      Code:
      help #delimit
      or in [U] 16.1.3 Long lines in do-files. Quote:

      You can change the end-of-line delimiter to ‘;’ by using #delimit, you can comment out the line break by using /* */ comment delimiters, or you can use the /// line-join indicator.
      When reporting problems, please copy and paste what you see in the Results window of Stata and please use CODE delimiters for Stata commands and output. This is explained in section 12 of the FAQ.

      Comment


      • #4
        Thank you for your replies! I ran this from a do file and here is the output I receive in Stata:

        . estout OLS_pol OLS_econ OLS_inst, cells(b(star fmt(7) label(Coef.)) se(par fmt(2) label(s
        > td.errors))) label star( * 0.10 ** 0.05 *** 0.010) label stats(N r2 bic, labels ("No. of
        > Obs." "R-Squared" "IC" ) fmt(3 0 1))
        option star() not allowed
        r(198);

        end of do-file

        r(198);

        Comment


        • #5
          Please read
          Code:
          help estout
          The option is defined as
          Code:
          starlevels(levelslist)
          This means that the shortest possible abbreviation is
          Code:
          starl()
          Please use CODE delimiters for Stata commands and output, they are easier to read that way.

          Comment


          • #6
            Code:
            . estout OLS_pol OLS_econ OLS_inst, cells(b(star fmt(7) label(Coef.)) se(par fmt(2) label(std.errors))) starl( * 0.10 ** 0.05 *** 0.010) label stats(N r2 bic, labels ("No. of Obs." "R-Squared" "IC" ) fmt(3 0 1))
            
            --------------------------------------------------------------------
                                  WGI_Reg_Pol    WGI_Reg_Econ    WGI_Reg_Inst  
                                 Coef./std.~s    Coef./std.~s    Coef./std.~s  
            --------------------------------------------------------------------
            total aid received     -0.0004318***   -0.0001517*     -0.0000050  
                                       (0.00)          (0.00)          (0.00)  
            total aid received~d    0.0000000***    0.0000000       0.0000000  
                                       (0.00)          (0.00)          (0.00)  
            aid to gdp              1.6721468***    0.6394271***   -0.0131169  
                                       (0.33)          (0.21)          (0.09)  
            aid to gdp squared     -0.6766649***   -0.0088464      -0.0011681  
                                       (0.24)          (0.15)          (0.01)  
            log of gdp per cap~a    0.0264297       0.0244989      -0.1149023***
                                       (0.05)          (0.03)          (0.04)  
            conflict               -0.0731097***    0.0051800      -0.0148974*  
                                       (0.01)          (0.01)          (0.01)  
            trade openness         -0.0061849***   -0.0037040***   -0.0030420***
                                       (0.00)          (0.00)          (0.00)  
            state fragility        -0.0790524***   -0.0386650***   -0.0929026***
                                       (0.01)          (0.01)          (0.01)  
            tax revenue             0.0041419       0.0167141***    0.0061781  
                                       (0.00)          (0.00)          (0.00)  
            log of population      -0.0527843*     -0.0045640      -0.0141230  
                                       (0.03)          (0.02)          (0.03)  
            percentage of urba~n    0.0131181***    0.0093190***    0.0024639  
                                       (0.00)          (0.00)          (0.00)  
            institutional qual~y    0.0087781*      0.0463699***                
                                       (0.01)          (0.00)                  
            _cons                   0.7511241      -3.1358306***    1.9461894***
                                       (0.73)          (0.46)          (0.53)  
            --------------------------------------------------------------------
            No. of Obs.               272.000         272.000         313.000  
            R-Squared                       1               1               1  
            IC                          283.3            32.0           282.2  
            --------------------------------------------------------------------
            
            .
            end of do-file
            Thank you for the starl() CODE and it finally generated output with the stars. Unfortunately, the stars are still not applied correctly, with respect to the 1 (0.01), 5 (0.05), and 10 (0.10) % significance levels. Why isn't STATA reading the star significance levels correctly?

            Comment


            • #7
              It seems fine to me. Why did you think that Stata did not apply correctly? (Note that the values in parentheses are standard errors, not p-values!)

              Ho-Chuan (River) Huang
              Stata 19.0, MP(4)

              Comment


              • #8
                Hi River,

                Thank you for your comment and after too much time spent on this analysis, I recognized that the p values were not included in this table that I wanted to generate. The results, as you suggest, are completely fine! Thank you for the feedback and I'm officially taking a small break

                Thank you again!

                Comment

                Working...
                X