Statalist


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

RE: st: RE: RE: Simulation: marginal effect at the 5th percentile


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: RE: Simulation: marginal effect at the 5th percentile
Date   Wed, 3 Dec 2008 09:28:48 +0100

Line for the server...

As the data management manual says (p. 443, Stata 10), there is no real advantage over -summ, d- for -_pctile-. Mainly, it can compute percentiles other than the standard ones obtainable from -summ, d-. You did not ask for a non-standard one, so -summ, d- may serve you just as well. The manual mentions a slight speed advantage for -_pctile- which results from the fact that -summ,d- calculates redundant (for you) information like standard deviation and mean while all you want is a specific percentile. Particularly in the case where all you want is one percentile, -_pctile- should be better. -set rmsg on- to check for yourself :-)
After -_pctile-, you will find the first percentile requested in -r(r1)- so the returned values are not as intuitively labelled as after -summ, d-. 
On the second issue, do post the code in the immediate vicinity of the problem in your code. 

HTH
Martin

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Supnithadnaporn, Anupit
Sent: Wednesday, December 03, 2008 3:02 AM
To: [email protected]
Subject: Re: st: RE: RE: Simulation: marginal effect at the 5th percentile

Hello all,

----- "Martin Weiss" <[email protected]> wrote: 
> On the occasion of this thread: Is capitalization in the names of
> returned results really advisable? - e(Xmfx_dydx)- may be used less frequently,
> but I remember being bitten by -r(var)- as opposed to -r(Var)- after -sum-.
> What is the benefit of a capitalized "V" here?

Thank you Martin. Your code -loc ap5 = r(p5)- after -sum a, detail- works fine. 
Also, I really appreciate your careful looking at my code and finding about typos
In fact, I got an error from -r(var)- exactly like you just told me. Well, I made all the typos here because I did not copy my code exactly from my program. I try
to simplify and focus on my problem. 

Also, thank you Marrten for your suggestion. I will try out your suggestion
next.

However, Martin, I have a few questions for you, please. Your answer would
help educate me about Stata programming. 

1) For the 2 ways of coding, which one is faster in terms of simulating time.
Also, for the first way, -r(p5)- has a specific reference to the 5th percentile
from the -sum, detail- command, right? When I look at -r(r1)-, how and what
would this refer to?

1st way:  sum a, detail
          loc ap5 = r(p5)

2nd way: _pctile a, p(5)
          loc ap5 = r(r1)

2) I have tried to run your suggested program (copy and paste it in the do and
run). I got an error saying

class system failure
class system failure
class system failure
class system failure
class system failure
class system failure
--more--

I did -set trace on- and see a lot of red characters in many places. Also the
-trace- output seems very long. I am not sure I should post it here.
What would be the problem here? 

Thank you very much,
Anupit

PS I am using Stata SE 9 on Window Vista Home 

*
*   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index