R Questions

profileVVVCCC
STA-106-SS2-Exam-I-R.pdf

STA 106 SS2 2020 R Quesitons - Due Monday, August 24th by 5pm.

Details

* This is an individual asignment and should be completed on your own.

* You may use R Markdown, Word, LaTex, Google Docs, etc. to submit your work.

* All answers with necessary output should be in the body of the work, and all code should be placed in an appendix.

* You may use resources on Canvas to complete the work.

* Submit your document to Canvas.

Problem I

I. Online you will find the file “GSK.csv”. The csv file has the following columns:

Column 1. sysbp: The systolic blood pressure of the subject (mmHg).

Column 2. gender: The gender, with levels F and M.

Column 3. married: Y if the subject was married, N if not.

Column 4. exercise: With levels L = low, M = medium, H = high.

Column 5. age: The age of the subject in years.

Column 6. stress: With levels LS = low, MS = medium, HS = high.

Column 7. educatn: With levels LE = low, ME = medium, HE = high.

Source: Data are part of a larger case study for the 2003 Annual Meeting of the Statistical Society of Canada.

(a) Find the average and standardard deviation of systolic blood pressure by stress level. Which group had the highest average? Does it appear that the standard deviations are approximately equal?

(b) Find the average and standard deviation of age by exercise level. Which group has the lowest average age? Which group seems to differ the most from its group mean?

(c) Create a boxplot of systolic blood pressure by education level. Does there appear to be a trend? Explain your answer.

(d) Create a histogram of systolic blood pressure by marriage category. Does one group tend to vary more than the other? Explain your answer.

II. For each of the following, use a plot or a function to justify your answers

(a) Which exercise group had the most subjects?

(b) Which stress group had the most highly educated subjects?

(c) Which stress group had the highest average age?

(d) Which gender group had the lowest average systolic blood pressure?

III. Using R, and assuming equal variance by group, test if the average systolic blood pressure for married vs. non-married subjects is equal.

(a) Find the test-statistic.

(b) Find the exact p-value.

(c) Find and interpret the 95% confidence interval for the true difference.

(d) What is your conclusion about how systolic blood pressure may differ by marriage category? Explain and be specific.

1

Problem 2

I. Use the data “Cancer.csv”. The csv file has the following columns:

Column 1. Survival: The survival time of the patient in days

Column 2. Organ: The organ where cancer was present - Stomach, Bronchus, Colon, Ovary, Breast

Data Source : From the article ”Supplemental Ascorbate in the Supportive Treatment of Cancer: Reevaluation of Prolongation of Survival Times in Terminal Human Cancer” by Ewan Cameron and Linus Pauling, Proceedings of the National Academy of Sciences of the United States of America, Vol. 75, No. 9 (Sep., 1978), pp. 4538-4542.

(a) Create a group box plot of Survival by Organ type. Does there appear to be significant differences in the groups? Explain your answer.

(b) Find the sample averages of Survival by Organ type. Do you believe you would reject the null hypothesis of Single Factor ANOVA based on these values? Explain.

(c) Do you believe the standard deviations of each population are equal? Explain.

(d) What level of α would you suggest if concluding that the true average survival time was equal when in reality it was not, would be considered the most severe error?

II. Continue with the Cancer dataset.

(a) Find the value of SSTO, SSA, SSE.

(b) Find the value of MSTO, MSA, MSE.

(c) Find the value of the test-statistic, and the corresponding p-value.

(d) State your conclusion in terms of the problem if α = 0.05.

III. Diagnostic Tests

(a) Plot the QQplot, and residuals vs. fitted values. Does there appear to be a violation of the assumptions of ANOVA? Explain your answer.

(b) Find and interpret the p-value of the Shaprio-Wilks test.

(c) Find and interpret the p-value of the Brown-Forsythe test.

(d) Based on your analyses above, would you want to transform the data? Explain.

2