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: Different results with the same code
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Different results with the same code
Date
Mon, 10 Feb 2014 09:41:26 +0000
Contrary to your claim, I would point at this:
Which values are (firstnm) is likely to depend on the exact sort order
of your data and you are sorting before you -collapse-.
As Phil Schumm often explains, you could get consistent results by
insisting on stable sorting, but that would be hiding a bug. There's
evidently some arbitrariness that is better fixed directly.
Nick
[email protected]
On 10 February 2014 09:07, Estrella Gomez <[email protected]> wrote:
> Dear Statalisters
>
> I am running a code and I have realized that every time I run it the
> results (the coefficients and the standard errors) are different. This
> is the code:
>
> clear all
> use "itunes_grav_song", clear
> sort id country orig
>
> egen nb_id=tag(id)
> bysort orig: egen nr_orig=sum(nb_id)
> bysort orig country: egen nr_dest=sum(available)
> gen avail_share=(nr_dest/nr_orig)
> collapse (count) nr_songs=id (firstnm) contig comlang ldist
> avail_share, by(country orig)
> encode country, gen(d_id)
> encode orig, gen(o_id)
> gen home=country==orig
>
> reg avail_share ldist comlang home i.d_id i.o_id
>
>
> I have checked and after the collapse I obtain every time the same
> dataset, so I don't know what can be the reason
>
> Thanks for any help!
> Estrella
> *
> * 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/