Announcement

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

  • -ereturn repost, resize- displays "resize option not allowed"

    Dear Statalist.

    I am trying to add a 0 to my coefficient vector and variance matrix using -ereturn repost-:

    Code:
    clear
    version 15.1
    
    sysuse auto, clear
    
    reg price mpg
    
    * Defines eclass program to repost
    cap program drop myrepost
    program define myrepost, eclass
        mat ob=e(b)
        * Add a 0 to b
        mat badd=0
        mat colnames badd= `1'
        mat bb = [ob,badd]
        * Add a 0 to V
        mat VV = e(V)
        mat addcol = J(rowsof(VV),1,0)
        mat colnames addcol = `1'
        mat VV = [VV,addcol]
        mat addrow = J(1,colsof(VV),0)
        mat rownames addrow = `1'
        mat VV = [VV \ addrow]
        * Repost
        ereturn repost b=bb V=VV, resize rename
    end
    
    myrepost newcoef
    When I try this, I get:

    Code:
    option resize not allowed
    r(198);
    This works with -ereturn post-, and -ereturn repost, resize- is a documented option. Any thoughts on why the resize option fails?

    I am on Stata 15.1 06 Jun 2018 on Windows 8.1 Enterprise.

    Thank you,
    Jorge Eduardo Pérez Pérez
    www.jorgeperezperez.com

  • #2
    I don't if this will help you in your case or why it fails with regress, but -resize- does work following -glm-
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . qui glm price mpg
    
    . myrepost newcoef
    
    . mat list e(b)
    
    e(b)[1,3]
             price:      price:            
               mpg       _cons     newcoef
    y1  -238.89435   11253.061           0
    
    . mat list e(V)
    
    symmetric e(V)[3,3]
                      price:      price:            
                        mpg       _cons     newcoef
      price:mpg   2817.1347
    price:_cons  -59997.356   1370802.5
        newcoef           0           0           0

    Comment


    • #3
      Thank you, this is helpful. It seems that the -resize- option only works after commands that put equation names in the coefficient matrix (e.g. glm, poisson), but not after -regress- which leaves the equation names empty. This looks like a bug, I'll get in touch with tech support.

      Jorge Eduardo Pérez Pérez
      www.jorgeperezperez.com

      Comment


      • #4
        Here's the answer from tech support, in case it is useful for someone else.

        -ereturn repost- with -resize- is not allowed after -regress- because the computation of some other statistics depends on the size of e(b).
        You can use

        ereturn post bb VV,noclear

        instead of

        ereturn repost b=bb V=VV, resize rename

        to post results to e(b) and e(V). -noclear- is a undocumented option that will keep other e-results after this. However, some post-estimations of -regress- will be disabled.
        Jorge Eduardo Pérez Pérez
        www.jorgeperezperez.com

        Comment


        • #5
          Thanks Jorge for posting what Stata tech support told you. I wouldn't have been able to move forward on my project without knowing about this undocumented option!

          Comment

          Working...
          X