Marie-Pierre Sylvestre
2008-May-28 14:52 UTC
[R] Fixing the coefficient of a regressor in formula
Dear R users, I want to estimate a Cox PH model with time-dependent covariates so I am using a counting process format with the following formula: Surv(data$start, data$stop, data$event.time) ~ cluster(data$id) + G1 + G2 + G3 + G4 + G5 +G6 Gs represent a B-spline basis functions so they sum to 1 and I can't estimate the model as is without getting the last coefficient to be NA, which makes sense given the perfect collinearity. without getting in lengthy details about my code, let me just say that to avoid the colinearity problem,. I do not want to omit G1 from the regression. Instead, I want to fix the regression coefficient of one of the regressors, G1, to 1. I have read the R manual section on formulae but I have not found how to do fix a regression coefficient. Conceptually speaking it seems to me that it should be simple, and I am sure that someone explained it somewhere, but I did not find the proper keywords to find it! So, does someone know how to fix the coefficient of a regressor in the formula for Cox model so that the coefficient is not estimated but still taken into account? Thank you in advance, MP
Prof Brian Ripley
2008-May-28 16:24 UTC
[R] Fixing the coefficient of a regressor in formula
See ?offset On Wed, 28 May 2008, Marie-Pierre Sylvestre wrote:> Dear R users, > > I want to estimate a Cox PH model with time-dependent covariates so I am > using a counting process format with the following formula: > > Surv(data$start, data$stop, data$event.time) ~ cluster(data$id) + G1 + G2 + > G3 + G4 + G5 +G6 > > Gs represent a B-spline basis functions so they sum to 1 and I can't > estimate the model as is without getting the last coefficient to be NA, which > makes sense given the perfect collinearity. > > without getting in lengthy details about my code, let me just say that to > avoid the colinearity problem,. I do not want to omit G1 from the > regression. Instead, I want to fix the regression coefficient of one of the > regressors, G1, to 1. > > I have read the R manual section on formulae but I have not found how to do > fix a regression coefficient.I am not sure what section this is, but offset() is an advanced topic (just like cluster()).> Conceptually speaking it seems to me that it > should be simple, and I am sure that someone explained it somewhere, but I > did not find the proper keywords to find it! > > So, does someone know how to fix the coefficient of a regressor in the > formula for Cox model so that the coefficient is not estimated but still > taken into account? > > Thank you in advance, > > MP > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595