1
$\begingroup$

I have a hypothetical data given below that consists of 11 pairs of points (xi, yi ), to which the simple linear regression mean function $\mathbb E(y|x) = β_0 + β_1x$ is fit.:

 X     Y
 10    8.04
  8    6.95
 13    7.58
  9    8.81
 11    8.33
 14    9.96
  6    7.24
  4    4.26
 12    10.84
  7    4.82
  5    5.68

I have got intercept parameter,$\beta_0=3.001$

But the plot of the data is not showing the y-intercept is $3.001$. Rather the y-intercept is more than $3.001$. WHY?

enter image description here

I have used R software to calculate the parameters, $\beta_0$,$\beta_1$ and also to produce the plot.

 x1 <- c(10,8,13,9,11,14,6,4,12,7,5)
 y1 <- c(8.04,6.95,7.58,8.81,8.33,9.96,7.24,4.26,10.84,4.82,5.68)

 lm(y1~x1)

 plot(y1~x1)
 abline(lm(y1~x1))

EDIT

  ht <- c(169.6,166.8,157.1,181.1,158.4,165.6,166.7,156.5,168.1,165.3)
  wt <- c(71.2,58.2,56.0,64.5,53.0,52.4,56.8,49.2,55.6,77.8)

  lm(wt~ht)

  windows(9,6)
  par(mfrow=c(1,2))

  plot(wt~ht)
  abline(lm(wt~ht))

  plot(wt~ht,xlim=c(0,180),ylim=c(0,75))
  abline(lm(wt~ht))

enter image description here

How can i get the y-intercept? By expanding the straight line(population regression line) to negative axis of Y ?

$\endgroup$
  • 3
    $\begingroup$ why do you say so? we do not see the $\{x=0\}$ part of the graph. $\endgroup$ – mookid Mar 13 '14 at 2:57
  • $\begingroup$ Exactly, if you extend the line for $x1<4$, which is not shown in the graph, it will probably be $y1=3.001$ for $x1=0$. $\endgroup$ – Nameless Mar 13 '14 at 11:46
  • $\begingroup$ I will migrate to Cross Validated as suggested. As you have already registered an account there, you can edit in the suitable tags yourself on the website. $\endgroup$ – Willie Wong Mar 13 '14 at 11:55
  • 2
    $\begingroup$ This question seems to be predicated on a different understanding of "intercept": it is not where the graph meets the left hand of its box, but rather its value at $0$, whether or not $0$ appears within the extent of the plot. $\endgroup$ – whuber Mar 13 '14 at 13:39
  • $\begingroup$ In your plot, x=0 is not included.. try to use a larger x range. $\endgroup$ – TYZ Mar 13 '14 at 13:41
5
$\begingroup$

The intercept is in the right place. The problem is that plot() doesn't usually show the origin unless there are data points there. Note how the plot(y1~x1) starts at roughly $(4,4)$, not $(0,0)$. This isn't an error, just a result of us confusing plot borders with plane axes. Anyway, in order to force R to show the intercept where we'd expect it to be, you have to use the parameters xlim and ylim of the plot function. Try running this:

plot(y1 ~ x1, xlim = c(0, 14), ylim = c(0, 11))
abline(lm(y1 ~ x1))

And it give you what you want, i.e.:

plot

| cite | improve this answer | |
$\endgroup$
2
$\begingroup$

Try

plot(y1~x1, xlim=c(0,14))

instead.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ I get the true picture while using the command plot(y1~x1,xlim=c(0,14),ylim=c(0,14)). But how does the y-intercept change for changing the origin $(x,y)$$=(0,0)$ $\endgroup$ – user 31466 Mar 13 '14 at 5:38
  • $\begingroup$ How can i get the appropriate picture of y-intercept parameter ,$\beta_0$ , if the data are ht <- c(169.6,166.8,157.1,181.1,158.4,165.6,166.7,156.5,168.1,165.3) wt <- c(71.2,58.2,56.0,64.5,53.0,52.4,56.8,49.2,55.6,77.8) and lm(wt~ht) ? I have edited the graph of this data. $\endgroup$ – user 31466 Mar 13 '14 at 6:12
1
$\begingroup$

You can try this

x1 <- c(169.6,166.8,157.1,181.1,158.4,165.6,166.7,156.5,168.1,165.3) 
y1 <- c(71.2,58.2,56.0,64.5,53.0,52.4,56.8,49.2,55.6,77.8)

lm1 <- lm(y1 ~ x1)$coef
plot(y1 ~ x1, xlim = c(0, max(x1)), ylim = c(min(0,lm1[1]), max(y1)))
abline(lm1)

Of course it's practically meaningless to look at the intercept in the first place (since y can't be negative), but if you want to get this point across...

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.