R1
Throughout this course we will be using RStudio as our environment for working with the R programming language. Please refer to M0: Succeeding in This Course for R and RStudio download instructions.
Before you begin this assignment, make sure that you have reviewed the R videos on this module's presentation page. You will also find helpful information for getting started with R from Chapter 3 from the Auerbach and Zeitlin text.
When you are ready to begin, complete the following steps for this module's R assignment:
- Review the description of the hospital dataset from the Auerbach and Zeitlin text (see pages 41 and 42).
- Download and open the hospital dataset Download Download and open the hospital datasetand complete the following in RStudio:
- Use the Hmisc package to determine the percentages for the gender variable, and record these percentages in a document.
- Use the psych package to determine the mean (average) age of patients, and record these results in a document.
- For examples, see pages 99, 100, and 104–106 in he Auerbach and Zeitlin text.
Requirements
- Upload the following by the deadline post on this page:
- A screenshot of RStudio showing that you have installed the gmodels, Hmisc, and psych packages
- A document with the following information from the hospital dataset:
- The percentages of the gender variable
- The mean age of patients.
——————————————————————————————————————–
R2
Complete the following steps for this module's R assignment:
A director of research at an acute care hospital observes an increase in the number of patients returning to the hospital within 30 days. The director determines that this is harmful to patients and harmful financially to the hospital. The dataset hospital Download hospitalcontains data on a study the director conducted to determine which factors are related to returning to the hospital in 30 days. You can find a description of the variables in the file on pages 40 and 41 in the Auerbach and Zeitlin text.
- Using the CrossTables() function in the gmodels package, create a table comparing "return30" and "gender." Then, use the data in your table to answer the question: Who is more likely to return within 30 days?
- Refer to pages 43-45 in the Auerbach & Zeitlin text (Recoding Data) to create a variable: "age80."
- Using the CrossTables() function in the gmodels package, create a table comparing "return30" and "age80." Then, use the data in your table to answer the question: Who is more likely to return within 30 days?
- Copy and paste your tables from RStudio and findings into a Word document. Use 10-point, Courier font.
- Upload your findings.
Note: When you use age80 in the CrossTable() function do not use the syntax hospital$age80. Leave off the "hospital$." You will still need to include hospital$ with return30. The reason for this is that age80 is not part of the hospital data frame. Refer to pages 46-47 in the Auerbach & Zeitlin text (saving your transformation) to attach your transformation to your data frame.
Requirements
- Upload your data tables and your findings by the deadline posted on this page.
- Your work should be submitted in a document with 10-point, Courier font.
- This assignment will be graded on the basis of completion.
————————————————————————————————————————–R3
Complete the following steps for this module's R assignment. Please note, the hospital1 data set, which is downloadable via the link in the instructions below, will be used for other R assignments later on in this course.
A director of research at an acute care hospital observes an increase in hospital length of stay (los). The director determines that this is harmful to patients and also harmful financially to the hospital. The dataset hospital1Download hospital1contains data on a study the director conducted to determine which factors are related to longer lengths of stay.
Refer to your textbook and also the R screencast videos on this module's lecture page for examples.
- Using the describeBy() function in the psych package create a table comparing "spouse" to "los." Then, use the data in your table to answer the following question: Which group has the higher mean/average length of stay (los)?
- Copy and paste your tables from RStudio and findings into a Word document. Use a 10-point, Courier font.
- Create a box plot comparing "spouse" to "los" (see p. 83 in the Auerbach and Zeitlin text). Then, interpret your findings by describing what you see in the box plot (see: page 98 in the Auerbach and Zeitlin text).
- Copy and paste your findings into the same Word document as you did above in Item 2. Copy and paste the graph to the Word document as well (see: the "Introduction to R Graphics" video on this module's lecture page).
- Upload your findings.
Requirements
- Upload your data tables and your findings by the deadline posted on this page.
- Your work should be submitted in a document with 10-point, Courier font.
- This assignment will be graded on the basis of completion.
————————————————————————————————————————-R4
Complete the following steps for this module's R assignment.
In this assignment you will enter data into a spreadsheet. You can use any spreadsheet software that can save data in .csv format (Excel, Numbers, Google Docs). Excel is utilized in this module's lecture video on entering data.
Complete the following steps:
- For examples, see pages 52–56 in the Auerbach and Zeitlin text and this module's lecture video on entering data.
- Select the first five variables from the codebook on page 53 in the Auerbach and Zeitlin text to create a spreadsheet.
- Enter the data displayed in the table below.IDgenderagejobleave112522223431324212412322515611
- Save your spreadsheet in .csv format.
- Import the data into R (see page 56 in the Auerbach and Zeitlin text).
- Save the file in R format (see page 59 in the Auerbach and Zeitlin text).
- Upload the R and spreadsheet files through this assignment page.
Requirements
- Upload your R file and your spreadsheet (in .csv format) by the deadline posted on this page.
- This assignment will be graded on the basis of completion.
————————————————————————————————————————–
R5
Complete the following steps for this module's R assignment.
A director of research at an acute care hospital observes an increase in patients returning to the hospital within 30 days. The director determines that this is harmful to patients as well as financially harmful to the hospital. The dataset hospital1 Download hospital1contains data on a study the director conducted to determine what factors are related to returning to the hospital within 30 days. The director wants to test the hypothesis that patients with and without spouses are not equally likely to return within 30 days. The null hypothesis would be that patients with and without spouses are equally likely to return to the hospital within 30 days.
Refer to your textbook and also the R screencast videos on this module's lecture page for examples.
- See pages 111–123 in the Auerbach and Zeitlin text and the chi-square video on this module's lecture page for examples.
- Using the CrossTable() function in the gmodels package, create a table comparing "spouse" to "return30." Interpret the findings you see. Specifically, was the criteria for rejection of the null hypothesis (H0) met? How can you tell?
- Copy your table from RStudio and your findings to Word document. Use size-10 Courier font.
- Upload your findings.
Requirements
- Upload your data table and your findings by the deadline posted on this page.
- Your work should be submitted in a document with 10-point Courier font.
- This assignment will be graded on the basis of completion.
—————————————————————————————————————————-R6
Complete the following steps for this module's R assignment.
A director of research at an acute care hospital observes an increase in hospital lengths of stay (los). The director determines that this is harmful to patients as well as financially harmful to the hospital. The dataset hospital1 Download hospital1contains data on a study the director conducted to determine what factors are related to longer lengths of stay.
Refer to your textbook and also the R screencast videos on this module's lecture page for examples.
- Calculate a t-test to test the null hypothesis that patients above and below the age of 80 (age80) have equal lengths of stay (los).
- Using the describeBy() function in the psych package, create a table comparing "agecat" to "los." Interpret the findings you see. Which group has the highest mean/average length of stay (los)?
- Use ANOVA to test if these differences are significant.
- Can you reject the null hypothesis? Explain how you know.
- Conduct a TukeyHSD post-hoc to compare groups.
- Which groups are significantly different?
- Using the cor.test() function, test for a relationship between "los" and instrumental activities of daily living (tiadlmean).
- Copy your table and findings to a Word document; use size-10 Courier font.
- Upload your findings.
Requirements
- Upload your data table and your findings by the deadline posted on this page.
- Your work should be submitted in a Word document with 10-point Courier font.
- This assignment will be graded on the basis of completion.