Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Crump 2014 Season of birth and other perinatal risk factors for melanoma
- #Int. J. Epidemiol. (2014) doi: 10.1093/ije/dyt277
- #Table 1 Data
- dat<-structure(list(`Birth Month` = c("January", "February", "March",
- "April", "May", "June", "July", "August", "September", "October",
- "November", "December"), Births = c(297241L, 291749L, 334787L,
- 331520L, 324466L, 305267L, 310043L, 300578L, 291196L, 278533L,
- 252598L, 253596L), `Person-years (Millions)` = c(5.47, 5.36,
- 6.2, 6.09, 5.88, 5.45, 5.44, 5.26, 5.13, 4.84, 4.41, 4.42), `CMM cases` = c(144L,
- 139L, 162L, 170L, 166L, 127L, 131L, 126L, 116L, 115L, 99L, 100L
- ), `Cases per 100 000 person-years` = c(2.63, 2.59, 2.61, 2.79,
- 2.82, 2.33, 2.41, 2.4, 2.26, 2.37, 2.25, 2.26)), .Names = c("Birth Month",
- "Births", "Person-years (Millions)", "CMM cases", "Cases per 100 000 person-years"
- ), row.names = c(NA, 12L), class = "data.frame")
- #Table 2 Data
- age.brackets<-seq(0,30,by=5)+2
- age.cases<-c(4,6,32,181,395,505,472)
- #Simulate researcher behaviour
- bday<-sample(1:360, 100000, replace=T)
- tday<-sample(120:210, 100000, replace=T)
- age.sim<-cbind(bday,tday,0,NA)
- colnames(age.sim)[3]<-"Age at Test"
- age.sim[which(age.sim[,1]<=age.sim[,2]),3]<-1
- age.sim<-age.sim[sort(age.sim[,1], index.return=T)$ix,]
- mo<-1
- for(i in seq(0,330,by=30)){
- age.sim[which(age.sim[,1]>i & age.sim[,1]<=(i+30)),4]<-mo
- mo=mo+1
- }
- #Use Rounded Age with April-July Followups
- pred.ages=NULL
- for(i in 1:12){
- pred.ages<-rbind(pred.ages,mean(age.sim[which(age.sim[,4]==i),3]))
- }
- #Use Days-Alive Dec 31st
- pred.ages2=NULL
- for(i in 1:12){
- pred.ages2<-rbind(pred.ages2,mean(360-age.sim[which(age.sim[,4]==i),1]))
- }
- #plots
- plot(1000000*dat[,3]/dat[,2], type="b", xlab="", xaxt="n",
- ylab= "person-years of follow up per birth",
- main= "Average age?")
- axis(side=1,at=1:12,labels=dat[,1])
- lines(1:12,17.4+pred.ages, type="l", col="Red", lwd=3)
- lines(17.4+pred.ages2/360, col="Blue", lwd=3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement