Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: question about xtivreg2


From   "AbdelRahmen El Lahga" <[email protected]>
To   <[email protected]>
Subject   st: question about xtivreg2
Date   Tue, 14 Feb 2006 20:23:41 +0100

I have a panel data in which each household is observed 3 times a minimum.
such selection is made with the command:
bys hhid: keep if _N>2 and I checked the result with the comand xtdes.
But when I use xtivreg2...
Stata print the following warning:
Warning - singleton groups detected.  1982 observation(s) not used.
I don't understand why such problem.
thank you
AbdelRahmen El Lahga
----- Original Message -----
From: "Joseph Coveney" <[email protected]>
To: "Statalist" <[email protected]>
Sent: Tuesday, February 07, 2006 9:06 AM
Subject: Re: RE: st: conceptual question regarding -egen-


> Daniel Waxman wrote:
>
> Thanks much for the reply.  There is much to learn...
>
> Anyway, I'd imagine that there is little difference in overhead between
> using -sum- in this way and creating and then dropping a temporary
variable.
> I should get over the frugality issues.
>
> --------------------------------------------------------------------------
------
>
> I believe that the difference in overhead will depend how big the dataset
is
> and how often you need to perform the calculation.  For 1 000 000
> observations, single precision, it seems to be a matter of 10-20 seconds
for
> a single iteration on a recent-vintage piece of equipment.
>
> For larger datasets, higher precision and many iterations, the time saving
> might make -summarize , meanonly- pay.
>
> Joseph Coveney
>
> . clear
>
> . set more off
>
> . quietly set memory 500M
>
> . quietly set obs `=1e6'
>
> . set seed `=date("2006-02-07", "ymd")'
>
> . generate float p_pred_mort = uniform()
>
> . generate float p_act_mort = uniform()
>
> . *
> . program define use_egen, rclass
>   1.     tempvar maxmort predmort
>   2.     egen float `maxmort' = max(p_pred_mort)
>   3.     egen float `predmort' = max(p_act_mort)
>   4.     return scalar maxmax = max(`maxmort', `predmort')
>   5.     drop `maxmort' `predmort'  // Does omitting this save time?
>   6. end
>
> . *
> . program define use_summarize, rclass
>   1.     tempname maxpred
>   2.     summarize p_pred_mort, meanonly
>   3.     scalar `maxpred' = r(max)
>   4.     summarize p_act_mort, meanonly
>   5.     return scalar maxmax = max(scalar(`maxpred'), r(max))
>   6.     scalar drop `maxpred'
>   7. end
>
> . *
> . set rmsg on
> r; t=0.00 16:57:31
>
> . use_egen
> r; t=15.47 16:57:46
>
> . use_summarize
> r; t=0.22 16:57:47
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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