homework5

advertisement
Biostat 510: Statistical Computing Packages
SAS Homework 5
Due Tuesday, October 29
This homework again uses the Afifi data. Please make a write-up of your results of 2-5
pages, plus hand in your SAS commands and as much annotated SAS output as necessary
to show points that you wish to make in your write-up and interpret results. Use alpha=.05
for statistical tests. Please note that when you need to create new variables, you can go
back to your data step and add the coding for the new variables and rerun the code, rather
than making a new data set each time.
1. Use the Afifi permanent data set that you created in earlier homeworks. Be sure you
have read in all variables in the data set.
a. Get descriptive statistics separately for those in each type of shock, using a
class statement in Proc Means. Hand this in.
b. Use SAS/INSIGHT to get a box plot of SBP2 for each level of SHOKTYPE.
Hand in this graph. What do you notice about the distribution of SBP2 for the
different levels of SHOKTYPE?
2. Use proc glm to run an ANOVA model with SBP2 as the dependent variable and
SHOKTYPE (the original variable with 6 levels) as the predictor.
a. What is the null hypothesis for the overall test of significance of this model?
What is the alternative hypothesis? Give the test statistic, the numerator and
denominator degrees of freedom and the p-value for this test. Please explain
the numerator and denominator degrees of freedom.
b. What is the model r-square?
c. Compare the type I and type III sums of squares. Are they different? Why or
why not?
d. Use a means statement in proc glm to get SAS to print out the means of SBP2
for each level of SHOKTYPE. How do these means compare, based on just
examining the mean values (no test needed here).
e. Get a Levene's test for equality of variances. Write out the null and alternative
hypotheses for this test, the test statistic, its degrees of freedom and p-value.
What do you conclude about the variances of SBP2 for different levels of
SHOKTYPE from this test?
f. Get a Welch anova for unequal variances. What do you conclude about the
overall effect of SHOKTYPE on SBP2 using this test? Are your conclusions
different than for the anova that assumes equal variances? Please report the Ftest, the numerator and denominator degrees of freedom and the p-value when
discussing this test.
g. Get a Bonferroni and Tukey post-hoc comparison of the means of SBP2 for
each type of shock. Which levels of SHOKTYPE have significantly different
means of SBP2? Do you come to the same conclusions when using Bonferroni
and Tukey? Which post-hoc test is more powerful? Why?
h. Hand in neatly and carefully annotated computer output for this question.
1
3. Run a twoway anova model with the dependent variable being SBP2 and the two
predictor variables being SHOKTYPE and categories of Body Surface Area at time 1
(BSA1).
a. Create a new variable called BSADUM that is roughly a median split of BSA at
time 1. How many and what percentage of patients are in each category of
BSADUM?
b. Run the twoway anova model with bsadum and shoktype and their interactions
in the model.
c. How many observations are included in this model? What is the model Rsquare?
d. What is the overall significance of this model? (Give the F-statistic, numerator
and denominator degrees of freedom and the p-value.)
e. What is the significance of each effect in the model, based on the type III sums
of squares analysis. Give the numerator and denominator degrees of freedom,
the F-test and the p-value.
f. Compare the type I and type III SS output for each effect in the model. How are
they different? How are they the same? Explain the differences and
similarities.
g. Get lsmeans for the interaction term BSADUM*SHOKTYPE. Do those who
are high on the BSADUM variable have higher or lower mean SBP2 than those
who are low on the BSADUM? Is this consistent across all levels of
SHOKTYPE? What pattern do you see?
h. Since the interaction is not significant, get a Tukey and Bonferroni post-hoc
test comparing the means of SBP2 for each level of SHOKTYPE. Do the
results from these two post-hoc test methods differ? Which method is more
powerful? (Hand in carefully annotated output for this question.)
4. Carry out a twoway anova with the predictor variables being SHOCK (a two-level
variable) and BSADUM.
a. Recode SHOKTYPE into a two-level variable called SHOCK, with those
patients in shock being coded as a 1 and those patients not in shock being coded
as a 2. Check your new variable by using proc freq (you don't need to show
this).
b. Rerun the twoway anova as in question 3, but now use the two predictor
variables as SHOCK and BSADUM. Include the main effects for both factors
and their interaction.
c. What is the overall significance of this model? Give the F-test, the numerator
and denominator degrees of freedom and the p-value.
d. What is the model R-square? How does it compare with the model R-square
for question 3?
e. What is the significance of each effect in the model, using the type III sums of
squares? Give the F-test, the numerator and denominator degrees of freedom
and the p-value.
f. Get the residuals from this model using an output statement. They will be used
in Question 6.
g. Get lsmeans for the interaction term, and test for the significance of BSADUM
for each level of SHOCK, using the slice option. What do you conclude about
2
the effects of BSADUM for those who are not in shock? For those who are in
shock? (Hand in carefully annotated output for this question.)
5. Get a boxplot of SBP2 for each level of SHOCK and BSADUM from SAS/INSIGHT
a. Have SAS show the means on this graph (click on the arrow at the bottom left
corner of the graph, and select Means).
b. Discuss this graph in light of the results from question 4. (Hand in this graph.)
6. Check the residuals from the anova in question 4 for normality, using either proc
univariate, with the plot option, or using Distribution(Y) in SAS/INSIGHT.
a. What do you conclude about the normality of these residuals from this plot?
7. Save your commands as hw5.sas. Check to be sure that all of your commands run
without any errors and hand in your command file.
3
Download