Chapter 2-98 Homework Problems

advertisement
Chapter 2-98 Homework Problems
Chapter 2-1. Describing variables, levels of measurement, and choice of descriptive
Statistics
Problem 1) Read in the data file
From the Stata menu bar, click on File on the menu bar, find the directory datasets
& do-files, which is a subdirectory of the course manual, and open the file:
births_with_missing.dta.
Problem 2) Listing data
List the data for bweight.
a) At the first “—more—” prompt, with the cursor in the Command window, hit
the enter key a couple of times (notice this scrolls one line at a time).
b) With the cursor in the Command window, hit the space bar a couple of times
(notice this scrolls a page at a time).
c) Click on the “—more—” prompt with the mouse (notice this scrolls a page at
a time, as well)
d) We have seen enough. Hit the stop icon on the menu bar (the red dot with a
white X in the middle of it). This terminates (breaks) the output.
Problem 3) Frequency table
Create a frequency table for the variable lowbw.
Problem 4) Histogram
Create a histogram for the variable gestwks, asking for the percent on the y-axis,
rather than proportions (density).
Problem 5) Kernal Density Plot
Create a kernal density for the variable gestwks, overlaying the graphs for male
and female newborns.
______________________
Source: Stoddard GJ. Biostatistics and Epidemiology Using Stata: A Course Manual. Salt Lake City, UT: University of Utah
School of Medicine. Chapter 2-98. (Accessed January 8, 1012, at http://www.ccts.utah.edu/biostats/
?pageId=5385).
Chapter 2-98 (revision 8 Jan 2012)
p. 1
Problem 6) Box plot
Create a boxplot for the variable bweight, showing male and female newborns on
the same graph.
Problem 7) Visualizing Distribution From Descriptive Statistics
A variable has the following descriptive statistics:
Mean = 45
Median = 50
SD = 3
Is this distribution symmetrical, or is it skewed? If skewed, is it left or right
skewed?
Problem 8) Visualizing Distribution From Descriptive Statistics
A variable has the following descriptive statistics:
Mean = 50
Median = 49
SD = 3
Is this distribution symmetrical, or is it skewed? If skewed, is it left or right
skewed?
Problem 9) Descriptive Statistics
Obtain the descriptive statistics, including the median (50th percentile) for the
variable bweight.
Problem 10) Descriptive Statistics by Group
Obtain the short list of descriptive statistics (N, mean, SD, min, max) for
variable bweight, for both males and females.
Problem 11) Best Choice of Descriptive Statistics to Describe a Variable’s Distribution
Suppose you have a variable for race/ethnicity that is coded as:
1) Caucasian (White)
2) African-American (Black)
3) Asian
4) Native American
5) Pacific Islander
Given this way of coding it, what is the level of measurement (measure scale) of
this variable? What is the best way to describe it in a “Patient Characteristics”
table of a manuscript? That is, what descriptive statistics would you choose to
use?
Chapter 2-98 (revision 8 Jan 2012)
p. 2
Problem 12) Best Choice of Descriptive Statistics to Describe a Variable’s Distribution
Suppose you have a variable for systolic blood pressure that is coded as actual
values of the measurement. What is the variable’s level of measurement? What
is the best way to describe it in a “Patient Characteristics” table of a manuscript?
Problem 13) Best Choice of Descriptive Statistics to Describe a Variable’s Distribution
Suppose you have a variable for sex that is scored as
1) male
2) female
What is the best way to describe it in a “Patient Characteristics” table of a
manuscript?
Problem 14) Best Choice of Descriptive Statistics to Describe a Variable’s Distribution
Suppose you have a variable for the New York Heart Association class (NYHA
class)(Miller-Davis et al, 2006). The “NYHA class” is a simple scale that
classifies a patient according to how cardiac symptoms impinge on day to day
activies. It is scored as:
Class I) No limitations of physical activity (ordinary physical activity
does not cause symptoms)
Class II) Slight limitation of physical activity (ordinary physical activity
does cause symptoms)
Class III) Moderate limitation of activity (comfortable at rest but less
than orinary activities cause symptoms)
Class IV) Unable to perform any physical activity without discomfort
(may be symptomatic even at rest); therefore severe limitation
What is the variable’s level of measurement? What is the best way to describe it
in a “Patient Characteristics” table of a manuscript?
Problem 15) Open up the file births_with_missing.dta in Stata. Compute the frequency
tables or descriptive statistics, separately for mothers with and without hypertension, and
fill in the following table with the appropriate row labels in column one and the best
choice of descriptive statistcs in columns two and three.
Table 1. Patient Characteristics
Maternal
Hypertension
Present
[N = ]
Maternal age, yrs
Maternal
Hypertension
Absent
[N = ]
Sex of Newborn
Chapter 2-98 (revision 8 Jan 2012)
p. 3
Chapter 2-2. Logic of significance tests
Chapter 2-3. Choice of significance test
It was shown in Chapter 2-1 that the decision of which descriptive statistic to use was
based on the level of measurement of the data. The most informative measure of average
and dispersion (such as mean and standard deviation) was selected after determining the
level of measurement of the variable.
The choice of a test statistic, also called a significance test, is made in a similar way.
You choose the test the makes the best use of the information in the variable; that is, it
depends on the level of measurement of the variable, and whether the groups being
compared are independent (different study subjects) or related (same person measured at
least twice).
Problem 1) Practice Selecting a Significance Test Using Chapter 2-3.
Selecting a significance test before these tests have been introduced in later chapters is in
some sense jumping ahead. Still, it is useful at this point in the course to see that the
decision is actually quite simple, which removes a lot of mystery about the subject of
statistics. You do not even have to know what the tests are to be able to do this. This
problem is an exercise to illustrate how easy it is.
In this problem, the study is comparing an active treatment (intervention group) to an
untreated control group (control group). These groups are different subjects (different
people, animals, or specimens). The outcome is an interval scale, and for this analysis, no
control for other variables is desired. What is the best significance test to use?
Problem 2) Practice Selecting a Significance Test Using Chapter 2-3.
In this problem, the study is comparing a baseline, or pre-intervention measurement, to a
post-intervention measurement on the same study subjects. There is no control group in
the experiment. The outcome is an ordinal scale variable, and for this analysis, no control
for other variables is desired. What is the best significance test to use?
Chapter 2-4. Comparison of two independent groups
Problem 1) Comparison of a dichotomous outcome
Open the file births_with_missing.dta inside Stata. In preparing to test for an association
between hypertension and preterm in the subgroup of females (sex equal 2), first check
the minimum expected cell frequency assumption. Do this using:
tabulate preterm hyp if sex==2, expect
Chapter 2-98 (revision 8 Jan 2012)
p. 4
<or abbreviate to>
tab preterm hyp if sex==2, expect
Comparing the results to the minimum expected cell frequency rule, should a chi-square
test be used to test the association, or should a Fisher’s exact test be used?
Problem 2) Comparison of a dichotomous outcome
Compute the appropriate test statistic for the crosstabulation table in Problem 1. Ask for
row or column percents, depending on which we would want to report in our manuscript.
Problem 3) Comparison of a dichotomous outcome
Use the following “immediate” (the data follow immediately after the command name)
version of the tabulate command,
tabi 5 4 \ 3 10 , expect
should a chi-square test be used, or should a Fisher’s exact test be used?
Problem 4) Comparison of a nominal outcome
In Sulkowski (2000) Table 1, the following distribution of race is provided for the two
study groups.
Race
Black
White
Other
Protease
Inhibitor
Regimen
(n =
211)
Dual
Nucleoside
Analog
Regimen
(n = 87)
151 (72)
57 (27)
3 ( 1)
71 (82)
13 (15)
3( 3)
P
value
0.02
The problem is to verify the percents and the p value. Use the tabi command to add the
three rows of data as part of the command, with each row separated by the carriage return,
or new line, symbol “\”. (See an example for two rows of data in the previous problem
above.) First check the expected frequencies, and then use a chi-square test or Fisher’s
exact test (more correctly called a Fisher-Freeman-Halton test when the table is larger
than 2 × 2), as appropriate.
Chapter 2-98 (revision 8 Jan 2012)
p. 5
Problem 5) Comparison of an ordinal outcome
Body mass index (BMI) is computed using the equation:
body mass index (BMI) = weight/height2 in kg/m2
BMI is frequently recoded into four BMI categories recommended by the National Heart,
Lung, and Blood Institute (1998)(Onyike et al., 2003):
underweight (BMI <18.5)
normal weight (BMI 18.5–24.9)
overweight
(BMI 25.0–29.9)
obese
(BMI 30)
(How to compute BMI and recode it into these four categories is explained in Chapter 111, if you ever need to do this in your own research.) This recoding converts the data
from an interval scale into an ordinal scale, since the categories have order but not equal
intervals. To compare two groups on BMI as an ordinal scale, a Wilcoxon-MannWhitney test is appropriate.
Suppose the data are:
BMI, count (%)
Underweight
Normal weight
Overweight
Obese
Active
Drug
(n = 100
Placebo
Drug
(n = 100)
4 ( 4)
30 (30)
50 (50)
16 (16)
0 ( 0)
20 (20)
45 (45)
35 (35)
The ranksum command, which is the Wilcoxon-Mann-Whitney test, does not have an
“immediate” form, so we have to convert these data into “individual level” data, where
each row of the dataset represents an individual subject. To do this, copy the following
into the Stata do-file editor and run it.
Chapter 2-98 (revision 8 Jan 2012)
p. 6
* --- wrong way to do it --clear
input active bmicat count
1 1 4
1 2 30
1 3 50
1 4 16
0 1 0
0 2 20
0 3 45
0 4 35
end
expand count
tab bmicat active
Compare the result to data table above to see what is different.
Now copy the following into the do-file editor and run it,
* --- correct way to do it --clear
input active bmicat count
1 1 4
1 2 30
1 3 50
1 4 16
0 1 0
0 2 20
0 3 45
0 4 35
end
drop if count==0 // always a good idea to add this line
expand count
tab bmicat active
Now that we have the dataset correctly created, test the two groups using a WilcoxonMann-Whitney test. Write a sentence that could be used to report the results of the test.
Chapter 2-98 (revision 8 Jan 2012)
p. 7
Problem 6) Comparison of an interval outcome
Cut and paste the following into the do-file editor and execute it to set up the dataset.
These data represent two groups (1=Patients with Coronary Heart Disease (CHD), 0=
Patients without CHD) on an outcome of systolic blood pressure (SBP).
120
140
160
sbp
180
200
220
clear
input chd sbp
1 225
1 190
1 162
1 178
1 158
0 154
0 124
0 128
0 165
0 162
end
graph box sbp ,over(chd)
0
1
Just by looking at the boxplot, would you guess a two-sample t-test would have a smaller
p value (more significant) than a Wilcoxon-Mann-Whitney test? Compute four test
statistics: two-sample t-test which assumes equal variances, two-sample t-test which
does not assume equal variances, Wilcoxon-Mann-Whitney test, and Fisher-Pitman
permutation test for two independent samples. Which was the most powerful test for
these data (which had smallest p value)?
Chapter 2-98 (revision 8 Jan 2012)
p. 8
Chapter 2-5. Basics of power analysis
Problem 1) sample size determination for a comparison of two means
You have pilot data taken from Chapter 2-4, problem 6 above.
clear
input chd sbp
1 225
1 190
1 162
1 178
1 158
0 154
0 124
0 128
0 165
0 162
end
Designing a new study to test this difference in mean SPB, between patients with
CHD and without CHD, given these standard deviations, what sample size do you
need to have 80% power, using a two-sided alpha 0.05 level comparison?
Problem 2) z score (effect size) approach to power analysis
Cuellar and Ratcliffe (2009) include the following sample size determination
paragraph in their article,
“The study was powered to include 40 participants, 20 randomized to each
group. Randomization would include an equal number of men and women
in each group. Twenty particpants per group were needed to detect the
required moderate effect size of 0.9 assuming 80% power, alpha of 0.05,
and using a Student’s t-test.”
Come up with the “sampsi” command that verifies the sample size computation
described in their paragraph. (hint: review the “What to do if you don’t know
anything” section of Chapter 2-5).
Chapter 2-98 (revision 8 Jan 2012)
p. 9
Problem 3) Verifying the z score approach to sample size determination and power
analysis is legitimate
In Chapter 2-5, the z score approach was presented, but without a demonstration that it
actually gives the same answer as when the data are expressed in their original
measurement scale. To verify the approach is legitimate, we will first a) verify that a zscore transformed variable has a mean of 0 and standard deviation of 1. Second, b) we
will verify a t-test on data transformed into z-scores gives the same p value as when the
original scale is used. Third, c) we will verify the sample size and power calculations are
identical for a z-score transformed variable and the variable in its original scale.
Note: Verifying with an example is not a formal mathematic proof; but if it is true, it
should work for any example we try. We can think of it as a demonstration, or
verification, rather than a proof. That is good enough for our purpose.
We will use the same dataset used above in Ch 2-5 problem 1, which is duplicated here.
Cut-and-paste this dataset into the do-file editor, highlight it with the mouse, and then hit
the last icon on the right to execute it.
clear
input chd sbp
1 225
1 190
1 162
1 178
1 158
0 154
0 124
0 128
0 165
0 162
end
sum sbp
Variable |
Obs
Mean
Std. Dev.
Min
Max
-------------+-------------------------------------------------------sbp |
10
164.6
29.11739
124
225
a) verify that a z-score transformed variable has a mean of 0 and standard deviation of
1.
Using this mean and standard deviation (SD), generate a variable that contains the z
scores for systolic blood pressure (sbp), using the formula
z
X X
SD
[Hint: to compute z=(a-b)/c, use: generate z = (a-b)/c ]
Then, use the command, summarize, or abbreviated to sum, to obtain the means and SDs
for sbp and your new variable z. If you do this correctly, the mean of z will be 0, and the
SD of z will be 1.
Chapter 2-98 (revision 8 Jan 2012)
p. 10
b) verify a t-test on data transformed into z-scores gives the same p value as when the
original scale is used
Using an independent sample t-test, compare the coronary heart disease, chd, group to the
healthy group on the outcome systolic blood pressure, sbp. Then, repeat the t-test for the
z-score transformed systolic blood pressure. Notice that the p values are identical for
both t-tests.
c) verify the sample size and power calculations are identical for a z-score transformed
variable and the variable in its original scale
Using the means and SDs from the first t-test, compute the required sample size for
power of 0.80. Do the same for the second t-test. Then, using a sample size of n=7 per
group, compute the power for these same means and SDs. You should get the same result
for both measurement scales.
Clarification of the z-score approach
This is not quite how we did it in the chapter, however. In the chapter, we used a mean of
0 and SD of 1 for both groups, and then we used some fraction or multiple of the SD=1
for the effect size.
Be sure to look at the solution to this problem in Chapter 2-99, where the clarification is
fully layed out.
Chapter 2-6. More on levels of measurement
Chapter 2-7. Comparison of two paired groups
Chapter 2-8. Multiplicity and the Comparison of 3+ Groups
Problem 1) working with the formulas for the Bonferroni procedure, Holm procedure,
and Hochberg procedure for multiplicity adjustment
These are three popular procedures with formulas that are simply enough that you can do
them by hand. The procedures are described in Ch 2-8, pp. 9-10.
For Bonferroni adjusted p values, you simply multiply each p value by the number of
comparisons made. If this results in a p value greater than 1, an anomoly, you set the
adjusted p value to 1.
For Holm adjusted p values, you first sort the p values from smallest to largest. Than you
multiple by smallest p value by the number of comparison, the next smallest by the
number of comparisons minus 1, and so on. Do this same thing for Hochberg adjusted p
values. If a Holm adjusted p value becomes larger than the next adjusted p value, an
Chapter 2-98 (revision 8 Jan 2012)
p. 11
anomoly since this conflicts with the rank ordering of the unadjusted p values, you carry
the previous adjusted p value forward. For Hochberg, the anomoly adjustment is to carry
the subsequent adjusted p value backward. If the Holm adjusted p value exceeds 1, you
set it to 1.
Fill in the following table, doing the computations and adjustments in your head.
Sorted
Bonferroni Holm
Unadjusted Adjusted
Adjusted
P value
P value
P value
(before
anomoly
correction)
0.020
0.025
0.040
Holm
Adjusted
P value
(after
anomoly
correction)
Hochberg
Adjusted
P value
(before
anomoly
correction)
Hochberg
Adjusted
P value
(after
anomoly
correction)
Use the mcpi command, after installing it if necessary as described in Ch 2-8, to check
your answers.
Problem 2) a published example of using the Bonferroni procedure
Kumara et al. (2009) compared five protein assays against a preop baseline. In their
Statistical Methods, they state, “In regards to the protein assays, 5 comparisons (all vs.
preop baseline) were carried out for each parameter, thus, a Bonferroni adjustment was
made….”
These authors had several parameters, with five comparisons made for each parameter.
The adjustment for the five comparisons was made separately for each parameter, which
is the popular way to do it. One might consider if an adjustment needs to be made for all
of the parameters simultaneously, so k parameters × 5 comparisons, which would be a
large number. Alternatively, you could adjust for all p values reported in the paper. A
line has to be drawn somewhere, or all significance would be lost in the paper.
Statisticians have drawn the line at a “family” of comparisons, so arises the term “familywise error rate” or FWER. Each parameter represents a family of five related
comparisons, so an adjustment is made for those five comparisons to control the FWER.
This adjustment is done separately for each parameter, which makes sense, since each
parameter is a separate question to study.
In the Kumara (2009, last paragraph), we find,
“The mean preopplasma level for the 105 patients was 164 ± 146 pg/mL.
Significant elevations, as per the Bonferoni criteria, were noted on POD 5 (355 ±
275 pg/mL, P = 0.002) and for the POD 7 to 13 time period (371 ± 428 pg/mL, P
= 0.001) versus the preop results (Fig.1). Although VEGF levels were eleavated
for the POD 14 to 20 (289 ± 297 pg/mL; vs. preop, P = 0.036) and POD 21 to 27
Chapter 2-98 (revision 8 Jan 2012)
p. 12
(244 ± 297 pg/mL; vs. preop, P = 0.048), as per the Bonferoni correction, these
differences were not significant. By the second month after surgery the mean
VEGF level was near baseline….”
This is an example of where two significant p values were lost after adjusting for multiple
comparions. The authors reported the results this way, showing the unadjusted p values,
while mentioning the adjustment declared them nonsignificant, apparently because they
thought the effects were real and they wanted to lead the reader in that direction. Even in
their Figure 1 they denote the results as significant. This is a good illustration of
investigators being frustrated by “I had significant but lost it due to the stupid multiple
comparison adjustment.” It could easily be argued that the authors took the right
approach, since not informing the reader might produce a Type II error (false negative
conclusion). There is no universal consensus on this point.
The exercise is to see if applying some other multiple comparison adjustment would have
saved the significance, since we know the Bonferroni procedure is too conservative.
For the fifth p value, the last quoted sentence, it was clearly greater than 0.05, so just use
0.50. It makes no difference what value >0.05 we choose, since multiple comparison
adjustments cannot create significance that was not there before adjustment. Using 0.50,
then, along with the four other p values in the quoted paragraph, use the mcpi command
to see if significance would have been saved by one of the other procedures.
Problem 3) Analyzing Data with Multiple Treatments
An animal experiment was performed to test the effectiveness of a new drug. The
researcher was convinced the drug was effective, but he was not sure which carrier
solution would enhance drug delivery. (The drug is disolved into a the carrier solution so
it can be delivered intravenously.) Three candidate carriers were considered, carrier A, B,
and C. The experiment then involved four groups:
treat: 1 = inert carrier only (control group)
2 = active drug in carrier A
3 = active drug in carrier B
4 = active drug in carrier C
The researcher wanted to conclude the drug was effective if any of the active drug groups
were significantly greater on the response variable than the control group.
That is, the decision rule was:
Conclude effectiveness if (treatment 1 > control) or ( treatment 2 > control) or
( treatment 3 > control).
The decision rule, or “win strategy” fits the multiple comparison situation where you
want to control the family-wise error rate (FWER), which is the typical situation that
Chapter 2-98 (revision 8 Jan 2012)
p. 13
researchers learn about in statistics courses. That is, you want to use multiple
comparisons to arrive at a single conclusion, and you want to keep the Type I error at
alpha ≤ 0.05.
To create the dataset, copy the following into the Stata do-file editor and execute it.
clear
set seed 999
set obs 24
gen treat = 1 in 1/6
replace treat = 2 in 7/12
replace treat = 3 in 13/18
replace treat = 4 in 19/24
gen response = invnorm(uniform())*4+1*treat
bysort treat: sum response
-> treat = 1
Variable |
Obs
Mean
Std. Dev.
Min
Max
-------------+-------------------------------------------------------response |
6
.2875054
3.057285 -5.066414
2.869501
-> treat = 2
Variable |
Obs
Mean
Std. Dev.
Min
Max
-------------+-------------------------------------------------------response |
6
1.772157
2.48272 -2.487267
4.081223
-> treat = 3
Variable |
Obs
Mean
Std. Dev.
Min
Max
-------------+-------------------------------------------------------response |
6
4.119424
7.105336 -3.477194
15.84198
-> treat = 4
Variable |
Obs
Mean
Std. Dev.
Min
Max
-------------+-------------------------------------------------------response |
6
6.501425
2.198203
2.682323
9.369428
For sake of illustration, let’s now perform a oneway analysis of variance, which many
statistics instructors still erroneously teach is a necessary first step.
oneway response treat, tabulate
Analysis of Variance
Source
SS
df
MS
F
Prob > F
-----------------------------------------------------------------------Between groups
133.575257
3
44.5250857
2.51
0.0876
Within groups
354.143942
20
17.7071971
-----------------------------------------------------------------------Total
487.719199
23
21.2051826
The oneway ANOVA is not significant (p = 0.088), so the statistics instructors who
advocate this was a necessary first step would say you cannot go any further. You would
then conclude that the drug was not effective.
Chapter 2-98 (revision 8 Jan 2012)
p. 14
As was pointed out in Chapter 2-8, in the section called “Common Misconception of
Thinking Analysis of Variance (ANOVA) Must Precede Pairwise Comparisons,” there is
no reason to do this. Many statisticians are aware that the ANOVA test is ultra
conservative, and so they stay away from it when testing treatment effects.
A more correct and more powerful approach is to bypass the ANOVA test, going straight
to making the three specific individual comparisons of interest, which are each of the
three active drug groups (2, 3, and 4) with the control group (1). A multiple
comparison procedure is applied to these three comparisons to control the family-wise
error rate.
The homework problem is to perform an independent sample t-test between groups 1 and
2, 1 and 3, and 1 and 4, and then adjust the three obtained two-sided p values using the
mcpi command. You will need to include an “if” statement in the ttest command, as was
shown in Chapter 2-8 (see pp. 44-45). Apply Hommell’s procedure, which is one of the
methods used by the mcpi command. From the obtained results, should you conclude the
drug is effective?
Chapter 2-9. Correlation
Chapter 2-10. Linear regression
Problem 1) regression equation
The regression output, among other things, shows the equation of the regression line.
From simple algebra, we know the equation of a straight line is:
y  a  bx
where y is the outcome, or dependent variable, x is the predictor, or independent variable,
a is the y-intercept, and b is the slope of the line. Fitting this equation is called “simple
linear regression.” Extending this equation to three predictor variables, the regression
equation is:
y  a  b1 x1  b2 x2  b3 x3
Fitting this equation is called “multivariable linear regression” to signify that more than
one predictor variable is included in the equation.
Using the FEV dataset, fev.dta, predicting FEV by height,
regress fev height
-----------------------------------------------------------------------------fev |
Coef.
Std. Err.
t
P>|t|
[95% Conf. Interval]
-------------+---------------------------------------------------------------height |
.1319756
.002955
44.66
0.000
.1261732
.137778
Chapter 2-98 (revision 8 Jan 2012)
p. 15
_cons | -5.432679
.1814599
-29.94
0.000
-5.788995
-5.076363
------------------------------------------------------------------------------
We can find the intercept and slope from the coefficient column of the regression table
and write the linear equation as,
fev = -5.432679 + 0.1319756(height)
Listing these variables for the first subject,
list fev height in 1
+----------------+
|
fev
height |
|----------------|
1. | 1.708
57 |
+----------------+
To apply the prediction equation to predict FEV for this first subject, we can use the
display command, where “*” denotes multiplication,
display -5.432679 + 0.1319756*57
2.0899302
We can get Stata to provide the predicted values from applying the regression equation,
using the predict command. In the following example, we use “pred_fev” as the variable
we choose to store the predicted values in. The predict command applies the equation
from the last fitted model.
predict pred_fev
list fev height pred_fev in 1
Chapter 2-98 (revision 8 Jan 2012)
p. 16
+---------------------------+
|
fev
height
pred_fev |
|---------------------------|
1. | 1.708
57
2.089929 |
+---------------------------+
The predicted value that Stata came up with is slightly different from what we got with
the display command because it is using more decimal places of accuracy.
Now that we see how it works, the homework problem is to fit a multivariable model for
FEV with height and age as the predictor variables. Use the display command to predict
FEV for the first subject. Then, use the predict command to check your answer.
In other words, take all of the Stata commands we used above,
regress fev height
list fev height in 1
display -5.432679 + 0.1319756*57
capture drop pred_fev
predict pred_fev
list fev height pred_fev in 1
and modify them for the two predictors, height and age, used together.
Problem 2) reporting the results
Using the regression model output from Problem 1, which is
Source |
SS
df
MS
-------------+-----------------------------Model | 376.244941
2 188.122471
Residual | 114.674892
651 .176151908
-------------+-----------------------------Total | 490.919833
653 .751791475
Number of obs
F( 2,
651)
Prob > F
R-squared
Adj R-squared
Root MSE
=
654
= 1067.96
= 0.0000
= 0.7664
= 0.7657
=
.4197
-----------------------------------------------------------------------------fev |
Coef.
Std. Err.
t
P>|t|
[95% Conf. Interval]
-------------+---------------------------------------------------------------height |
.1097118
.0047162
23.26
0.000
.100451
.1189726
age |
.0542807
.0091061
5.96
0.000
.0363998
.0721616
_cons | -4.610466
.2242706
-20.56
0.000
-5.050847
-4.170085
------------------------------------------------------------------------------
write a sentence that could be used to interpret the the association of height with FEV.
Chapter 2-98 (revision 8 Jan 2012)
p. 17
Problem 3) Are the signs (positive or negative) of correlations transitive?
When we speak of correlation, referring to the regression coefficient or referring to the
correlation coefficient is analogous, since the correlation coefficient is simply the
regression coefficient computed after transforming the data to standardized scores, or zscores. Both approaches test for a correlation (an association). When the regression
coefficient or the correlation coefficient is positive, we say the variables are “positively
correlated”, so as you increase on one variable, you also increase on the other. When they
are negative, we say the variables are “negatively correlated”, so as you increase on one
variable, you decrease on the other. It does not matter which variable is the dependent or
independent variable when you test for a correlation or when you interpret whether it is
negatively or positively correlated.
In mathematics, the transitive property of equality is:
If A=B and B=C, then A=C.
Similarly, the transitive property of inequality is:
If A≥B and B≥C, then A≥C.
Suppose you analyze your data, computing correlation coefficients between variables A,
B, and C, and you get the following result:
A vs B: Pearson r = +0.75
B vs C: Pearson r = +0.70
A vs C: Pearson r = -0.50
Your co-investigator looks at these results and says to you, “This cannot be right. If B
increases with increasing A, and C increases with increasing B, then it is impossible for C
to decrease with increasing A. Think about it. If I put a beaker of water on a flame, the
temperature of the water increases when the temperature of the breaker increases (A
increase → B increase). If I put a stone in the water, the temperature of the stone goes up
when the temperature of the water goes up (B increase → C increase). Now you are
trying to tell me that when the temperature of the breaker increases the temperature of the
stone decreases? (A increase → C decrease).” What your co-investigator just did was
assume that the sign of the correlation coefficient exhibits the transitive property.
Is the co-investigator correct that you must have made a mistake?
(hint: You will not find this in the course manual chapters on regression or correlation. It
is just an exercise in reasoning. It is included here as a homework problem because this
type of “reasoning” is quite common when researchers look for associations.)
Chapter 2-11. Logistic regression and dummy variables
Problem 1) Read in the data file
Chapter 2-98 (revision 8 Jan 2012)
p. 18
Open the file births.dta inside Stata.
Problem 2) Create indicator variables
The data contain maternal ages from 23 to 43. Suppose you have a reason to think
the following maternal ages form meaningful categories:
age 23 to 30
age 31 to 38
age 39 to 43
Using the “recode” command, with the “gen( )” option, create an maternal age
categorical variable that has the scores:
1 = age 23 to 30
2 = age 31 to 38
3 = age 39 to 43
using the command:
recode matage 23/30=1 31/38=2 39/43=3 , gen(matage3)
Next, use the tabulate command, with the gen( ) option, to create 3 indicator
variables. (hint: look at the example on page 16 of Chapter 2-11)
Problem 3) Fit a logistic regression
Finally, fit a multiple logistic regression model, using two of the three matage
age indicator variables as the predictors and low birthweight (lowbw) as the
outcome variable. (hint: look at the example on page 20 of Chapter 13)
Chapter 2-12. Survival analysis: Kaplan-Meier graphs, Log-rank Test, and
Cox regression
Chapter 2-13. Confidence intervals versus p values and trends toward
Significance
Chapter 2-14. Pearson correlation coefficient with clustered data
Chapter 2-15. Equivalence and noninferiority tests
Problem 1) Difference in two proportions noninferiority test
Chapter 2-98 (revision 8 Jan 2012)
p. 19
Reboli et al. (N Engl J Med, 2007) conducted a randomized, double-blind, noninferiority
trial to test their hypothesis that anidualfungin, a new echinocandin, is noninferior to
fluconazole for the treatment of invasive candidiasis. In their article, they stated that their
statistical method was,
“The primary analysis in this noninferiority trial was a two-step comparison of the
rate of global success between the two study groups at the end of intravenous
therapy. A two-sided 95% confidence interval was calculated for the true
difference in efficacy (the success rate with anidulafungin minus that with
fluconazole). In the first step, noninferiority was considered to be shown if the
lower limit of the two-sided 95% confidence interval was greater than -20
percentage points. In the second step, if the lower limit was greater than 0, then
anidualfungin was considered to be superior in the strict sense to fluconazole.”
To set up the data reported by Reboli et al., cut-and-paste the following into the Stata dofile editor, highlight it, and double click on the last icon on the do-file menu bar to
execute it.
clear all
set obs 245
gen anidulafungin=1 in 1/127
replace anidulafungin=0 in 128/245
recode anidulafungin 0=1 1=0 ,gen(fluconazole)
label variable fluconazole // turn off variable label
gen globalresponse=1 in 1/96
replace globalresponse=0 in 97/127
replace globalresponse=1 in 128/198
replace globalresponse=0 in 199/245
label define anidulafunginlab 1 "1. anidulafungin" ///
0 "0. fluconazole"
label values anidulafungin anidulafunginlab
label define fluconazolelab 1 "1. fluconazole" ///
0 "0. anidulafungin"
label values fluconazole fluconazolelab
label define globalresponselab 1 "1. Success" 0 "0. Failure"
label values globalresponse globalresponselab
tab globalresponse anidulafungin, col
tab globalresponse fluconazole, col
Part a) Using the noninferiority margin of -20%, where anidulafungin could have an
absolute percent success of 20 points (20%) less than fluconazole, test the noninferiority
hypothesis using with the appropriate confidence interval. Hint: Use the prtest
command. Depending on which direction you want to compute the difference, use either
the anidulafungin group variable or the fluconazole group variable.
Part b) If justified following the noninferiority analysis, test for superiority of
anidulafungin to fluconazole.
Chapter 2-16. Validity and reliability
Chapter 2-17. Methods comparison studies
Chapter 2-98 (revision 8 Jan 2012)
p. 20
References
Cuellar NG, Ratcliffe SJ. (2009). Does valerian improve sleepiness and symptom severity in
people with restless legs syndrome? Alternative Therapies 15(2):22-28.
Daniel WW. (1995). Biostatistics: A Foundation for Analysis in the Health Sciences. 6th ed.
New York, John Wiley & Sons.
Kumara HMCS, Feingold D, Kalady M. et al. (2009). Colorectal resection is associated wth
persistent proangiogenic plasma protein changes: a postoperative plasma stimulates in
vitro endothelial cell growth, migration, and invasion. Ann Surg 249(6):973-977.
Hidebrand DK. (1986). Statistical Thinking for Behavioral Scientists. Boston, Duxbury Press.
Miller-Davis C, Marden S, Leidy NK. (2006). The New York Heart Association Classes and
functional status: what are we really measuring? Heart Lung 35(4):217-24.
Munro BH. (2001). Statistical Methods for Health Care Research. 4th ed. Philadelphia,
Lippincott.
Onyike CU, Crum RM, Lee HB, Lyketsos CG, Eaton WW. (2003). Is obesity associated with
major depression? Results from the third national health and nutrition examination
survey. Am J Epidemiol 158(12):1139-1153.
Reboli AC, Rotstein C, Pappas PG, et al. (2007). Anidulafungin versus fluconazole for invasive
candidiasis. N Engl J Med 356;24:2472-2482.
Rosner B. (2006). Fundamentals of Biostatistics, 6th ed. Belmont CA, Duxbury Press.
Sulkowski MS, Thomas DL, Chaisson RE, Moore RD. (2000). Hepatotoxicity associated with
antiretroviral therapy in adults infected with human immunodeficiency virus and the role
of hepatitis C or B virus infection. JAMA 283(1):74-80. {cited in: Ch 2-1, 3-5, 3-9}
Chapter 2-98 (revision 8 Jan 2012)
p. 21
Download