what S3 or S4 method is a R2mlwin object?

Welcome to the forum for R2MLwiN users. Feel free to post your question about R2MLwiN here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to R2MLwiN: Running MLwiN from within R >> http://www.bris.ac.uk/cmm/software/r2mlwin/
Post Reply
adeldaoud
Posts: 63
Joined: Sat Aug 15, 2015 4:00 pm

what S3 or S4 method is a R2mlwin object?

Post 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
ChrisCharlton
Posts: 1248
Joined: Mon Oct 19, 2009 10:34 am

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

Post 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.
adeldaoud
Posts: 63
Joined: Sat Aug 15, 2015 4:00 pm

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

Post 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.
ChrisCharlton
Posts: 1248
Joined: Mon Oct 19, 2009 10:34 am

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

Post 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.
Post Reply