1 / 53

R for Statistics and Graphics

R for Statistics and Graphics. Session 5 Beyond Basic Statistics. Mehmet Tevfik DORAK, MD PhD School of Life Sciences, Pharmacy & Chemistry Kingston University London. Istanbul University, Capa Faculty of Medicine 19 April 2019. Outline. Statistical power Survival analysis

chinojosa
Download Presentation

R for Statistics and Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. R for Statistics and Graphics Session 5 Beyond Basic Statistics Mehmet Tevfik DORAK, MD PhD School of Life Sciences, Pharmacy & Chemistry Kingston University London Istanbul University, Capa Faculty of Medicine 19 April 2019

  2. Outline Statistical power Survival analysis Meta-analysis ROC analysis Resources for further study

  3. Statistical Power

  4. Statistical Power

  5. Statistical Power Now, run Script: pwr.R

  6. Survival Analysis

  7. Survival Analysis survfit(Surv(survivaltime, event) ~ group, data = df) library("survival") data(leukemia) df <- leukemia df$survivaltime <- df$time df$event <- df$status df$group <- df$x head(df) fit <- survfit(Surv(survivaltime, event) ~ group, data = df) plot(fit) summary(fit) Script: survival.R

  8. Survival Analysis

  9. Survival Analysis

  10. Survival Analysis

  11. Survival Analysis

  12. Meta-analysis

  13. Meta-analysis

  14. Meta-analysis Script: rmeta_Cochrane.R

  15. Meta-analysis

  16. Meta-analysis

  17. Meta-analysis

  18. Sensitivity / Specificity / PPV / NPV > install.packages(epiR) > library(epiR) > ct <- matrix(c(23,34,56,42), nrow=2) > ct [,1] [,2] [1,] 23 56 [2,] 34 42 > epi.tests(ct, conf.level = 0.95) Outcome + Outcome - Total Test + 23 56 79 Test - 34 42 76 Total 57 98 155 Point estimates and 95 % CIs: --------------------------------------------------------- Apparent prevalence 0.51 (0.43, 0.59) True prevalence 0.37 (0.29, 0.45) Sensitivity 0.40 (0.28, 0.54) Specificity 0.43 (0.33, 0.53) Positive predictive value 0.29 (0.19, 0.40) Negative predictive value 0.55 (0.43, 0.67) Positive likelihood ratio 0.71 (0.49, 1.01) Negative likelihood ratio 1.39 (1.02, 1.90) ---------------------------------------------------------

  19. ROC Analysis in R > install.packages("pROC") # installing the package > library("pROC") # loading the package > jv <- read.csv("jv.csv") # reading the dataset > attach(jv) # specifying the dataset> rocjv <- roc(outcome, test) # performing the function> coords(rocjv, x="best", input="threshold", best.method="youden")

  20. ROC Analysis • Cutoff value determination (Youden index): • jv <- read.csv("jv.csv")library("pROC")rocjv <- roc(jv$intubated, jv$wbc1)coords(rocjv, "best") •   threshold specificity sensitivity 9.2000000   0.5801527   0.9523810 • coords(rocjv, x = "best", input = "threshold", • best.method = "youden") •   threshold specificity sensitivity 9.2000000   0.5801527   0.9523810 • EXPLANATION: If WBC = 9200 is used as the cutoff for intubation risk, when WBC>9200, 58% of the time intubation occurs, and when WBC<9200, 95% of the time, intubation does not occur

  21. ROC Analysis

  22. ROC Analysis

  23. ROC Analysis in R

  24. ROC Analysis in R R code to generate a ROC curve for a 2x2 table: install.packages("psych") library("psych") AUC(c(n1, n2, n3, n4)) Included in the script: contingency.R

  25. Running R Online https://www.tutorialspoint.com/execute_r_online.php Alternatives: https://rdrr.io/snippets http://www.roncloud.comhttp://www.compileonline.com/execute_r_online.phphttp://www.r-fiddle.orghttp://pbil.univ-lyon1.fr/Rweb/Rweb.general.html

  26. R Studio Want to make life easier? Try R Studio, the most popular integrated development environment (IDE). Rstudio Cheet Sheet

  27. R Commander For those of you who do not like to type a few lines of code….. … there is always R Commander!

  28. Point-and-click Graphical User Interfaces (GUIs)

  29. Point-and-click Graphical User Interfaces (GUIs)

  30. More R Suggestions to Move Forward Cookbooks (online and in print) Websites and courses for "Using R" (not program development) MOOC courses R-Bloggers Search engines Courage and practice

  31. Online Cookbooks for "Using R" WEB-BASED SOURCES http://www.dorak.info/mtd/glosstat.html R Tutorials @ ListenData: https://www.listendata.com/p/r-programming-tutorials.html

  32. Explore Statistics with R

  33. Explore Statistics with R

  34. Explore Statistics with R

  35. Resources

  36. Resources

  37. Resources

  38. Resources

  39. Resources

  40. Resources

  41. Resources http://www.r-clinical-research.com

  42. R Books for Biologists

  43. R Books for Self-Learners My Top Recommendation

  44. R Books for Statistics My Top Recommendation

  45. R Books for Statistics

  46. R Books for Statistics

  47. R Books for Statistics

  48. R Books for Statistics

  49. R Books for Statistics

More Related