Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3720818
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:20:39+00:00 2026-05-19T05:20:39+00:00

I would like to get the survival objects which are created by the ctree

  • 0

I would like to get the survival objects which are created by the ctree function.
The reason is that I would like to get the vectors which describe the curves in each leaf of the tree.

Does anyone know how to do that?

Thanks in advance!
Alley

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:20:40+00:00Added an answer on May 19, 2026 at 5:20 am

    You can get at the curves using the treeresponse method. There might be a much better way, but this is what I came up with.

    Here is an illustration using the example of a survival tree from ?ctree:

    require(party)
    data("GBSG2", package = "ipred")
    GBSG2ct <- ctree(Surv(time, cens) ~ .,data = GBSG2)
    plot(GBSG2ct)
    

    We grab the (fitted) responses, using treeresponse for the training data. This is a list, with a component for each observation in the training data.

    out <- treeresponse(GBSG2ct)
    

    Each component out out is a survival object, class "survfit"

    > class(out[[1]])
    [1] "survfit"
    

    For this tree we have four terminal nodes, so there are only four unique survival objects. You can use the where method to see which nodes the observations were in

    wnode <- where(GBSG2ct)
    

    We can use this index the unique survival objects. For example, for node 3 (the leftmost node in the plot of the tree)

    > n3 <- which(wnode == 3 & !duplicated(wnode))
    > n3
    [1] 1
    > out[[n3]]
    > out[[n3]]
    records   n.max n.start  events  median 0.95LCL 0.95UCL 
        686     248     248      88    2093    1814      NA
    

    The survival curve for node 3 can be plotted using the plot method:

    plot(out[[n3]], conf.int = FALSE, mark.time = FALSE)
    

    suvival plot for node 3 of the example tree

    which, apart from the range on the axes is the plot used in the panel for node 3 on the tree drawn earlier.

    For this example, you can repeat for nodes 4, 6 and 7, but you’ll need to tailor which nodes you work with to your data and fitted tree.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to get numbers of comments for each posts using mysql. I
I would like to get View instance that is used to display specific Preference
I would like to get the output of some command line argument (which I'm
I would like to get some advise. I have an application which consist of
I would like to get a list of all symlinks within a directory that
Would like to get the contacts created using the contacts app in the emulator
I would like to get all the files that a sub-folder holds in a
I would like to get your opinion on which of the following routines should
i would like to get rid of the defualt grey bar which apears at
I would like get 3 random stamps, but each from different country. This query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.