Re: [R] Different behavior of model.matrix between R 3.2 and R3.1.1

2015-06-15 Thread Frank Harrell
Thank you very much Terry. I'm still puzzled at why this worked a year ago. What changed? I'd very much like to reverse the change by setting an argument somewhere or manipulating the terms object. I echo your sentiments about the general approach. Frank On 06/15/2015 09:05 AM, Therneau, T

Re: [R] Different behavior of model.matrix between R 3.2 and R3.1.1

2015-06-15 Thread Therneau, Terry M., Ph.D.
Frank, I don't think there is any way to "fix" your problem except the way that I did it. library(survival) tdata <- data.frame(y=c(1,3,3,5, 5,7, 7,9, 9,13), x1=factor(letters[c(1,1,1,1,1,2,2,2,2,2)]), x2= c(1,2,1,2,1,2,1,2,1,2)) fit1 <- lm( y ~ x1 * st

Re: [R] Different behavior of model.matrix between R 3.2 and R3.1.1

2015-06-14 Thread Frank Harrell
Terry - your example didn't demonstrate the problem because the variable that interacted with strata (zed) was not a factor variable. But I had stated the problem incorrectly. It's not that there are too many strata terms; there are too many non-strata terms when the variable interacting with

Re: [R] Different behavior of model.matrix between R 3.2 and R3.1.1

2015-06-11 Thread Therneau, Terry M., Ph.D.
Frank, I'm not sure what is going on. The following test function works for me in both 3.1.1 and 3.2, i.e, the second model matrix has fewer columns. As I indicated to you earlier, the coxph code removes the strata() columns after creating X because I found it easier to correctly create the