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, 2022 452 views

## 1 answer to this question.

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)

Discover the world of data with our Data Science Course and embark on a transformative journey towards analytical excellence.

• 3,040 points

## Stepwise AIC using forward selection in R

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

## Understanding of minbucket function in CART model using R

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

## How to plot two histograms together in R?

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

## Introduction to Statistical Learning with Applications in R Figure Codes

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

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

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

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

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

## do-while loop in R

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

## What does c do in R?

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