Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: running marginsplots without rerunning margins again


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: running marginsplots without rerunning margins again
Date   Thu, 11 Aug 2011 14:14:20 +0100

The underscore _ doesn't do anything special. It's just a legal
character that is part of the command name.

There is a StataCorp convention that commands intended mostly or
entirely for below-the-surface use often start with "_", but I think
that is as much as could be said. See -help undocumented- for some. By
the way, "undocumented" in Stata has a Pickwickian meaning of
"undocumented _in the manuals_". What you need to worry about, except
that you don't, is the commands that are not documented.

But anyone could write a program or do file with underscore _
somewhere in the name, so long as it didn't duplicate a name already
used by StataCorp, but that's as usual.

The colon flags the end of a command prefix, and there are lots of
them. You are probably already familiar with -by:-, for example, but
are not recognising an old friend in a new context.

Nick

On Thu, Aug 11, 2011 at 2:02 PM, Doug Hess <[email protected]> wrote:
> Thanks to Richard and Scott. Scott's suggestion worked
> perfectly...once I figured out that "foo" wasn't a command
> abbreviation.
>
> I'm not familiar with starting a command with the underscore (as in -
> _retrun hold foo  - ), what is that underscore doing?
>
> Likewise, I'm not familar with the colon after a command line (as in -
> estimates esample: - ), what does that colon do there?
>
> Thanks again.
>
> -Doug
>
> Date: Wed, 10 Aug 2011 21:12:57 -0500
> From: Scott Merryman <[email protected]>
> Subject: Re: st: running marginsplots without rerunning margins again
>
> It looks like you to save the contents of r() as well.
>
> clear*
> webuse nhanes2
> regress bpsystol agegrp##sex
> estimates save foo,replace
> margins agegrp
> _return hold foo
>
> //other stuff
> sysuse auto ,clear
> regress price i.rep
> margins rep
>
> //return to marginsplot
> webuse nhanes2,clear
> est use foo
> estimates esample:
> _return restore foo
> marginsplot
>
>
> Scott
>
> On Wed, Aug 10, 2011 at 10:03 PM, Richard Williams
> <[email protected]> wrote:
>
>> I thought it would simply be a matter of using the -post- option of margins
>> and the -est store- and -est restore- commands. To my surprise, though, the
>> following produces an error at the end:
>>
>> clear all
>> sysuse auto
>> reg  price mpg i.foreign
>> margins foreign, post
>> est store margins1
>> marginsplot
>> reg  price mpg i.foreign  weight
>> est restore margins1
>> margins
>> marginsplot
>>
>> The error is "previous command was not margins." But if you do -ereturn
>> list-, it does say the last command was -margins-. I am surprised it doesn't
>> work, and I wonder if this is a bug or if there is some good reason for
>> this.
>>
>
>>> At 08:10 PM 8/10/2011, Doug Hess wrote:
>>>
>>> I just installed Stata 12 and am playing with the "marginsplot"
>>> command. I am wondering how to run margins plot on a restored margins?
>>> Can it? Complex margins commands can take a long time to run. Is there
>>> a way to restore or use saved results from a complex running of
>>> margins so that I can fiddle with the graph later?
>>>
>>> Come to think of it, how do I redisplay results from a margins command
>>> after "restoring" a stored file or "using" a saved file. For
>>> regression estimates you just type regress and it shows it. How is
>>> this done for other saved files.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index