The problem described is not with coxph, but with argument matching. It
is a common issue.
The Splus argument matching model is that a function can see data in
the directory list (what search() lists) plus ONE more place, for the
purpose of matching its arguments.
Normally that "one more place" is the parent function that called it,
but when we use a modeling function with a "data=" statement, the one more
place is the named data frame.
In your example
junk <- function(i) {
temp1 <- i
coxph(Surv..... ~dd[i], data=dd)
}
That interior coxph call sees data in data frame "dd", but the variable "temp1"
is invisible. So is the local variable "i". You get the result that you do
because there is a variable "i" in your working directory with some value.
If you had used ...dd[temp1] ... in the call you would have seen "temp1 not
found" as a message.
Terry Therneau
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|