raceOR <- subset(races, races$t %% 14 == 0) raceOR$oddsratio = 0 for(i in 0:12) { for(j in 1:6) { a = raceOR$survived[(i*6)+4] c = raceOR$evdeath[(i*6)+4] if(j == 4) { raceOR$oddsratio[(i*6)+j] = 1.00 next } b = raceOR$survived[(i*6)+j] d = raceOR$evdeath[(i*6)+j] raceOR$oddsratio[(i*6)+j] = (a * d) / (b * c) } } ggplot(data = raceOR, aes(x = DATE, y = oddsratio)) + geom_line(aes(color=RACE), size = 1) raceOR2 <- subset(raceOR, raceOR$t > 0 & raceOR$t < 160) ggplot(data = raceOR2, aes(x = DATE, y = survrate)) + geom_line(aes(color=RACE), size = 1) ageOR <- subset(ages, ages$t %% 14 == 0) ageOR$oddsratio = 0 for(i in 0:12) { for(j in 1:10) { a = ageOR$survived[(i*10)+5] c = ageOR$evdeath[(i*20)+5] if(j == 5) { ageOR$oddsratio[(i*10)+j] = 1.00 next } b = ageOR$survived[(i*10)+j] d = ageOR$evdeath[(i*10)+j] ageOR$oddsratio[(i*10)+j] = (a * d) / (b * c) } } ggplot(data = ageOR, aes(x = DATE, y = oddsratio)) + geom_line(aes(color=AGE), size = 1) ageOR2 <- subset(ageOR, ageOR$t > 0 & ageOR$t < 160) ggplot(data = ageOR2, aes(x = DATE, y = survrate)) + geom_line(aes(color=AGE), size = 1) sexOR <- subset(sexes, sexes$t %% 14 == 0) sexOR$oddsratio = 0 for(i in 0:12) { for(j in 1:3) { a = sexOR$survived[(i*3)+2] c = sexOR$evdeath[(i*3)+2] if(j == 2) { sexOR$oddsratio[(i*3)+j] = 1.00 next } b = sexOR$survived[(i*3)+j] d = sexOR$evdeath[(i*3)+j] sexOR$oddsratio[(i*3)+j] = (a * d) / (b * c) } } ggplot(data = sexOR, aes(x = t, y = oddsratio)) + geom_line(aes(color=SEX), size = 1) agepie <- subset(ages, )