# Suggested answer to exercise: Readmission to hospital for asthmatic children using Stata 9, 4

Question 4: Is the presence of a crisis plan related to other variables which might increase the risk of readmission, such as age, sex, number of previous admissions, pulse rate, or respiration rate? How do children given a crisis plan differ from the other children?

Sex is a qualitative variable, so we will use a cross-tabulation and chi-squared test:

```. tab  sex crisis, chi2

|      crisis plan
sex |    absent    present |     Total
-----------+----------------------+----------
girl |       337         77 |       414
boy |       539         80 |       619
-----------+----------------------+----------
Total |       876        157 |     1,033

Pearson chi2(1) =   6.1989   Pr = 0.013
```

Clearly girls are more likely to have crisis plans than boys.

The other variables are all quantitative and, in view of the large sample size, a z test is indicated. In Stata, this is done using a t test with unequal variances:

```. ttest age, by(crisis) unequal

Two-sample t test with unequal variances
------------------------------------------------------------------------------
Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
absent |     874    3.709382     .102038    3.016598    3.509114    3.909651
present |     157    5.343949    .3004859    3.765078    4.750403    5.937495
---------+--------------------------------------------------------------------
combined |    1031    3.958293    .0994898    3.194535    3.763067    4.153519
---------+--------------------------------------------------------------------
diff |           -1.634567    .3173382               -2.260451   -1.008683
------------------------------------------------------------------------------
diff = mean(absent) - mean(present)                           t =  -5.1509
Ho: diff = 0                     Satterthwaite's degrees of freedom =  193.592

Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
Pr(T < t) = 0.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 1.0000

. ttest wheeze, by(crisis) unequal

Two-sample t test with unequal variances
------------------------------------------------------------------------------
Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
absent |     873    36.16151    2.299032    67.92851    31.64923    40.67379
present |     155    43.63871    6.940243    86.40533    29.92834    57.34908
---------+--------------------------------------------------------------------
combined |    1028    37.28891     2.21521    71.02504    32.94206    41.63577
---------+--------------------------------------------------------------------
diff |           -7.477198    7.311123               -21.89896    6.944566
------------------------------------------------------------------------------
diff = mean(absent) - mean(present)                           t =  -1.0227
Ho: diff = 0                     Satterthwaite's degrees of freedom =   189.25

Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
Pr(T < t) = 0.1539         Pr(|T| > |t|) = 0.3077          Pr(T > t) = 0.8461

Two-sample t test with unequal variances
------------------------------------------------------------------------------
Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
absent |     876    2.003425    .1936601    5.731815    1.623332    2.383517
present |     154    6.727273    .5150541    6.391654    5.709737    7.744809
---------+--------------------------------------------------------------------
combined |    1030    2.709709    .1891512    6.070544    2.338543    3.080875
---------+--------------------------------------------------------------------
diff |           -4.723848     .550259               -5.808947   -3.638749
------------------------------------------------------------------------------
diff = mean(absent) - mean(present)                           t =  -8.5848
Ho: diff = 0                     Satterthwaite's degrees of freedom =  198.625

Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
Pr(T < t) = 0.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 1.0000

. ttest pulse, by(crisis) unequal

Two-sample t test with unequal variances
------------------------------------------------------------------------------
Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
absent |     869    136.5201    .7079134    20.86844    135.1307    137.9096
present |     154    133.2532    1.890531    23.46087    129.5183    136.9882
---------+--------------------------------------------------------------------
combined |    1023    136.0283    .6659108    21.29874    134.7216    137.3351
---------+--------------------------------------------------------------------
diff |            3.266891    2.018725               -.7140408    7.247824
------------------------------------------------------------------------------
diff = mean(absent) - mean(present)                           t =   1.6183
Ho: diff = 0                     Satterthwaite's degrees of freedom =  198.227

Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
Pr(T < t) = 0.9464         Pr(|T| > |t|) = 0.1072          Pr(T > t) = 0.0536

. ttest resp, by(crisis) unequal

Two-sample t test with unequal variances
------------------------------------------------------------------------------
Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
absent |     871    44.88749    .4467426    13.18459    44.01067     45.7643
present |     149     41.2349    1.025318    12.51561    39.20874    43.26105
---------+--------------------------------------------------------------------
combined |    1020    44.35392     .411634    13.14654    43.54617    45.16167
---------+--------------------------------------------------------------------
diff |            3.652586    1.118417                1.447716    5.857457
------------------------------------------------------------------------------
diff = mean(absent) - mean(present)                           t =   3.2659
Ho: diff = 0                     Satterthwaite's degrees of freedom =  208.251

Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
Pr(T < t) = 0.9994         Pr(|T| > |t|) = 0.0013          Pr(T > t) = 0.0006
```

Age, previous admissions, and respiration are significantly related to the crisis plan.

Children given a crisis plan were more likely to be girls than were other children, and tended to be older, to have had more previous admissions, and to have slower respiration.