I am using a regression model for some data whose explanatory variables can only be 1,2,3,4 and 5
. There are 5 explanatory variables and a dependent variable. For example,
set.seed(2)
x1 <- sample(rep(1:5,2))
x2 <- sample(rep(1:5,2))
x3 <- sample(rep(1:5,2))
x4 <- sample(rep(1:5,2))
x5 <- sample(rep(1:5,2))
y <- runif(10,-1,1)
model <- lm(y~x1 + x2 + x3 + x4 + x5)
I want to create a box plot showing the relationship between these dependent variables and the dependent variable. How can I do that in R?
I have managed to create a box plot using the code provided by @Ben. However, there are some points in the plot that I do not understand. Any idea what they are for? Here is the plot