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: Question about generating the weight of WLS
From
[email protected]
To
[email protected]
Subject
Re: st: Question about generating the weight of WLS
Date
Thu, 25 Apr 2013 08:12:35 -0400
Many thanks Nick. I going to try it and come back to you
You made my day
--
Ayi Gavriel Ayayi; Ph.D.
Professor of Financial Economics
Editors of AEFR, AFJ, EFR and IJEMS
Département des Sciences de la Gestion
Université du Québec
3351 Boulevard des Forges C.P 500
Trois Rivières, Québec, G9A 5H7 Canada
E-mail: [email protected]
Some of my recent papers at: http://ssrn.com/author=301328
Tel: (1) 819 376-5011 ext 3137
Nick Cox <[email protected]> a écrit :
This is a common kind of question in data management, so you should
expect that -search- will turn up resources. Even if the keyword to
use in -search- is not evident, browsing the data management FAQs
reveals
FAQ . . . . . . . . . . . . . . . . . . . Number of distinct
observations
. . . . . . . . . . . . . . . . . . . . . . . N. J. Cox and
G. Longton
4/02 How do I compute the number of distinct observations?
http://www.stata.com/support/faqs/data-management/number-of-distinct-observations/
A general survey of counting distinct values is given in
SJ-8-4 dm0042 . . . . . . . . . . . . Speaking Stata: Distinct
observations
(help distinct if installed) . . . . . . N. J. Cox and G.
M. Longton
Q4/08 SJ 8(4):557--568
shows how to answer questions about distinct observations
from first principles; provides a convenience command
A .pdf is accessible at
http://www.stata-journal.com/sjpdf.html?articlenum=dm0042
Those surveys show several ways to approach this. Here is one:
egen tag = tag(country mfi year)
egen ndistinct = total(tag), by(country year)
In fact your example data suggest that
bysort country year : gen ndistinct2 = _N
would work too, but the first method is more general, just in case
there is a good reason for duplicates.
After that you just feed that variable within an expression for
weights to -regress-.
Nick
[email protected]
On 25 April 2013 11:37, <[email protected]> wrote:
- I have stata IC 10
-I have a panel data. To take in to consideration the considerable variation
of the MFIs (microfinance institutions) across countries on the empirical
results, I resort to a weighted least squares with the weight being the
inverse of the number of MFIs for the country in the database in a given
year.
Can someone help me on how to generate the inverse of the number of MFIs for
the country in the database in a given year and how to handle this WLS.
Please find below an example of the data
Thanks for your time and consideration
year mfi country
2004 AFS Afghanistan
2004 BRAC - AFG Afghanistan
2004 FINCA - AFG Afghanistan
2004 FMFB - AFG Afghanistan
2005 AFS Afghanistan
2005 BRAC - AFG Afghanistan
2005 CFA Afghanistan
2005 FINCA - AFG Afghanistan
2005 FMFB - AFG Afghanistan
2005 MADRAC Afghanistan
2004 ASC Union Albania
2004 BESA Albania
2004 FAF-DC Albania
2004 NOA - ALB Albania
2005 ASC Union Albania
2005 BESA Albania
2005 FAF-DC Albania
2005 NOA - ALB Albania
2004 BMM C rdoba Argentina
2004 Emprenda Argentina
2004 Entre Todos Argentina
2004 FIE Gran Poder Argentina
2004 Grameen Chaco Argentina
2005 Alternativa 3 Argentina
2005 BMM C? rdoba Argentina
2005 Emprenda Argentina
2005 Entre Todos Argentina
2005 FIE Gran Poder Argentina
2005 Grameen Chaco Argentina
*
* 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/
-------------------------------------------------
Courriel expédié via https://courriel.uqtr.ca
*
* 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/