[R] Survival model error
dwinsemius at comcast.net
Mon Nov 6 18:06:45 CET 2017
> On Nov 6, 2017, at 5:45 AM, Meghna Govil <megov31 at yahoo.com> wrote:
> Thanks David. Could you show me how to do that in my example ?
kmsurvival_np <- survfit(Surv( tte, censored) ~ . , data=train1_na)
I say "possibly" because I don't know whether all the columns of `train1_na` were included in the matrix you constructed. If they weren't then you would need to do something like:
kmsurvival_np <- survfit(Surv( tte, censored) ~ <lots of names separated by "+"'s> , data=train1_na)
The formalism of `reg_func( Y , Xm)` Where Xm is a matrix is typical for various machine-learning types of procedures, but breaks the "process-names-in-an-environment model of typical R regression functions. R regression functions often omit "step-down" options so loved by beginning SAS users.
>> On Nov 6, 2017, at 12:58 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>> You should stop trying to use matrices on the RHS and using separate vectors to Surv. Instead use a data argument and have the names in your formula refer to column names.
>> Sent from my iPhone
>>> On Nov 5, 2017, at 7:21 PM, Meghna Govil via R-help <r-help at r-project.org> wrote:
>>> Hi - Below is my code and then the error when I run the last line.
>>> time_np <- train1_na$tte
>>> event_np <- train1_na$censored
>>> X_np <- cbind(
>>> # Kaplan-Meier non-parametric analysis
>>> kmsurvival_np <- survfit(Surv(time_np,event_np) ~ X_np)
>>> Error in `[.default`(y, who, 1) : (subscript) logical subscript too long
>>> Any ideas?
>>> I have tried several things and still get this error.
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
Alameda, CA, USA
'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law
More information about the R-help