Add two lines on graph using abline in R

0 votes
I'm working with two variables:

x=rnorm(10, 5, 1) x=c(rnorm(10, 5, 1) x=c(rnorm(10

y=rnorm(10, 5, 1) y=c(rnorm(10, 5, 1) y=c(rnorm(10

I want to plot a vertical line at the corresponding x value of the maximum y. I tried abline(v=max(y)) but that did not bring the line up. I am able to get a horizontal line for that max(y) but no vertical line for the corresponding x. I want two line on the point, essentially.
Jun 13 in Data Science by Avinash
• 1,260 points
15 views

1 answer to this question.

0 votes
I am using "y 0+x" to fit a model without an intercept as I implement a linear model in R. Why does the line not pass through the origin when I use "abline(0, 2.08193)"? How can this be fixed?

x <- c

(2.9, 6.7, 8.0, 3.1, 2.0, 4.1, 2.2, 8.9, 8.1, 7.9, 5.7, 1.6, 6.6, 3.0, 6.3)

y <- c

(5.118289 17.168719 14.489016 7.340286 8.422882 7.994184 4.455667 17.529257 16.628453 17.076216 14.855261 2.596441 12.039215 6.684931 11.456480)

mod0 <- lm(formula = y ~ 0+x)

plot(x,y, xlab="x ", ylab="y ")

summary(mod0)
answered Jun 24 by Sohail
• 2,960 points

Related Questions In Data Science

0 votes
0 answers

Stepwise AIC using forward selection in R

In R, I'm attempting to perform a ...READ MORE

Jun 24 in Data Science by Sohail
• 2,960 points
7 views
0 votes
0 answers

Understanding of minbucket function in CART model using R

Let's say that the training data is ...READ MORE

Jul 20 in Data Science by avinash
• 1,840 points
4 views
0 votes
0 answers

How to plot two histograms together in R?

I have two data frames, one each ...READ MORE

Jul 22 in Data Science by avinash
• 1,840 points
9 views
0 votes
0 answers

Introduction to Statistical Learning with Applications in R Figure Codes

I recently bought the following book: An Introduction ...READ MORE

Jun 1 in Data Science by avinash
• 1,840 points
31 views
0 votes
1 answer

Difference between the == and %in% operators in R

According to help('percent in percent'), percent in ...READ MORE

answered Jun 23 in Data Science by Sohail
• 2,960 points
14 views
0 votes
1 answer

How to make loop for one-at-a time logistic regression in R?

You're probably looking for something similar to ...READ MORE

answered Jun 20 in Data Science by Sohail
• 2,960 points
56 views
0 votes
1 answer

do-while loop in R

Unlike for and while loops, which test the loop condition at ...READ MORE

answered Jun 1 in Data Science by Sohail
• 2,960 points
32 views
0 votes
1 answer

What does c do in R?

The c function in R programming usually stands ...READ MORE

answered Jun 1 in Data Science by Sohail
• 2,960 points
23 views
0 votes
1 answer

How to implement Knn-algorithm without using k-nn function in r?

I created an example that demonstrates the ...READ MORE

answered Jun 24 in Data Science by Sohail
• 2,960 points
13 views
0 votes
1 answer

Difference between the == and %in% operators in R

percent in percent "returns a vector of ...READ MORE

answered Jun 20 in Data Science by Sohail
• 2,960 points
20 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP