Statalist


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

AW: Rép. : st: AW: Test of the difference in growth rate of two variables


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: Rép. : st: AW: Test of the difference in growth rate of two variables
Date   Fri, 24 Apr 2009 19:55:26 +0200

<> 

Just adapt the example then, I would say: -collapse- is an underappreciated command, from what I observe. I have seen people struggling for prolonged periods of time with problems that -collapse- solves quite easily. And pay very close attention to what Nick said. What I am giving you is the commands and how you can employ them to efficiently take you somewhere, but I cannot vouch for the correctness w.r.t. the issues that Nick brought up...

*************
clear*
set obs 1344

gen number=_n  
expand 5
sort number
egen year=seq(), from(2001) to(2005)

bys number:gen var1=rnormal()+(_n*5)
bys number:gen var2=rnormal()+(_n*10)

collapse (mean) meanvar1=var1 (mean) meanvar2=var2 , by(year)

gen growth1=meanvar1[_n]/meanvar1[_n-1]-1
gen growth2=meanvar2[_n]/meanvar2[_n-1]-1

ttest growth1 == growth2, unpaired unequal welch
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von Herve STOLOWY
Gesendet: Freitag, 24. April 2009 18:51
An: [email protected]
Betreff: Rép. : st: AW: Test of the difference in growth rate of two variables

Dear Martin:

Thank you for your reply. I tried your program and am not sure to
understand the necessity of the -collapse-.

Following on your example, if I do:

clear*
set obs 1344

gen number=_n  
expand 5
sort number
egen year=seq(), from(2001) to(2005)

bys number:gen var1=rnormal()+(_n*5)
bys number:gen var2=rnormal()+(_n*10)

su  var1 if year==2001
su  var1 if year==2002
su  var1 if year==2003
su  var1 if year==2004
su  var1 if year==2005

I see that there is an increase in the mean of var1 (what I call the
growth rate).

If I do the same with var2 

su  var2 if year==2001
su  var2 if year==2002
su  var2 if year==2003
su  var2 if year==2004
su  var2 if year==2005

I will also have a growth rate.

I want to compare  both growth rates.

Best regards

Herve

***********************************************************
Professeur/Professor
President of the French Accounting Association (AFC)
HEC Paris
Departement Comptabilite Controle de gestion / Dept of Accounting and
Management Control
1, rue de la Liberation
78351 - Jouy-en-Josas
France
Tel: +33 1 39 67 94 42 - Fax: +33 1 39 67 70 86
mail: stolowy at hec dot fr
web: http://www.hec.fr/stolowy
>>> "Martin Weiss" <[email protected]> 24/04/09 18:28 >>>

<> 

Maybe like this for the 5 year thing. -ttest- assumes normality,
AFAIK...

*************
clear*
set obs 1344

gen number=_n  
expand 5
sort number
egen year=seq(), from(2001) to(2005)

bys number:gen var1=rnormal()+(_n*5)
bys number:gen var2=rnormal()+(_n*10)

collapse (first) firvar1=var1 (first) firvar2=var2 ///
(last) lavar1=var1 (last) lavar2=var2, by(number)
gen growthvar1= lavar1/ firvar1-1
gen growthvar2= lavar2/ firvar2-1

ttest growthvar1 == growthvar2, unpaired unequal welch
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Herve
STOLOWY
Gesendet: Freitag, 24. April 2009 18:04
An: [email protected]
Betreff: st: Test of the difference in growth rate of two variables

Dear Statalisters:

I have two variables V1 and V2 for 5 years: 2001, 2002, 2003, 2004 and
2005 (in total 1344 observations).

My assumption is that the growth rate of V1 over the period (from 2001
to 2005) is higher than the growth rate of V2.

Do you know a statistical tool to test this difference in growth rates?
I would also like to make this test for several periods (for example
over one year from 2003 to 2004, or over two years, etc.).

Best regards

Hervé Stolowy
*
*   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/

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