Page 1 of 1

what S3 or S4 method is a R2mlwin object?

Posted: Tue Aug 23, 2016 2:55 pm
by adeldaoud
Hi,

What S3 or S4 method is a R2mlwin object? I am specifically thinking about what arguments I can use for the linearHypothesis() function in the car package.

Related to this question, can one generally pass R2mlwin objects to other packages, e.g. the effects package? I know that R2mlwin object (if estimated with IGLS) is of class "mlwinfitIGLS". But I wonder if there some generality build in to mlwinfitIGLS similar to that of e.g. a lm objec?

Thanks

Re: what S3 or S4 method is a R2mlwin object?

Posted: Tue Aug 23, 2016 4:46 pm
by ChrisCharlton
When you call R2MLwiN you get back an mlwinfitIGLS S4 object if you fit the model using IGLS, an miwinfitMCMC S4 object if you fit the model using the MLwiN MCMC engine or an mcmc.list (defined by the coda package) object if you use it to generate and call BUGS code. As far as I am aware no other packages directly understand the R2MLwiN specific classes, however we do implement a number of R generic functions (e.g. coef and nobs) which allow them to be used by third party packages in functions such as linearHypothesis. Whether this works for individual packages will depend on whether we have implemented enough of the generic functions that can use.

Re: what S3 or S4 method is a R2mlwin object?

Posted: Tue Aug 23, 2016 5:08 pm
by adeldaoud
Thanks, Chris, for the clarification.
however we do implement a number of R generic functions (e.g. coef and nobs) which allow them to be used by third party packages in functions such as linearHypothesis. Whether this works for individual packages will depend on whether we have implemented enough of the generic functions that can use.
Are the specific R generic functions listed somewhere for the users reference? Would be great to have them a a guid.

Re: what S3 or S4 method is a R2mlwin object?

Posted: Tue Aug 23, 2016 5:28 pm
by ChrisCharlton
We don't currently list these altogether explicitly, however if you look in the PDF version of the documentation (https://cran.r-project.org/web/packages ... 2MLwiN.pdf) you will see that the methods for the IGLS classes all have mlwinfitIGLS-method in their names, and the MCMC ones have mlwinfitMCMC-method. You could also look directly at the code for these classes (e.g. https://github.com/rforge/r2mlwin/blob/ ... nfitIGLS.R) where you will see these defined with a setMethod function.