Publications by Janet Rosenbaum

Epi 5201/7201 Project skill: Making table 1

09.06.2021

The purpose of this Rmarkdown file The table 1 of a paper shows the demographic composition of the sample. In this file, we’ll use the library table1 to make a table 1 that can be included in your papers. Define variables Before we can make a table, we need variables. Load libraries, including libraries for table: library(mosaic) library(reads...

15317 sym R (15342 sym/60 pcs) 3 tbl

Epi 5201/7201: Session 3-4 in class exercises - data display

21.06.2021

For homework, you will be making plots with HELPrct and you will also be doing analysis of YRBS: see the Homework 3 example Rmarkdown file for that. Load the libraries Load your libraries. library(mosaic) library(HistData) library(ggplot2) For each plot, I’ve made it in both mosaic/lattice and in ggplot. The ggplot commands are in the 3rd vers...

6260 sym R (2058 sym/25 pcs) 19 img

Epi 5201/7201 Project skill: Example analysis

15.06.2021

library(mosaic) library(readstata13) library(arm) setwd("../../datasets/yrbs2019") yrbs=read.dta13("yrbs2019.dta") Bivariate analysis Outcome variable: depression in past year Whenever we define a variable, we check that we did it correctly: yrbs$depression=yrbs$Q25=="Yes" tally(depression ~ Q25 , data=yrbs) ## Q25 ## depression Yes ...

8638 sym R (13840 sym/57 pcs)

Epi 5205/7202: Session 2 in class exercises - linear regression

21.06.2021

Load libraries library(mosaic) library(arm) library(Sleuth2) library(foreign) Building height and stories The 1994 World Almanac reports heights and number of stories for notable tall buildings in North America. The data in this data frame ex0728 are a random sample of size 60 of those for which dates of completion were available. Scatterplot �...

26496 sym R (8299 sym/53 pcs) 24 img

Epi 5201/7201: Session 13 survey data analysis

27.07.2021

Why we do data analysis in methods 1: I know this is hard. I introduce data analysis in methods 1 precisely because I know you don’t fully understand it and are copying and pasting and changing commands. That’s how I learned! Next time, you will have seen it already, and you will understand it better. It’s a skill that requires time and rep...

12419 sym R (16339 sym/50 pcs)

Epi 5201/7201: Session 11 missing data

18.01.2022

library(foreign) library(arm) library(sem) library(mosaic) library(readstata13) # Missing data library(mice) setwd("~/Dropbox/Epidemiology5205-spring2022/data/MIDUS data") M=read.dta13("midus-waves123.dta") Study 1: mental health and later hypertension Study 2: some college and later diabetes Study 3: hypertension and later gum disease Define so...

5190 sym R (10370 sym/20 pcs)

Epi 5205/7202: Session 5 in class exercises - hypothesis testing

06.10.2021

Fall 2021, Epidemiology 5201/7201 In-class exercise 5 Using the Health Evaluation and Linkage to Primary Care (HELPrct) dataset, do the following types of statistical hypothesis tests. Remember to load the mosaic library. We’re also using a new library for chi-square posthoc tests. We use message=F here so that we don’t have many screenfuls o...

10223 sym R (4723 sym/35 pcs) 7 img

Biostat 5201: Session 2: Using R for binary outcomes

28.08.2021

Load the libraries at the start of every session. Note that brglm has been replaced by brglm2. library(faraway) library(MASS) library(splines) library(mosaic) library(arm) library(Sleuth2) trellis.par.set(theme = col.mosaic()) library(dplyr) library(brglm2) library(brglm) library(ggplot2) options(digits = 3) Bird keeping and lung cancer Statist...

27550 sym R (22863 sym/180 pcs) 26 img

Biostat 5201: Session 1: Using R for Linear Regression

28.08.2021

R Markdown This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com. When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within t...

24381 sym R (20926 sym/152 pcs) 22 img

Document

12.01.2022

Load libraries We start out loading libraries: mosaic for the simpler commands, and Sleuth2 for the data. For Gelman and Hill’s book, we install and then load the arm package. (arm stands for the book’s title: Analysis using Regression and Multilevel (models)) We will also install the foreign package that lets us load in data formats from oth...

44316 sym R (30158 sym/189 pcs) 51 img