Announcement

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

  • mata drop *() wants to hold onto classdef _b_stat()

    I want to drop all of the functions I have created. Unfortunately, somehow a function -- _b_stat() -- that I did not create and which does not show up with

    Code:
    mata desc *()
    nonetheless matches the expression mata drop *(), producing error 310:

    [P] error . . . . . . . . . . . . . . . . . . . . . . . . Return code 310
    not possible because object(s) in use;
    This can occur with mata describe and mata drop and indicates
    that the objects referred to cannot be described or eliminated
    because an earlier iteration of Mata is currently using them.
    I ran an nbreg earlier in the code, so I'm guessing that's where _b_stat() comes from. Is there some way I can make _b_stat() eligible for dropping? I've tried killing the nbreg results with ereturn clear to no effect.


    By the way, my reason for dropping my functions is paranoia. Earlier, when I dropped an asarray/struct that I no longer needed, it sped up the slowest part of my code by a factor of 20. Currently, I'm facing a similar problem: it takes 20 minutes to perform an operation the first time I try it (in the full context of the do file); but if I open a new session and mata matuse the exact same objects used by my do file, it runs in 20 seconds. My Stata data is empty in both cases.


    This is related to a thread on the soon-to-be-deleted mailing list/forum, reproduced below. Apparently, Mr Jeanty found a solution, but it's not included with his message. Sorry about the formatting; the new Statalist doesn't like the old Statalist's line breaks, I guess.
    st: RE: anketest r(310)


    From "P. Wilner Jeanty" <[email protected]>
    To [email protected]
    Subject st: RE: anketest r(310)
    Date Wed, 11 Jan 2012 14:38:41 -0600


    On Tue, Jan 10, 2012 at 11:17 AM, Jane Harrison <[email protected]> wrote: >> To test for spatial autocorrelation in the residuals, I typed: >> >> anketest, wn(merge2) wf(Stata) model(iv-sar) // test for spatial autocorrelation in the residuals >> >> I then received the following error message: >> >> classdef _b_stat() in use >> (nothing dropped) >> (160 lines skipped) >> >> (error occurred while loading anketest.ado) >> >> r(310); >> end of do-file >> >> Here is a description of r(310): > >> [P] error . . . . . . . . . . . . . . . . . . . . . . . . Return code 310 >> not possible because object(s) in use; >> This can occur with mata describe and mata drop and indicates >> that the objects referred to cannot be described or eliminated >> because an earlier iteration of Mata is currently using them. >> >> Any ideas on what this means and how to fix it? >> >> Thanks, >> Jane >> >> >> >> -- >> Jane L. Harrison, PhD Candidate >> Forest Social Science, Oregon State University >> [email protected] I have pinned down the problem. A new version of -anketest- that fixes the issue will be made available for download shortly. But, in the meantime, Jane can check with me off-list for a quick solution. Regards, Wilner ________________________________ P. Wilner Jeanty, PhD Rice University, Houston, Texas Phone: (713) 348-3114 Email: [email protected]

  • #2
    Follow-up: While mata desc *() shows my two remaining functions,
    Code:
    : mata mlib create liberte
    : mata mlib add liberte *()
    (375 functions added)
    I'm wondering where these 373 other functions came from and whether they are to blame for the speed difference I've run into... My guess is that *(), in addition to matching the indomitable _b_stats() also matches everything in the libraries listed by mata mlib index. (Edit: This does seem to be the case.)

    It looks like this was asked a year ago and recognized as a bug: http://www.statalist.org/forums/foru...rtual-function The recommendation in that thread was to use mata clear, which isn't so appealing.
    Last edited by Frank Erickson; 21 Apr 2015, 14:52.

    Comment

    Working...
    X