A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/jacob-long/interactions/issues/33 below:

interact_plot errors with `scale`-ed variables · Issue #33 · jacob-long/interactions · GitHub

library(interactions)

iris$Sepal.Length_c <- scale(iris$Sepal.Length, center = TRUE, scale = FALSE)
iris$Sepal.Width_c <- 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)
#> Error: variables 'Sepal.Length_c', 'Sepal.Width_c' were specified with different types from the fit

However this doesn't happen with sim_slopes or johnson_neyman.

sim_slopes(fit, pred = Sepal.Length_c, modx = Sepal.Width_c)
#> JOHNSON-NEYMAN INTERVAL 
#> 
#> When Sepal.Width_c is OUTSIDE the interval [-10.36, -2.05], the slope of
#> Sepal.Length_c is p < .05.
#> 
#> Note: The range of observed values of Sepal.Width_c is [-1.06, 1.34]
#> 
#> SIMPLE SLOPES ANALYSIS 
#> 
#> Slope of Sepal.Length_c when Sepal.Width_c = -0.44 (- 1 SD): 
#> 
#>   Est.   S.E.   t val.      p
#> ------ ------ -------- ------
#>   1.53   0.10    14.78   0.00
#> 
#> Slope of Sepal.Length_c when Sepal.Width_c =  0.00 (Mean): 
#> 
#>   Est.   S.E.   t val.      p
#> ------ ------ -------- ------
#>   1.75   0.06    27.64   0.00
#> 
#> Slope of Sepal.Length_c when Sepal.Width_c =  0.44 (+ 1 SD): 
#> 
#>   Est.   S.E.   t val.      p
#> ------ ------ -------- ------
#>   1.97   0.09    21.75   0.00

johnson_neyman(fit, pred = Sepal.Length_c, modx = Sepal.Width_c)
#> JOHNSON-NEYMAN INTERVAL 
#> 
#> When Sepal.Width_c is OUTSIDE the interval [-10.36, -2.05], the slope of
#> Sepal.Length_c is p < .05.
#> 
#> Note: The range of observed values of Sepal.Width_c is [-1.06, 1.34]

Created on 2020-03-13 by the reprex package (v0.3.0)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4