Note that there are some explanatory texts on larger screens.

plurals
  1. POWhich function/package for robust linear regression works with glmulti (i.e., behaves like glm)?
    primarykey
    data
    text
    <h1>Background: Multi-model inference with <em>glmulti</em></h1> <p><a href="http://www.jstatsoft.org/v34/i12/paper" rel="noreferrer"><em>glmulti</em></a> is a R function/package for automated model selection for general linear models that constructs all possible general linear models given a dependent variable and a set of predictors, fits them via the classic <a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/glm.html" rel="noreferrer"><em>glm</em></a> function and allows then for multi-model inference (e.g., using model weights derived from AICc, BIC). <i>glmulti</i> works in theory also with any other function that returns coefficients, the log-likelihood of the model and the number of free parameters (and maybe other information?) in the same format that <em>glm</em> does.</p> <h1>My goal: Multi-model inference with robust errors</h1> <p>I would like to use <em>glmulti</em> with robust modeling of the errors of a quantitative dependent variable to guard against the effect out outliers.</p> <p>For example, I could assume that the errors in the linear model are distributed as a <a href="http://en.wikipedia.org/wiki/Student%27s_t-distribution" rel="noreferrer">t distribution</a> instead of as a normal distribution. With its kurtosis parameter the t distribution can have heavy tails and is thus more robust to outliers (as compared to the normal distribution).</p> <p>However, I'm not committed to using the t distribution approach. I'm happy with any approach that gives back a log-likelihood and thus works with the multimodel approach in <em>glmulti</em>. But that means, that unfortunately I cannot use the well-known robust linear models in R (e.g., <em>lmRob</em> from <a href="http://cran.r-project.org/web/packages/robust/" rel="noreferrer">robust</a> or <em>lmrob</em> from <a href="http://cran.r-project.org/web/packages/robustbase/" rel="noreferrer">robustbase</a>) because they do not operate under the log-likelihood framework and thus cannot work with <em>glmulti</em>.</p> <h1>The problem: I can't find a robust regression function that works with <em>glmulti</em></h1> <p>The only robust linear regression function for R I found that operates under the log-likelihood framework is <em>heavyLm</em> (from the <a href="http://cran.r-project.org/web/packages/heavy/index.html" rel="noreferrer">heavy</a> package); it models the errors with a t distribution. Unfortunately, <em>heavyLm</em> does not work with <em>glmulti</em> (at least not out of the box) because it has no S3 method for <em>loglik</em> (and possibly other things).</p> <p>To illustrate:</p> <pre><code>library(glmulti) library(heavy) </code></pre> <p>Using the dataset <em>stackloss</em></p> <pre><code>head(stackloss) </code></pre> <p>Regular Gaussian linear model:</p> <pre><code>summary(glm(stack.loss ~ ., data = stackloss)) </code></pre> <p>Multi-model inference with <em>glmulti</em> using <em>glm</em>'s default Gaussian link function</p> <pre><code>stackloss.glmulti &lt;- glmulti(stack.loss ~ ., data = stackloss, level=1, crit=bic) print(stackloss.glmulti) plot(stackloss.glmulti) </code></pre> <p>Linear model with t distributed error (default is df=4)</p> <pre><code>summary(heavyLm(stack.loss ~ ., data = stackloss)) </code></pre> <p>Multi-model inference with <em>glmulti</em> calling <em>heavyLm</em> as the fitting function</p> <pre><code>stackloss.heavyLm.glmulti &lt;- glmulti(stack.loss ~ ., data = stackloss, level=1, crit=bic, fitfunction=heavyLm) </code></pre> <p>gives the following error:</p> <pre><code> Initialization... Error in UseMethod("logLik") : no applicable method for 'logLik' applied to an object of class "heavyLm". </code></pre> <p>If I define the following function,</p> <pre><code>logLik.heavyLm &lt;- function(x){x$logLik} </code></pre> <p>glmulti can get the log-likelihood, but then the next error occurs:</p> <pre><code> Initialization... Error in .jcall(molly, "V", "supplyErrorDF", as.integer(attr(logLik(fitfunc(as.formula(paste(y, : method supplyErrorDF with signature ([I)V not found </code></pre> <h1>The question: Which function/package for robust linear regression works with glmulti (i.e., behaves like glm)?</h1> <p>There is probably a way to define further functions to get <em>heavyLm</em> working with <em>glmulti</em>, but before embarking on this journey I wanted to ask whether anybody</p> <ul> <li>knows of a robust linear regression function that (a) operates under the log-likelihood framework and (b) behaves like <i>glm</i> (and will thus work with <i>glmulti</i> out-of-the-box).</li> <li>got <i>heavyLm</i> already working with <i>glmulti</i>.</li> </ul> <p>Any help is very much appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload