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: ereturn post, obs(#) - does the # in obs() option have a size limit?


From   Sergiy Radyakin <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: ereturn post, obs(#) - does the # in obs() option have a size limit?
Date   Thu, 20 Feb 2014 17:23:37 -0500

Dear Joseph,

I confirm the problem also in Stata 13.0.

Furthermore, if you set obs to 1000001 it is working again. It seems
that somewhere inside obs() it is checking for the number to be of
type long, and does not recognize all the numbers above a certain
threshold. (E.g. if the value of 10^6 is internally something like
1000000.0000000023 see posts on precision).

Value e.g. 1999990000 is possible to pass back, but 2999990000 no. The
exact max should be 2,147,483,647
See: help limits

But apparently as you discovered not all values from this range are accepted.

I tried to apply floor() to the argument, but to no effect.
Seems like a bug, but it doesn't seem to affect the internal
(built-in) Stata's estimation commands (tried regress on a 1mln
dataset), presumably the check is engaged only when the nobs() is set
by the user, and Stata trusts its own commands will never supply a
wrong (non-integer) value for nobs.

Best, Sergiy Radyakin

On Thu, Feb 20, 2014 at 4:34 PM, Joseph Luchman <[email protected]> wrote:
> Hi Statalist,
>
>   I've been working with this problem for some time now, I'm at an
> impasse and am beginning to wonder if it is a problem with the obs(#)
> option of ereturn post itself - but I thought I'd try posting to the
> list to make sure it's not something I'm overlooking that is producing
> this behavior.
>
>   To summarize, it seems that the obs(#) option of ereturn post
> returns missing values for numbers of observations that are too high
> (e.g., one million).  The same problem doesn't seem to affect
> separating out the scalar though.
>
>   I should note that I'm running Stata version 12.1.
>
>   Representative issue is covered below in the example syntax below:
>
> version 12.1
>
> program define count_then_post1, eclass
> count
> ereturn post , obs(`=r(N)')
> end
>
> program define count_then_post2, eclass
> count
> ereturn scalar N = `=r(N)'
> end
>
> set obs 100
>
> count_then_post1
>
> ereturn list //result here is e(N) = 100
>
> count_then_post2
>
> ereturn list //result here is e(N) = 100
>
> clear
>
> set obs 1000000
>
> count_then_post1
>
> ereturn list //result here is missing
>
> count_then_post2
>
> ereturn list //result here is e(N) = 1000000
>
> - joe
>
> Joseph Nicholas Luchman, Ph.D.
> ----
> Behavioral Statistics Lead | Fors Marsh Group
> Email: [email protected]
> forsmarshgroup.com
> https://www.researchgate.net/profile/Joseph_Luchman/
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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