Re: [R] passing an extra argument to an S3 generic

2012-02-09 Thread ilai
You do not provide mlm.influence() so your code can't be reproduced. Or did you mean to put lm.influence() in the formals to your hatvalues.mlm ? If yes, then 1) you have a typo 2) lm.influence doesn't allow you to pass on arguments, maybe try influence.lm instead. Elai On Thu, Feb 9, 2012 at 1

Re: [R] passing an extra argument to an S3 generic

2012-02-10 Thread Michael Friendly
On 2/9/2012 6:24 PM, ilai wrote: You do not provide mlm.influence() so your code can't be reproduced. Or did you mean to put lm.influence() in the formals to your hatvalues.mlm ? If yes, then 1) you have a typo 2) lm.influence doesn't allow you to pass on arguments, maybe try influence.lm inste

Re: [R] passing an extra argument to an S3 generic

2012-02-10 Thread Henrik Bengtsson
For these type of setups, I typically turn to "default" values, e.g. hatvalues.mlm <- function(model, m=1, infl=NULL, ...) { if (is.null(infl)) { infl <- mlm.influence(model, m=m, do.coef=FALSE); } hat <- infl$H m <- infl$m names(hat) <- if(m==1) infl$subsets else apply(infl$s

Re: [R] passing an extra argument to an S3 generic

2012-02-10 Thread Michael Friendly
On 2/10/2012 4:09 PM, Henrik Bengtsson wrote: So people may prefer to do the following: hatvalues.mlm<- function(model, m=1, infl, ...) { if (missing(infl)) { infl<- mlm.influence(model, m=m, do.coef=FALSE); } hat<- infl$H m<- infl$m names(hat)<- if(m==1) infl$subsets

Re: [R] passing an extra argument to an S3 generic

2012-02-11 Thread ilai
You are setting a new class ("inflmlm") at the end of mlm.influence. Remove that second to last line and enjoy your new S3 method. I'm not sure, but I think it is just the new class "inflmlm" applied to inf in the formals of hatvalues.mlm confused the dispatch mechanism. You would think the error

Re: [R] passing an extra argument to an S3 generic

2012-02-14 Thread Michael Friendly
On 2/11/2012 12:00 PM, ilai wrote: You are setting a new class ("inflmlm") at the end of mlm.influence. Remove that second to last line and enjoy your new S3 method. Thanks for the suggestion, but it doesn't help -- I still get the same behavior whether mlm.influence returns a classed object or

Re: [R] passing an extra argument to an S3 generic

2012-02-14 Thread ilai
Hi Michael, Try the attached. The only change to your script is in the first line where I explicitly tell hatvalues to use methods (the "infmlm" class stays). I also commented out all your TESTME at the end. source('mlminfl-testHELP.R') Now this should have worked for you too. Let me know. Sorry