Hello, i'm a french student of medical oncology and i'm working on breast cancer. I have a variable with the histologic type of tumor wich is between 1 and 5. I use as.factor function to make some variable with level between 1 and 5. When i put it in the cox model i have only the level between 2 and 5. The level 1 doesn't appear. I think i have to change the number of level but i don't really know. Please can you help me? Class Levels: 1 2 3 4 5 coxph(formula = Surv(delai.etat, etat) ~ class, data = igr1) coef exp(coef) se(coef) z p class2 -0.093 0.911 0.245 -0.38 7.0e-01 class3 -0.749 0.473 0.286 -2.62 8.9e-03 class4 -0.600 0.549 0.343 -1.75 8.0e-02 class5 -0.874 0.417 0.197 -4.44 8.9e-06 Likelihood ratio test=24.9 on 4 df, p=5.28e-05 n=740 (1 observations deleted due to missing) Thanks for your help Bertrand
Dear Bertrand, There are only 4 degrees of freedom for a 5-level factor. By default, R creates contrasts for an unordered factor in a model formula using the function contr.treatment(), which, also by default, treats the first level of the factor (class, in your case) as the baseline or reference level. To see the contrasts, enter the command contrasts(igr1$class). A bit more information on contrasts is in Section 11.1.1 of the introductory manual that comes with R. I hope this helps, John -------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox --------------------------------> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of bertrand > Sent: Sunday, November 06, 2005 4:21 AM > To: r-help-request at stat.math.ethz.ch > Cc: r-help at stat.math.ethz.ch > Subject: [R] cox models > > Hello, > i'm a french student of medical oncology and i'm working on > breast cancer. I have a variable with the histologic type of > tumor wich is between 1 and 5. I use as.factor function to > make some variable with level between 1 and 5. When i put it > in the cox model i have only the level between 2 and 5. The > level 1 doesn't appear. I think i have to change the number > of level but i don't really know. Please can you help me? > > > Class > Levels: 1 2 3 4 5 > coxph(formula = Surv(delai.etat, etat) ~ class, data = igr1) > > > coef exp(coef) se(coef) z p > class2 -0.093 0.911 0.245 -0.38 7.0e-01 > class3 -0.749 0.473 0.286 -2.62 8.9e-03 > class4 -0.600 0.549 0.343 -1.75 8.0e-02 > class5 -0.874 0.417 0.197 -4.44 8.9e-06 > > Likelihood ratio test=24.9 on 4 df, p=5.28e-05 n=740 (1 > observations deleted due to missing) > > > > Thanks for your help > > > Bertrand > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html
Level 1 is treated as the "baseline". The coefficient for level 2 for example is for the hazard ratio between level 2 and level 1. Same thing for levels 3,4,5 in the output. HTH, On Sun, 6 Nov 2005, bertrand wrote:> Hello, > i'm a french student of medical oncology and i'm working on breast > cancer. I have a variable with the histologic type of tumor wich is > between 1 and 5. I use as.factor function to make some variable with > level between 1 and 5. When i put it in the cox model i have only the > level between 2 and 5. The level 1 doesn't appear. I think i have to > change the number of level but i don't really know. Please can you help > me? > > > Class > Levels: 1 2 3 4 5 > coxph(formula = Surv(delai.etat, etat) ~ class, data = igr1) > > > coef exp(coef) se(coef) z p > class2 -0.093 0.911 0.245 -0.38 7.0e-01 > class3 -0.749 0.473 0.286 -2.62 8.9e-03 > class4 -0.600 0.549 0.343 -1.75 8.0e-02 > class5 -0.874 0.417 0.197 -4.44 8.9e-06 > > Likelihood ratio test=24.9 on 4 df, p=5.28e-05 n=740 (1 observations > deleted due to missing) > > > > Thanks for your help > > > Bertrand > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > !DSPAM:436dcb0b22713230529779! >