Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9153295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:15:05+00:00 2026-06-17T12:15:05+00:00

I am using a regression model for some data whose explanatory variables can only

  • 0

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 plotenter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:15:06+00:00Added an answer on June 17, 2026 at 12:15 pm

    If you want a boxplot, you’ll have to explain in much more detail what you want it to be based on. (That is, this is a programming site; you would need to say how you wanted the results of the regression to be translated into the parameters of a boxplot (central line, fences, whiskers, etc.).)

    That said, you can use the coefplot function in the arm package to draw a graphical summary

    library(arm)
    coefplot(model)
    

    enter image description here

    Or, on second thought, maybe the model is a red herring: maybe you just want to plot the data.

    d <- data.frame(y,x1,x2,x3,x4,x5)
    library(reshape2)
    dm <- melt(d,id.var=1)
    library(ggplot2)
    ggplot(dm,aes(x=value,y=y))+geom_boxplot(aes(group=value))+
        facet_wrap(~variable,nrow=1)
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am training linear regression model using a data-set which has real valued labels
I have a regression model for some time series data investigating drug utilisation. The
I am plotting some data series along with regression lines using this code: ggplot(dt1.melt,
I calculated a model using OLS (multiple linear regression). I divided my data to
I'm using R package randomForest to do a regression on some biological data. My
I've trained a simple logistic regression model in SSAS, using Gender and NIC as
I am using the lfe package in R to do some regression with lots
In logistic regression SAS has the option to model 1 rather than 0 using
I'm currently developing a new set of regression tests for an interface using Selenium.
I'm using Watir 1.6.7. I'm working on developing some regression tests for a PeopleSoft

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.