pbreheny / visreg

Visualization of regression functions
http://pbreheny.github.io/visreg/
62 stars 18 forks source link

Error: no applicable method for 'family' #8

Closed pbreheny closed 9 years ago

pbreheny commented 9 years ago

Dr Nicholas E. Newton-Fisher (University of Kent) writes:

I’m using ‘visreg()’ to plot the results of GLMMs. I’ve hit an error that I thought I’d send to you as (a) it seems a little odd and (b) hopefully there’s a fix!

The error is:

Error in UseMethod("family") : no applicable method for 'family' applied to an object of class "glmmadmb"

The error only pops up if I try to specify

scale="response"

as an option in visreg().

pbreheny commented 9 years ago

The issue is that when you specify scale="response", visreg needs to know what the link function is in order to apply the inverse link and put things back on the response scale. To do that, it needs to be able to run

family(fit) This works for GLMs fit using glm(), glmer(), gam(), etc. If it does not work for the glmmadmb package, you should e-mail the authors of that package and request them to add it.

The simple fix for this is just to specify the inverse transformation yourself. I.e., if you're using a log link, just specify

trans=exp

to plot things on the response scale. But visreg can't automatically determine this unless the glmmadmd package cooperates.