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

  • Home
  • SEARCH
  • 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 rid of the defualt grey bar which apears at
Would like to get a list of advantages and disadvantages of using Stored Procedures.
I would like to get data from from different webpages such as addresses of
I would like to get up-to-date information on Google's index of a website, and
I would like to get the path to the execution directory of a Windows
I would like to get the absolute position of an element in relation to
I would like to get a list of the wireless networks available. Ideally this
I would like to get all the instances of an object of a certain
I'm a lone developer who would like to get some structure to my projects.
I have taken over a large code base and would like to get an

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.