1
$\begingroup$

Could you please check if what I've done is correct? and how could I improve some of them? Thank you in advance.

Suppose I have the following data (the original data its like 20 data with decimal numbers):

$$ \begin{array}{c|lcr} y &2&4&3&70&9 \\ \hline x & 0.24&21&33&11&10 \end{array} $$

  1. Draw a dispersion diagram of the data.

  2. Adjust a simple linear regression model.

  3. Find the SSE,SCModel, SCTotal.

  4. Find the model's errors.

Solution.

  1. Using the instruction plot(x,y,xlab="These are x's",ylab="These are y's").

  2. I think we want to find $\beta_0$ and $\beta_1$ in our segment line, that is we need to calculate $\hat \beta_0=\frac{(\sum y_i)(\sum x_i^2)-(\sum x_iy_i)(\sum x_i)}{n\sum x_i^2-(\sum x_i)^2}$ and $\hat \beta_1=\frac{n(\sum x_iy_i)-(\sum x_i)(\sum y_i)}{n\sum x_i^2-(\sum x_i)^2}$ with $n=5$ and substitute them in the model $y=\beta_0+\beta_1x$

Am I correct?

  1. I think this is calculated with $SSE=y'(I-M)y,\ where \ y=(2,4,3,70,9)',M=X(X'X)^{-1}X'$ and X=$\left( \begin{matrix} 1 & .24 \\ 1 & 21 \\ 1 & 33 \\ 1 & 11 \\ 1 & 10 \end{matrix}\right) $

$SCTotal=SSE+SSModel$ and $SCTotal=y'y$ so $SSModel$ can be calculated with $SCTotal-SSE$

Am I correct?

  1. Here am I asked to find $error=y-\hat y$ right?

How can I do that?

$\endgroup$

1 Answer 1

1
$\begingroup$
  1. It is called scatter plot generally.
  2. I would replace "Adjust" by "Fit"

Get the $\hat\beta_1$ first, then $\hat\beta_0 = \bar y - \hat\beta_1 \bar x$. Your $\hat\beta_0$ is complicated and I did not verify it.

  1. Suppose you mixed up SC and SS. All of them should be SS. SSTotal = $(y-\bar y)'(y-\bar y)$

  2. In the simple linear regression model $$ y=\beta_0 + \beta_1 x + \epsilon $$ $\epsilon$ is called error or error term. Its estimate is $y-\hat y$ and is called residual.

The question "Find the model's error" maybe means to find something that violates the assumptions of simple linear regression. For example the linearity between $y$ and $x$.

$\endgroup$
20
  • $\begingroup$ Hi, I was observing and I wonder why $\hat\beta_0 = \bar y - \hat\beta_1 \bar x$ ? Why the equality holds? Why did you take $\overline y$ and $\overline x$? $\endgroup$ Oct 30, 2018 at 1:13
  • $\begingroup$ By least square method, you get that $\hat \beta_0$. See en.wikipedia.org/wiki/Simple_linear_regression. Which equality holds? Taking $bar y$ and $\bar x$ are easy for calculation? $\endgroup$
    – user158565
    Oct 30, 2018 at 1:20
  • $\begingroup$ Ah I see, I did not know the alternative way to calculate $\hat\beta_0: (\hat\beta_0 = \bar y - \hat\beta_1 \bar x)$. I was referring to that same equality $(\hat\beta_0 = \bar y - \hat\beta_1 \bar x)$. I think yes, $\overline x,\overline y$ are easy to calculate using R or other software. $\endgroup$ Oct 30, 2018 at 1:28
  • $\begingroup$ Any other questions? My answers are understandable? $\endgroup$
    – user158565
    Oct 30, 2018 at 1:33
  • 1
    $\begingroup$ supposing $\hat β_0=5,\hat β_1=10$, then $ϵ_1=2−5−10*0.24 = -5.4$, $ϵ_2=4−5−10*21 = -211$, ... $\endgroup$
    – user158565
    Oct 30, 2018 at 2:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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