Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: R: comparing two linear slopes - flag: Stata 9.2/SE

From   "Carlo Lazzaro" <>
To   <>
Subject   st: R: comparing two linear slopes - flag: Stata 9.2/SE
Date   Sun, 31 Oct 2010 11:49:22 +0100

Ashwin may want to consider the increased number of hospitalizations between
"year end" and "year start" for both the diseases under investigation (A and
B) as a proxy for the increase in the number of episodes of A and B.
Hence, Ashwin may want to perform a parametric ttest on the differences in
hospitalizations for A and B and then test the results in terms of
significance via a bootstrap p-value:

*********************** code begins *************************************
drop _all
set obs 100
g H_1_Start=2*uniform() 
g H_1_End=8*uniform()
g H_2_Start=1*uniform()
g H_2_End=2*uniform()
g Diff_1= H_1_End- H_1_Start
g Diff_2= H_2_End- H_2_Start
ttest Diff_1 == Diff_2, unpaired unequal
return list
scalar tobs=r(t)
replace  Diff_1= Diff_1-r(mu_1)+(r(mu_1)+r(mu_2))/2
replace  Diff_2= Diff_2-r(mu_2)+(r(mu_1)+r(mu_2))/2
bootstrap r(t), reps(10000) nodots saving(C:\Documents and
Settings\carlo\Desktop\Ashwin_boot.dta, every(1) double replace): ttest
Diff_1 == Diff_2, unpaired unequal
use "C:\Documents and Settings\carlo\Desktop\Ashwin_boot.dta", clear
g indicator =abs(_bs_1)>=abs(scalar(tobs))
sum indicator, mean
di "p_bootstrap =" r(mean)
*********************** code ends *************************************

HTH and Kind Regards,
-----Messaggio originale-----
[] Per conto di Ashwin
Inviato: venerdì 29 ottobre 2010 22.40
Oggetto: st: comparing two linear slopes


I'm examining the rate of change of two proportions over time. I'd be
grateful if someone could help me figure this out: 

I'm looking at the proportional increase in two specific disease (as a
proportion of all hospitalizations) over time and need to see if the rate of
increase for one disease is statistically greater than the rate of increase
for disease 2. 

I have the sum totals for the numerators (i.e disease 1 or disease 2) and
denominators (total hospitalization 1 and total hospitalizations 2) for the
start and the end year (the relationship is linear for the intervening years
- that's been looked at). 

Is there a way to compare these two trends statistically to say that the
4-fold increase for disease 1 is significant greater than the 2-fold
increase for disease 2? 

Should i calculate the annual percent change for each disease and then use
the two-sample t test? How i get the Std dev for the annual percent change? 



*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index