Publications by Janet Rosenbaum
Epi 5205/7202: Session 6: General Linear Models
Load libraries library(mosaic) library(Sleuth2) library(arm) library(foreign) library(epitools) library(readstata13) trellis.par.set(theme = col.mosaic()) options(digits = 3) Poisson examples barplot(dpois(0:5, 0.5), xlab="y", ylab="Probability", names=0:5, main="mean = 0.5") barplot(dpois(0:10, 2), xlab="y", ylab="Probability", names=0:10, mai...
61069 sym R (27433 sym/171 pcs) 9 img
Epi 5205/7202: Session 11: Instrumental Variables
library(foreign) library(arm) library(sem) library(mosaic) library(readstata13) # Missing data library(mice) Sesame street instrumental variables analysis sesame=read.dta("http://www.stat.columbia.edu/~gelman/arm/examples/sesame/sesame.dta") names(sesame) ## [1] "rownames" "id" "site" "sex" "age" "viewcat" ## [7] "s...
437 sym R (4673 sym/25 pcs) 1 img
Biostatistics 5201: YRBS analysis
YRBS analysis library(foreign) library(faraway) library(survey) library(mosaic) library(readstata13) setwd("~/Dropbox/Biostatistics5201-fall2020/datasets/yrbs2019") yrbs=read.dta13("yrbs2019.dta") dim(yrbs) ## [1] 13677 235 Survey data analysis tally(~psu, data=yrbs) ## psu ## 57923 58499 86668 87028 87451 87965 88352 143493 171694 17227...
16558 sym R (49640 sym/212 pcs) 18 img
Biostatistics 5201: Session 12 - Faraway chapter 14
library(mosaic) library(faraway) library(sm) library(splines) library(mgcv) library(ggplot2) library(wavethresh) Example of applications. Example A data(exa, package="faraway") plot(y ~ x, exa,main="Example A") lines(m ~ x, exa, lwd=2) ?exa View(exa) Example B data(exb, package="faraway") plot(y ~ x, exb,main="Example B") lines(m ~ x, exb, lw...
12427 sym R (10638 sym/96 pcs) 47 img
Biostatistics 5201: Session 9 - Faraway chapter 16
Faraway, Chapter 16 library(faraway) library(rpart) library(mosaic) library(rpart.plot) library(randomForest) library(MASS) Ozone data View(ozone) ?ozone histogram(~O3, data=ozone) (tmod <- rpart(O3 ~ .,ozone)) ## n= 330 ## ## node), split, n, deviance, yval ## * denotes terminal node ## ## 1) root 330 21115.4100 11.775760 ## 2) ...
16640 sym R (25180 sym/189 pcs) 28 img
Biostatistics 5201: Session 7 - Faraway chapter 7
Load libraries library(mosaic) library(faraway) library(dplyr) library(nnet) library(tidyr) library(MASS) library(VGAM) library(ggplot2) National Election Survey 1996 View(nes96) ?nes96 Data manipulation party <- nes96$PID levels(party) <- c("Democrat","Democrat","Independent","Independent", "Independent","Republican","Republican") inca <- c(1...
18039 sym R (47364 sym/223 pcs) 15 img
Document
R Markdown library(mosaic) library(readstata13) Load the data setwd("~/Dropbox/Epidemiology5201-fall2020/datasets/COVID Impact Survey 1-3/Week 1") C=read.dta13("covid_impact_survey_week1.dta") Check dimensions are as expected: dim(C) ## [1] 8790 173 Create a new variable both for readability and because it’s good practice not to change the var...
4045 sym R (3215 sym/28 pcs)
Epi 5201/7201 Homework 3 example
We use message=F here so that we don’t have many screenfuls of messages that would otherwise appear when we load these libraries. library(mosaic) library(readstata13) Fall 2020, Epidemiology 5201/7201 Homework 3 I have pasted the homework assignment in here and given some example analyses. However, I have not interpreted anything. Interpreting...
15807 sym R (3034 sym/33 pcs) 10 img
Biostatistics 5201: Session 3 - Faraway chapter 3
Load the libraries at the start of every session. Note that brglm has been replaced by brglm2. library(faraway) library(MASS) library(splines) library(arm) library(Sleuth2) library(dplyr) library(brglm) library(brglm2) library(ggplot2) library(mosaic) library(dplyr) library(mgcv) library(dispmod) library(epitools) options(digits = 3) Load the lib...
46203 sym R (21031 sym/152 pcs) 24 img
Biostatistics 5201: Session 5 - Faraway chapter 5
Chapter 5 library(faraway) library(pscl) library(MASS) library(mosaic) library(Sleuth2) library(arm) Poisson distribution plots Make some plots of Poisson distributions: barplot(dpois(0:5,0.5),xlab="y",ylab="Probability",names=0:5,main="mean = 0.5") barplot(dpois(0:10,2),xlab="y",ylab="Probability",names=0:10,main="mean = 2") barplot(dpois(0:1...
26753 sym R (56766 sym/249 pcs) 61 img