Dear Statalisters:
I use -tabodds- to compute two ratios (cases/controls) (20/13 and 22/11 in the example below) and test the evolution of these ratios (see the output below).
tabodds small_profit post_ifrs if country=="AUS" & sample_sum==1
--------------------------------------------------------------------------
post_ifrs | cases controls odds [95% Conf. Interval]
------------+-------------------------------------------------------------
0 | 20 13 1.53846 0.76531 3.09270
1 | 22 11 2.00000 0.96985 4.12436
--------------------------------------------------------------------------
Test of homogeneity (equal odds): chi2(1) = 0.26
Pr>chi2 = 0.6115
Score test for trend of odds: chi2(1) = 0.26
Pr>chi2 = 0.6115
I would like to define the ratios in a different way:
Instead of cases/controls, I would like to have:
(cases-controls)/(cases+controls).
With the -matrix- command and scalars, I manage to get the ratios:
count if post_ifrs==0 & small_profit==1 & country=="AUS" & sample_sum==1
scalar N1 = r(N)
count if post_ifrs==0 & small_profit==0 & country=="AUS" & sample_sum==1
scalar N2 = r(N)
scalar odds=(N1-N2)/(N1+N2)
matrix m1 = N1, N2, odds
matrix rownames m1 = "Pre IFRS"
count if post_ifrs==1 & small_profit==1 & country=="AUS" & sample_sum==1
scalar N3 = r(N)
count if post_ifrs==1 & small_profit==0 & country=="AUS" & sample_sum==1
scalar N4 = r(N)
scalar odds2=(N3-N4)/(N3+N4)
matrix m2 = N3, N4, odds2
matrix rownames m2 = "Post IFRS"
matrix m3 = m1\m2
matrix colnames m3 = "Cases (Small profit)" "Controls (Small loss)" Odds
matrix list m3
Here is the output:
m3[2,3]
Cases (Small profit) Controls (Small loss) Odds
Pre IFRS 20 13 .21212121
Post IFRS 22 11 .33333333
I would like to know if there is an equivalent command to -tabodds- or a specific way to test the evolution of the two ratios:
(N1-N2)/(N1+N2)
(N3-N4)/(N3+N4)
respectively 0.2121 and 0.3333 in my example.
Best regards
Herve Stolowy
***********************************************************
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
*
* 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/