Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

# Saving this for later?

### Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Standard text messaging rates apply

# Groupwise comparison of continuous data

2,109
views

Published on

Published in: Education

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
2,109
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
15
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. Groupwise comparison of continuous variables in 2012-10-29 @HSPH Kazuki Yoshida, M.D. MPH-CLE student FREEDOM TO  KNOW
• 2. Group Website is at:http://rpubs.com/kaz_yos/useR_at_HSPH
• 3. Previously in this groupn Introductionn Reading Data into R (1)n Reading Data into R (2)n Descriptive, continuousn Descriptive, categorical Group Website: http://rpubs.com/kaz_yos/useR_at_HSPH
• 4. Menun Groupwise comparison of continuous variables
• 5. Ingredients Statistics Programmingn one group vs null hypothesis n Creating a new variablen two group comparison n t.test()n multi-group comparison n wilcox.test()n Distribution-free alternative n anova(lm()) for each n kruskal.test() n BSDA::SIGN.test()
• 6. OpenR Studio
• 7. Install and Load BSDA
• 9. Read in BONEDEN.DAT.txt Name it bone Bone density in twins withdiscordant smoking exposure
• 10. Indexing: extraction of data from data frameExtract 1st to 15th rows Extract 1st to 12th columns bone[1:15 , 1:12] Colon in between Don’t forget comma
• 11. age vector within bone data frame
• 12. bone\$ageExtracted as a vector
• 13. Creating a new variable new variable subtraction bone\$fn.diff <- bone\$fn1 - bone\$fn2 alternatively: bone <- within(bone, { fn.diff <-fn1 - fn2 })
• 14. One-sample t-test t.test t.test(bone\$fn.diff, mu = 0)
• 15. Paired t-test t.test t.test(bone\$fn1, bone\$fn2, paired = TRUE)
• 16. Independent two group comparison t.test t.test(age ~ zyg, data = bone, var.equal = TRUE)
• 17. formula outcome ~ predictor
• 18. In the case of t-test continuous variable grouping variable to to be compared separate groups age ~ zyg
• 19. Variancecomparison (F-test) var.test var.test(age ~ zyg, data = bone)
• 20. t-test with BSDA packagesummary data tsum.test tsum.test(mean.x = 51.38, s.x = 10.74, n.x = 21, mean.y = 46.20, s.y = 12.48, n.y = 20, var.equal = TRUE)
• 21. Distribution-free(non-parametric) methods
• 22. One-sample wilcox.testwilcox.test(bone\$fn.diff, mu = 0, correct = FALSE)
• 23. One-sample BSDA packageSIGN.test SIGN.test(bone\$fn.diff, md = 0)
• 24. Pairedwilcox.testwilcox.test(bone\$fn1, bone\$fn2, paired = TRUE, correct = FALSE)
• 25. Independent two group comparison wilcox.test wilcox.test(age ~ zyg, data = bone)
• 26. 3+ groupcomparison
• 27. Read in BETACAR.DAT.txt Name it vitAPlasma level of carotene by different formula of beta-carotene
• 28. Independent 3+ group comparison anova anova(lm(Base1lvl ~ factor(Prepar), data = vitA))
• 29. Distribution- free kruskal.test kruskal.test(Base1lvl ~ factor(Prepar), data = vitA)