Announcement

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

  • Last Estimates Not Found Error

    Hello everyone.

    I'm a new-ish Stata (v18) user... about 6 months now. I'm getting a "last estimates not found" error, when adding parameters to a Manova. The only thing recently changed in my dataset was the addition of a calculated variable (CapSt), which uses two other variables in the dataset.

    1) My code: by Year, sort: manova Currentratio Dayscashonhand Excessmargin CapSt = HospType - this code runs just fine, but when I add If statements,

    2) With If: by Year, sort: manova Currentratio Dayscashonhand Excessmargin CapSt = HospType if HospType==2 - I get the error.

    I've seen comments that say an estimation command should be run first, so I ran an xtmixed command for HospType and Year, and that ran just fine (my code: by HospType Year, sort: xtmixed Currentratio Dayscashonhand Excessmargin CapSt)

    ***The dataset contains approximately 52,000 observations, for 12 hospital types, across a 5-yer timeframe.
    ***My desired results would actually show Manova by Hospital type for each year.
    ***My intended post-hoc would actually show Tukey by Hospital type for each year.

    Thanks in advance for your comments/help/feedback.
    Cassandra.

  • #2
    Originally posted by Cassandra Henson View Post

    2) With If: by Year, sort: manova Currentratio Dayscashonhand Excessmargin CapSt = HospType if HospType==2 - I get the error.
    This "last estimates not found" error would be consistent with running a post-hoc test without having first run the estimation command, rather than resulting from the estimation command with the -if- restriction included. Please copy and paste the exact sequence of executed commands and the resulting output (from the Results window) before and up to the error message. Post these here, within CODE delimiters.

    Comment


    • #3
      Hello Andrew. Would the 'xtmixed' command not qualify as an estimation command? I believe it does, and that ran fine. My exact commands are written in my comment: "by HospType Year, sort: xtmixed Currentratio Dayscashonhand Excessmargin CapSt"; then: "by Year, sort: manova Currentratio Dayscashonhand" Excessmargin CapSt = HospType if HospType==2". Output is too large to post here...

      Comment


      • #4
        Wait, are you sure your manova command is working fine? Wouldn't it have collinearity with the constant, since you are conditioning on just one value of HospType? Perhaps you should include the option noconstant.

        Comment


        • #5
          The following replicates your data setup. Without Hemanshu Kumar's suggestion of adding -no cons-, the full error message is

          failure for model term HospType
          last estimates not found
          r(301);
          Otherwise, the following runs (note that xtmixed is superseded by mixed):

          Code:
          set seed 03072025
          set obs 52000
          gen  HospType= runiformint(1, 12)
          foreach varname in Currentratio Dayscashonhand Excessmargin CapSt{
              gen `varname'= rnormal()
          }
          bysort HospType: gen Year=runiformint(2020, 2024)
          xtset  HospType
          
          by HospType Year, sort: mixed Currentratio Dayscashonhand Excessmargin CapSt
          by Year, sort: manova Currentratio Dayscashonhand Excessmargin CapSt = HospType if HospType==2, nocons
          Res.:

          Code:
          . by Year, sort: manova Currentratio Dayscashonhand Excessmargin CapSt = HospType if HospType==2, nocons
          
          ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          -> Year = 2020
          
                                 Number of obs =        863
          
                                 W = Wilks' lambda      L = Lawley-Hotelling trace
                                 P = Pillai's trace     R = Roy's largest root
          
                        Source | Statistic        df    F(df1,     df2) =   F   Prob>F
                    -----------+-------------------------------------------------------
                      HospType |W   0.9984         1      4.0    859.0     0.35 0.8411 e
                               |P   0.0016                4.0    859.0     0.35 0.8411 e
                               |L   0.0016                4.0    859.0     0.35 0.8411 e
                               |R   0.0016                4.0    859.0     0.35 0.8411 e
                               |-------------------------------------------------------
                      Residual |                 862
                    -----------+-------------------------------------------------------
                         Total |                 863
                    -------------------------------------------------------------------
                                 e = exact, a = approximate, u = upper bound on F
          
          ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          -> Year = 2021
          
                                 Number of obs =        857
          
                                 W = Wilks' lambda      L = Lawley-Hotelling trace
                                 P = Pillai's trace     R = Roy's largest root
          
                        Source | Statistic        df    F(df1,     df2) =   F   Prob>F
                    -----------+-------------------------------------------------------
                      HospType |W   0.9984         1      4.0    853.0     0.34 0.8544 e
                               |P   0.0016                4.0    853.0     0.34 0.8544 e
                               |L   0.0016                4.0    853.0     0.34 0.8544 e
                               |R   0.0016                4.0    853.0     0.34 0.8544 e
                               |-------------------------------------------------------
                      Residual |                 856
                    -----------+-------------------------------------------------------
                         Total |                 857
                    -------------------------------------------------------------------
                                 e = exact, a = approximate, u = upper bound on F
          
          ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          -> Year = 2022
          
                                 Number of obs =        849
          
                                 W = Wilks' lambda      L = Lawley-Hotelling trace
                                 P = Pillai's trace     R = Roy's largest root
          
                        Source | Statistic        df    F(df1,     df2) =   F   Prob>F
                    -----------+-------------------------------------------------------
                      HospType |W   0.9943         1      4.0    845.0     1.22 0.3016 e
                               |P   0.0057                4.0    845.0     1.22 0.3016 e
                               |L   0.0058                4.0    845.0     1.22 0.3016 e
                               |R   0.0058                4.0    845.0     1.22 0.3016 e
                               |-------------------------------------------------------
                      Residual |                 848
                    -----------+-------------------------------------------------------
                         Total |                 849
                    -------------------------------------------------------------------
                                 e = exact, a = approximate, u = upper bound on F
          
          ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          -> Year = 2023
          
                                 Number of obs =        897
          
                                 W = Wilks' lambda      L = Lawley-Hotelling trace
                                 P = Pillai's trace     R = Roy's largest root
          
                        Source | Statistic        df    F(df1,     df2) =   F   Prob>F
                    -----------+-------------------------------------------------------
                      HospType |W   0.9948         1      4.0    893.0     1.17 0.3204 e
                               |P   0.0052                4.0    893.0     1.17 0.3204 e
                               |L   0.0053                4.0    893.0     1.17 0.3204 e
                               |R   0.0053                4.0    893.0     1.17 0.3204 e
                               |-------------------------------------------------------
                      Residual |                 896
                    -----------+-------------------------------------------------------
                         Total |                 897
                    -------------------------------------------------------------------
                                 e = exact, a = approximate, u = upper bound on F
          
          ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          -> Year = 2024
          
                                 Number of obs =        865
          
                                 W = Wilks' lambda      L = Lawley-Hotelling trace
                                 P = Pillai's trace     R = Roy's largest root
          
                        Source | Statistic        df    F(df1,     df2) =   F   Prob>F
                    -----------+-------------------------------------------------------
                      HospType |W   0.9883         1      4.0    861.0     2.55 0.0380 e
                               |P   0.0117                4.0    861.0     2.55 0.0380 e
                               |L   0.0118                4.0    861.0     2.55 0.0380 e
                               |R   0.0118                4.0    861.0     2.55 0.0380 e
                               |-------------------------------------------------------
                      Residual |                 864
                    -----------+-------------------------------------------------------
                         Total |                 865
                    -------------------------------------------------------------------
                                 e = exact, a = approximate, u = upper bound on F
          
          .

          Comment

          Working...
          X