-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interact_plot errors with scale
-ed variables
#33
Comments
So it seems the source of this problem is that This is such an odd case that I'm not sure if it's worth me trying to anticipate and fix at this juncture. A quick fix is to just do some simple coercion like this: library(interactions)
iris$Sepal.Length_c <- as.numeric(scale(iris$Sepal.Length, center = TRUE, scale = FALSE))
iris$Sepal.Width_c <- as.numeric(scale(iris$Sepal.Width, center = TRUE, scale = FALSE))
fit <- lm(Petal.Length ~ Sepal.Length_c * Sepal.Width_c, iris)
interact_plot(fit, pred = Sepal.Length_c, modx = Sepal.Width_c) |
I'm afraid that odd as it is, it is also common to center variables, especially in moderation analyses (especially in the social sciences). One of those things that just "caught on" and cannot be untaught :/ |
Well @mattansb I think you've been proven right as I've gotten at least two emails about this same problem since you created this issue. As it turns out, fixing this isn't as complicated as I first expected. The source of the problem was in my other package, To some extent, this is all just a quirk of how R automatically treats a one-dimensional matrix of numbers and a vector of numbers as if they are the same sometimes but not other times. Now my internal functions just do a check to see if what looks like a numeric variable is actually a one-dimensional matrix created by |
Thanks Jacob! |
However this doesn't happen with
sim_slopes
orjohnson_neyman
.Created on 2020-03-13 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: