I know I have an Interaction on Posture and Sex and I want to visualize it. But it doesn't work as the picture shows (why are there vertical lines?)
I let rank pictures (with in differences in Gender (m/f) and Postures (Open/Closed)) in Intelligence (Ranking from 1 to 4)
y is always Intelligence.
I hoped to get along with # y_mean <- mean(y) , that I get the mean of Intelligence for f/m and open/closed, but this doesn't work.
I'm thankful for any advice or alternatives...
I base my code on http://philippmasur.de/blog/2018/11/26/visualizing-interaction-effects/
My Code was
library(ggplot2)
data2<-ForkinDatenElefant
y<- data2$Intelligence
m1 <-Sex
m2 <-Pos
# y_mean <- mean(y)
)
y_se <- std(y)
# Creating the plot
data2 %>%
ggplot(aes(x = m1,
y = y,
color = m2)) +
geom_line(aes(group = m2)) +
geom_point()
#+
# geom_errorbar(aes(ymin = y_mean-1.96*y_se,
ymax = y_mean+1.96*y_se),
width = .1) +
# ylim(0, 5) +
labs(x = "Sex",
color = "Pos",
y = "Dependent Variable") +
theme_minimal() +
scale_color_brewer(palette = "Blues")
```