##Scripts for Cox Proportinal Hazard models, note that only the way I analyzed immune genes are different ##I used "R studio" , which might be necesary to run the scripts below. M ##Coxme citation: Therneau T. 2012. Coxme: mixed effects cox models.: Vienna: R Foundation for Statistical Computing. ___________________________________________________________________________________ #Script for single-locus het (0/1) for each immune gene library(coxme) mydata<- read.csv("C:/Users/zbateson/Desktop/CoxModel in R (01Jan2016)/APCcoxme input (n=116).csv") ##Must change pathway and change the \ to / in order for the file to be read correctly attach(mydata) View(mydata) time <- DaysO event <- Censor X <- cbind(Sex, Weight, SNPs, MHCI, TLR1B, TLR4, TLR5, TLR15, IL4, Blec1, BD11) # alternate: X <- cbind(Sex, Weight, SNPs, MHCI, TLR1B, TLR15, IL4, Blec1) model1<-coxme(Surv(time, event) ~ X + (1|FamilyID)) summary(model1) ____________________________________________________________________________________ #Script for allele-specific (0/1) [output used in survival analysis of APC immune study manuscript] library(coxme) mydata<- read.csv("C:/Users/zbateson/Desktop/CoxModel in R (01Jan2016)/APCcoxme input (n=116).csv") attach(mydata) View(mydata) time <- DaysO event <- Censor..breeding.season. X <- cbind(Sex, Weight, SNPs, All1, All2, All3, All4, All5, All6, All7, All8, All9, All10, All11, All12, All13, All14, All15, All16, All17, All18) " ##for conversion of allele names (All1, All2, etc) see file: "key to allele names.csv" model1<-coxme(Surv(time, event) ~ X + (1|FamilyID)) summary(model1) ___________________________________________________________________________________________________ #Script for starndarized het for immune genes library(coxme) mydata<- read.csv("C:/Users/zbateson/Desktop/CoxModel in R (01Jan2016)/APCcoxme input (n=116).csv") attach(mydata) View(mydata) X <- cbind(Sex, Weight, SNPs, 8genes.SH) model1<-coxme(Surv(time, event) ~ X + (1|FamilyID)) summary(model1)