[R] ask for a question with cch function

Bill.Venables at csiro.au Bill.Venables at csiro.au
Wed Sep 29 00:13:56 CEST 2010


It would help if you were to tell up which package you are talking about.  I take it this is the survival package and this is the proportioanl hazards fitting function for case-cohort data.  

You would have seen earlier in the code that

    method <- match.arg(method)

so at that stage 'method' is a character string.  The default is "Prentice".

so

    fitter <- get(method)

will search for an object whose name matches that character string and return it.  Presumably this is a fitting function requested on the call to fit the model.

So the answer to your question is "The fitter here is whatever method the user specified on the call.  If none were specified it defaults to Prentice()."

Next you will probably want to know where Prentice() can be found.  The answer is "inside the survival NAMESPACE", and it is not exported.  So to see that function you will need to use

    survival:::Prentice

This will most likely become very tedious and ultimately frustrating.  You can always look at code - that's the facility that open source software is famous for providing - but it really is a last resort.  You are much better reading the documentation very carefully and checking the examples provided.  Trust me, I'm a statistician.

Bill Venables.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Qian Xiyuan
Sent: Wednesday, 29 September 2010 6:00 AM
To: r-help at r-project.org
Subject: [R] ask for a question with cch function

Dear all,
I am reading the cch function source code. But I can not understand the
following codes. Please help me.
What's the fitter here?

 fitter <- get(method)
 out <- fitter(tenter = tenter, texit = texit, cc = cc, id = id, X = X, ntot
= nn, robust = robust)

	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list