Announcement

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

  • Problem with glst command - cannot open a transformed .dta file

    Hi,

    I am currently trying to complete the analysis for a dose-response meta-analysis using the glst command downloaded from SSC in Stata 13 using Windows 8.
    I have written a do file with the required code and in the past have used ot without any problem on my current dataset.

    After 2 months of not having run the file, I have over the past week tried to add more data to my dataset and I am no longer able to fully execute the commands.

    Has somebody experienced any siilar issues with this command or may have any insight as to why suddenly the command may no longer working correctly?

    Full details:

    I have transformed my exposure variables using cubic splines. I try to save these transformed variables in a temporary file however as soon as I reach this step I get an error message stating:
    file ssest_spline.dta could not be opened
    r(603);

    From this point onwards I am no longer able to proceed. I am clueless as to what I might be doing wrong and would appreciate any advice that anybody may have.

    I have attched tha code that I am using below.

    Code:
    gen logrr = log(rr)
    gen loguci = log(uci)
    gen loglci = log(lci)
    gen logse = ((loguci - loglci)/(2*invnorm(.975)))
    
    bysort id: gen dosec = dose - dose[1]
    mkspline doses = dose, nk(3) cubic
    
    **This is the step where the problem appears to be and I get the error message:
    mvmeta_make glst logrr doses1 doses2, cov(totalpersons cases) se(logse) pfirst(id study) saving(ssest_spline) replace  by(id)  names(b V)
    
    (note: file ssest_spline.dta not found)
    file ssest_spline.dta could not be opened
    r(603);
    
    preserve
    use ssest_spline, clear
    mvmeta b V  , mm   i2
    capture estimates save mvmeta,   replace
    restore 
    
    estimates use mvmeta 
    predictnl logrr_sp = _b[bdoses1]*(doses1) + _b[bdoses2]*(doses2-0) , ci(los his)
    gen ors = exp(logrr_sp) 
    gen lbs = exp(los)
    gen ubs = exp(his)
    predictnl logrr_l  = _b[dose]*dose
    gen orl  = exp(logrr_l)
    
    twoway (line orl dose, sort  lc(green) lw(thick) lp(-) ) (line ors lbs ubs  dose, sort lw(thick medium medium) lc(orange black black) lp(l longdash longdash)) ,ytitle("Relative Risk") xtitle("LTPA Physical Activity (MET-h's/week)") scheme(s1mono)xlabel(0(5)60) xmtick(0(5)60) ymtick(.1(.3)1) ylabel(.1 .2 .3 .4 .5 .6 .7 .8 .9 1 , format(%3.2fc) angle(horiz)) legend(label(1 "Linear Model")  label(2 "Cubic Spline Model") order(1 2) ring(0) pos(20) col(1) ) plotregion(style(none))
    I hope I have specified everything that might be useful to understand what is going wrong!

    Thank you!

  • #2
    This is *maybe* moot, but have you tried "cd somedirectory" at the beginning, or tried fully specifying the path in the -saving()- option and -use- command? By default, under Windows 8, I think it will use "c:\users\username\my documents" which should be writable. But if there is something unusual about your environment, it may be trying to save to a folder that it doesn't have write permissions on. Besides, being specific about where it should store files, even temporary files, is a good idea for staying organized.
    Last edited by ben earnhart; 12 Oct 2014, 19:22. Reason: typo

    Comment


    • #3
      Thanks Ben!

      That was really useful. I have managed so far to get the first temp file (ssest_spline.dta) to save/open by changing my working directory. However, you seem to understand how Stata thinks in terms of accessing and working with such temp files so I hope you don't mind if I hit you with a follow-up question: The issues is that now the second file (mvmeta.ster) is refusing to be found.
      I'm guessing this might still be some kind of issue related to not fully being able to write/save in the specific folder I have now specified. Or do you have any insight as to why the first file appears to be saved/accessible now but the second one wouldn't? That doesn't make much sense to me!

      Code:
      gen logrr = log(rr)
      gen loguci = log(uci)
      gen loglci = log(lci)
      gen logse = ((loguci - loglci)/(2*invnorm(.975)))
       
      bysort id: gen dosec = dose - dose[1]
      mkspline doses = dose, nk(3) cubic
      mvmeta_make glst logrr doses1 doses2, cov(totalpersons cases) se(logse) pfirst(id study) saving(ssest_spline) replace  by(id)  names(b V)
       
      preserve
      use ssest_spline, clear
      mvmeta b V  , mm   i2
      capture estimates save mvmeta,   replace
      restore
       
      **This is now the the step where the problem appears to be:
      estimates use mvmeta
       
      file mvmeta.ster not found
      r(601);
        
      predictnl logrr_sp = _b[bdoses1]*(doses1) + _b[bdoses2]*(doses2-0) , ci(los his)
      gen ors = exp(logrr_sp)
      gen lbs = exp(los)
      gen ubs = exp(his)
      predictnl logrr_l  = _b[dose]*dose
      gen orl  = exp(logrr_l)
       
      twoway (line orl dose, sort  lc(green) lw(thick) lp(-) ) (line ors lbs ubs  dose, sort lw(thick medium medium) lc(orange black black) lp(l longdash longdash)) ,ytitle("Relative Risk") xtitle("LTPA Physical Activity (MET-h's/week)") scheme(s1mono)xlabel(0(5)60) xmtick(0(5)60) ymtick(.1(.3)1) ylabel(.1 .2 .3 .4 .5 .6 .7 .8 .9 1 , format(%3.2fc) angle(horiz)) legend(label(1 "Linear Model")  label(2 "Cubic Spline Model") order(1 2) ring(0) pos(20) col(1) ) plotregion(style(none))
      Any feedback (from anyone) would be very welcome!

      Comment


      • #4
        dominica:

        I'd spell out your Stata version. The ability to save .ster files was introduced not so long ago.

        Comment


        • #5
          I'm using Stata 13.1, if that is of any help in solving this!

          Comment


          • #6
            It rules out the idea that your Stata is too old to do what you want.

            Comment


            • #7
              Hmm... it didn't complain about not being able to save the file, so it's not a permissions issue. a "cd" command at the beginning *should* make sure the file is stored where you expect it, but you might try either searching your hard drive for any files ending in "*.ster" to see if it's going elsewhere for some strange reason. Could fully specify the path in the -estimates save- and -estimates use- commands, though I don't see why you should have to.

              Also, wouldn't hurt to include your full output with results (if it's not too long) so we can see any warnings or whatever.

              Aha! Remove the "capture"from "capture estimates save" and re-run it. I strongly suspect that it's still having some sort of problem saving the file, just that "capture" hides it.

              Comment


              • #8
                As suggested, I just re-ran the analysis but removed the "capture"from "capture estimates save".

                Stata now returns:

                Code:
                .
                estimates save mvmeta,   replace
                last estimates not found
                r(301);
                This indicates that it is still not correctly saving the file, I suppose?

                I could post the whole output but I am afraid that it is very lengthy! Do let me know if you really do want want to see the entire thing.

                Also, I would be keen to try out your suggestion of specifying the path in the -estimates save- and -estimates use- commands but I am not familiar with how to do this. Any tips?

                Thanks!

                Comment


                • #9
                  How about showing us the results (exactly as Stata returns them) of:
                  Code:
                  use ssest_spline, clear
                  which mvmeta
                  mvmeta b V  , mm   i2
                  ereturn list                                // what estimates are actually being left behind
                  estimates save myestimates, replace  // is it the name that's the problem?
                  estimates save mvmeta,   replace

                  Comment


                  • #10
                    Here is what Stata returns upon running your suggested code:

                    Code:
                    . use ssest_spline, clear
                    
                    . which mvmeta
                    c:\ado\plus\m\mvmeta.ado
                    *! version 0.15  Ian White 8Aug2008
                    
                    . mvmeta b V  , mm   i2
                    Note: using method mm (truncated)
                    Note: using variables bdoses1 bdoses2
                    Note: 21 observations on 2 variables
                    ------------------------------------------------------------------------------
                                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                         bdoses1 |  -.0175704    .004502    -3.90   0.000    -.0263942   -.0087467
                         bdoses2 |   .0399208   .0123964     3.22   0.001     .0156243    .0642173
                    ------------------------------------------------------------------------------
                    
                    Estimated between-studies SDs and correlation matrix:
                                    SD    bdoses1    bdoses2
                    bdoses1   .0168478          1         -1
                    bdoses2  .04624141         -1          1
                    
                    . ereturn list
                    
                    scalars:
                                      e(N) =  21
                    
                    macros:
                             e(properties) : "b V"
                    
                    matrices:
                                      e(b) :  1 x 2
                                      e(V) :  2 x 2
                               e(Sigma_SD) :  2 x 1
                             e(Sigma_corr) :  2 x 2
                                  e(Sigma) :  2 x 2
                                     e(Mu) :  1 x 2
                    
                    . estimates save myestimates, replace
                    last estimates not found
                    r(301);
                    
                    . estimates save mvmeta,   replace
                    last estimates not found
                    r(301);

                    Comment


                    • #11
                      Now that is really strange, and it not finding estimates to save (when it clearly has estimates in memory) is something maybe worthy of invoking official Stata support people.

                      To fully specify a path, it would be something like the command below, but given that it can't find estimates to save, probably moot.

                      estimates save c:\users\username\documents\importantproject\mvmet a, replace
                      Last edited by ben earnhart; 16 Oct 2014, 09:17. Reason: extraneous space

                      Comment


                      • #12
                        giving this one a "bump" to keep it in the first page, because it is an interesting, unresolved case. Estimates are there via ereturn, bur don't save to a file. Huh.

                        Comment


                        • #13
                          Unfortunately, it appears your hunch was correct. Specifying the path did not solve the issue.
                          Stata still returns the following error message:

                          last estimates not found
                          r(301);

                          Comment


                          • #14
                            I suppose it might be time to call Stata technical support. I've never had to, myself (StataList, Google, or sleeping on a problem and attacking it the next day have always worked for me), but your situation is mysterious. It clearly has estimates, but -estimates save- can't find them. If you do call and get help, please post back what the solution was, since I'm really, really curious about this phenomenon.

                            Comment


                            • #15
                              I will definitely get back to you once I hear back from the Stata support team. Your help has been really useful in identifying what exactly is wrong and I think that will be vital in solving the problem. Once again, thanks!

                              Comment

                              Working...
                              X