I've performed a cox regression in rstudio (version 1.0.136) using the coxph function in the package "OIsurv". I've also performed the same analysis on SPSS using the same dataset, but i keep on getting different results between the two programmes, and i cannot figure out why this is.
My data are not typical cox regression data, they are about learning in bumblebees. The experiment investigated whether parasitism has an effect on bee learning. Each bee underwent a series of 15 trials of the learning experiment.
The variables that i am analysing are:
Did bee learn - binary (0 = no, 1 = yes)
Time to first learned response - the number of trials it took the bee to first show a learned response. I observed bees for 15 trials, therefore for bees that did not learn (did bee learn = 0) , i inputted 15 into this column, as this was the trial where they were last censored.
Treatment - parasite or control
Forager or nest - whether the bee was a forager bee or a nest bee
Average thorax width - continuous variable, used as a proxy for bee size
Age - age of the bee when it underwent the learning trials
This is how my model looks in R:
mod7<-coxph(Surv(Time.to.first.learned.response, Did.bee.learn) ~ Forager.or.nest*Treatment + Treatment*Average.thorax.width + Age, data=survmotiv3per, method="breslow")
In SPSS
The time variable: 'time to first learned response' Status: 'did bee learn' (where 1 indicates the event having occurred) Covariates: these are exactly the same as the model in R
This is the call to COXREG:
COXREG Time.to.first.learned.response
/STATUS=Did.bee.learn(1) /CONTRAST(Forager.Y.N)=Indicator /CONTRAST(Treatment)=Indicator
/METHOD=ENTER Forager.Y.N Treatment Average.TW Age.when.tested Forager.Y.N*Treatment Average.TW*Treatment
/PRINT=CI(95)
/CRITERIA=PIN(.05) POUT(.10) ITERATE(20).
I did not change the default contrast settings on SPSS.
The differences seem to be occuring in the 'average thorax width' variable. This is coded as 'numeric' in R, and 'scale' in SPSS.
I have read that R and SPSS can produce different cox regression outputs due to their use of different methods of estimation. The default in SPSS is "Breslow", whereas in R it is "Efron". I manually changed the default in R and still the problem of having different results occurs.
Does anyone know why i am seeing different results here?
0.45407
in the R run to-.454
in the SPSS run $\endgroup$