From therne@u @ending from m@yo@edu  Wed Jun 27 22:54:20 2018
From: therne@u @ending from m@yo@edu (Therneau, Terry M., Ph.D.)
Date: Wed, 27 Jun 2018 15:54:20 -0500
Subject: [Rd] new behavior of model.response
In-Reply-To: <20C1444B-196C-4E35-A0E1-3C043830CC3B@ucsd.edu>
References: <bb6fa2$9mi8qn@ironport10.mayo.edu>
 <20C1444B-196C-4E35-A0E1-3C043830CC3B@ucsd.edu>
Message-ID: <bb6fa2$9mjhpq@ironport10.mayo.edu>

Charles Berry pointed out an error in my reasoning.?? In the current survival I forgot the 
S3method line for length in the NAMESPACE file, so the behavior is really not new.? 
Nonetheless it remains surprising and non-intuitive.? Why does model.response sometimes 
attach spurious names, when the Surv object itself does not have them?

Terry


tmt% R --vanilla
R version 3.4.2 (2017-09-28) -- "Short Summer"

test <- data.frame(time=1:8, status=rep(0:1, 4), age=60:67)
row.names(test) <- letters[1:8]

library(survival)

mf2 <- model.frame(Surv(time, status) ~ age, data=test)
names(mf2[[1]])
# NULL
names(model.response(mf2))
# NULL

length.Surv <- survival:::length.Surv

names(model.response(mf2))
 ?# [1] "a" "b" "c" "d" "e" "f" "g" "h" NA? NA? NA? NA? NA? NA? NA NA


	[[alternative HTML version deleted]]



[Rd] new behavior of model.response
Therneau, Terry M., Ph.D.