-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhomework03_2018.Rmd
70 lines (50 loc) · 4.35 KB
/
homework03_2018.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
title: "Homework 03"
---
## Homework 03 - due 10/09/2019
Using the HELP dataset:
* create "Table 1"
* provide the summary stats for the baseline data - overall and by randomization group (Usual Care versus the HELP Clinic)
- HELP dataset variables to include: `age, female, racegrp, homeless, a15a, a15b, d1, e2b, g1b, i1, i2, pss_fr, pcs, mcs, cesd, treat`.
* determine whether you want to provide parametric or non-parametric stats - based on your determination of normality assumptions, sample size considerations, appropriateness of the statistical test and communication with your audience.
* include the appropriate statistical test comparing the group measurements and subject characteristics at baseline
* write a statistical methods section describing (and explaining to your readers) the methods you used to create Table 1 and why you choose those methods to make the comparisons between the groups
* write 1-2 paragraphs (as the beginning of a results section) describing the sample overall at baseline and by group (use the data you presented in Table 1 to help you).
## Report Template for Homework 03
See the WORD document template `N736Homework03_Template.docx` you can download from [https://github.com/melindahiggins2000/N736Fall2017/blob/master/N736Homework03_Template.docx](https://github.com/melindahiggins2000/N736Fall2017/blob/master/N736Homework03_Template.docx) - click "Download".
## Variables in HELP dataset to be used for Homework 03
```{r, echo=FALSE, message=FALSE, warning=FALSE}
helpdata <- readRDS("helpmkh.rds")
library(tidyverse)
sub1 <- helpdata %>%
select(age,female,racegrp,homeless,a15a,
a15b,d1,e2b,g1b,i1,i2,pcs,mcs,
cesd,treat,pss_fr)
# create a function to get the label
# label output from the attributes() function
getlabel <- function(x) attributes(x)$label
# getlabel(sub1$age)
library(purrr)
ldf <- purrr::map_df(sub1, getlabel) # this is a 1x15 tibble data.frame
# t(ldf) # transpose for easier reading to a 15x1 single column list
# using knitr to get a table of these
# variable names for Rmarkdown
library(knitr)
knitr::kable(t(ldf),
col.names = c("Variable Label"),
caption="Use these variables from HELP dataset for Homework 03")
```
---
## Answer Key - Homework 3 - Report and Code
See Github repository for Homework 3 answer key files and codes at [https://github.com/melindahiggins2000/N736Fall2017_Homework3Key](https://github.com/melindahiggins2000/N736Fall2017_Homework3Key).
### Report Document
Using the template provided for Homework 3, the final output document that included the write-up of the methods, results and "Table 1" are provided here in:
* Word Document Format (*.DOCX) [https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/N736Homework03_AnswerKey.docx](https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/N736Homework03_AnswerKey.docx)
* PDF Document Format (*.PDF) [https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/N736Homework03_AnswerKey.pdf](https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/N736Homework03_AnswerKey.pdf)
### Homework 3 - Answer Key Code
The following files provide the analysis codes to complete the descriptive statistical summaries, assumption checks and comparison tests needed to complete Homework 3.
* `R` Code [https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/Hmwk3Key_Rcode.R](https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/Hmwk3Key_Rcode.R) - which will read in the `SPSS` formatted dataset
* `SPSS` Code [https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/SPSS_Syntax_hmwk3_key.sps](https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/SPSS_Syntax_hmwk3_key.sps)
* `SPSS` formatted dataset [https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/helpmkh.sav](https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/helpmkh.sav)
* `SAS` Code [https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/SAS_hmwk3.sas](https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/SAS_hmwk3.sas)
* `SAS` formatted dataset [https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/helpmkh.sas7bdat](https://github.com/melindahiggins2000/N736Fall2017_Homework3Key/raw/master/helpmkh.sas7bdat)