In searching for NextMethod on http://www.rseek.org/ I found some helpful
tutorials on S3 and S4 methods.

Between your answer and the tutorials, I think I'm starting to understand.
 The NextMethod is just a dispatcher type of thing that doesn't do anything
directly.

I think you're saying that when lm is called on a boxcox object then this
part of the code handles it (maybe I have it backwards though).  So, can
you tell from this what the "next method" would be?  I tried doing
"debug(boxcox.default)" but there is no boxcox.default.

Did you mistakenly say "boxplot" instead of "boxcox" when referring to the
default method that does the "heavy lifting"?

I just want to see the code that calculates the log likelihood values of y
in boxcox.

Thank you


On Fri, Feb 14, 2014 at 4:33 PM, Bert Gunter <gunter.ber...@gene.com> wrote:

> Well, since this is really a question about understanding how S3
> methods work, and this is not the place for a tutorial, I think what
> you need to do is search out a tutorial that you understand.
>
> But very briefly, it does what it says. The "object" argument is
> supplied to the boxcox generic; lm() takes this (presumably a formula)
> as an argument and replaces the object argument with the fit, which is
> of "lm" class . NextMethod() then would call the next method,
> boxcox.lm on "object" . boxcox.lm does something similar, calling
> boxplot.default on the (possibly fixed up) fit, as that is the "next"
> method after boxplot.lm on "object."  boxplot.default is where all the
> work is done.
>
> *** If this is wrong in any way, I would appreciate being corrected.***
>
> Others may have useful tutorials that provide greater detail.
>
> Cheers,
> Bert
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
> (650) 467-7374
>
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
> H. Gilbert Welch
>
>
>
>
> On Fri, Feb 14, 2014 at 2:00 PM, Gene Leynes <gleyne...@gmail.com> wrote:
> > Yes I read the help on NextMethod.  In fact, since people frequently
> respond
> > with "did you read the help" I mentioned that I had read the help in my
> > original post.  I'm very grateful for the time and effort that people put
> > into answering questions, so I always try to answer the question myself
> > first usually for more than one day.
> >
> > I didn't find anything in ?NextMethod that helped me understand how
> > NextMethod works here:
> >>>     m <- length(lambda)
> >>>     object <- lm(object, y = TRUE, qr = TRUE, ...)
> >>>     result <- NextMethod()
> >
> > This part seemed like the the most likely part:
> >>
> >> NextMethod invokes the next method (determined by the class vector,
> either
> >> of the object supplied to the generic, or of the first argument to the
> >> function containing NextMethod if a method was invoked directly).
> >> NormallyNextMethod is used with only one argument, generic, but if
> further
> >> arguments are supplied these modify the call to the next method.
> >
> >
> > But, since NextMethod is called with no arguments, what "class vector"
> > determines the "next method"?  If this is invoking the "next" method,
> then
> > was the "previous" method?  How can it be called with no arguments?
> >
> > Maybe my problem is that I don't understand the S3 and S4 classes and I
> > should really read something else, because this help doesn't seem to
> stand
> > on it's own. I've been using R for a long time and this help left me
> > scratching my head.
> >
> > I don't actually care about NextMethod, I was just trying to figure out
> how
> > the boxcox function is calculating the y part of the return values.
>  Since I
> > couldn't figure it out from ?boxcox I tried to dig into the code, but I
> was
> > stymied by the code. Does the lm function compute the boxcox
> transformation?
> >
> >
> > On Thu, Feb 13, 2014 at 4:59 PM, Bert Gunter <gunter.ber...@gene.com>
> wrote:
> >>
> >> Have you tried:
> >>
> >> ?NextMethod
> >>
> >> ?
> >>
> >> -- Bert
> >>
> >> Bert Gunter
> >> Genentech Nonclinical Biostatistics
> >> (650) 467-7374
> >>
> >> "Data is not information. Information is not knowledge. And knowledge
> >> is certainly not wisdom."
> >> H. Gilbert Welch
> >>
> >>
> >>
> >>
> >> On Thu, Feb 13, 2014 at 2:17 PM, Gene Leynes <gleyne...@gmail.com>
> wrote:
> >> > I was trying to understand the boxcox function in MASS to get a better
> >> > understanding of where and how the log-Likelihood values are
> calculated.
> >> >
> >> > By using "debug(boxcox)" I found this code while running the examples:
> >> >
> >> >>     m <- length(lambda)
> >> >>     object <- lm(object, y = TRUE, qr = TRUE, ...)
> >> >>     result <- NextMethod()
> >> >
> >> >
> >> > Can someone tell me how this is optimizing the values for Lambda?  I'm
> >> > assuming that it has something to do with the qr decomposition that
> >> > happens
> >> > in lm?
> >> >
> >> >
> >> > Thank you,
> >> >
> >> > Gene
> >> >
> >> >
> >> >
> >> >
> >> > Notes and disclaimers:
> >> >
> >> >    - Yes, I read the help for NextMethod and boxcox.
> >> >    - I don't think my OS / R / MASS versions are relevant but if you
> >> > must
> >> >    know I happen to be on Windows 8 right now and using R version
> 3.0.2
> >> >    (2013-09-25) -- "Frisbee Sailing", Platform: x86_64-w64-mingw32/x64
> >> >    (64-bit).  MASS version is 7.3-29.
> >> >
> >> >         [[alternative HTML version deleted]]
> >> >
> >> > ______________________________________________
> >> > R-help@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.
> >
> >
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to