pbreheny / visreg

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

Why do I get a warning when specifying re.form? #65

Closed pbreheny closed 5 years ago

pbreheny commented 5 years ago

Why do I see the error message:

"re.form" is not a graphical parameter

(question asked over e-mail)

pbreheny commented 5 years ago

There are actually two functions that are executed when you run visreg:

visreg()        # This does the statistical calculations
plot.visreg()   # This does the plotting

Typically, users just call:

visreg(fit, 'x')

which does both the calculating and the plotting. However, you can separate the two:

v <- visreg(fit, 'x', plot=FALSE)
plot.visreg(v)

The underlying issue here is that visreg must allow generic passing of arguments to both the calculating function and the plotting function -- you need to pass things like re.form to the lme4 package, and things like main to plot(). If you separate them, it's explicit whether re.form is a calculation option or a graphics option. If you combine them, however, visreg has to pass the argument to both functions to see if they can use them. Most generic functions do not return a warning if you try to pass an argument that it doesn't recognize, but for whatever reason, that is not how plot() works.

Anyway, the warning is harmless, so you can ignore it, or separate the visreg() command into two lines if you don't want to see the warning.