Essays.club - Получите бесплатные рефераты, курсовые работы и научные статьи
Поиск

Residuals vs Fitted

Автор:   •  Февраль 15, 2024  •  Контрольная работа  •  620 Слов (3 Страниц)  •  24 Просмотры

Страница 1 из 3

Assignment 4

  1. (a)

To simulate a dataset containing 100 random observations for which the assumptions of a simple linear regression model are appropriate, we need an independent variable(x) and response variable(y).

y=5*x + random error

Simulation of independent variable (x)

x <- rnorm(100, 20, 2)

[pic 1]

Simulation of random error:

re <- rnorm(100, 0, 2)

y <- 5 * x + re

dataset <- data.frame(x, y)

[pic 2]

(b)

plot(x,y, xlab = "Independent Variable (x)", ylab = "Response Variable (y)")

[pic 3]

[pic 4]

abline(model$coefficients)

[pic 5]

(c)

par(mfrow = c(2, 2))

plot(model)

[pic 6]

On plot Residuals vs Fitted we can see that residuals are spread around the horizontal line and do not show any distinct non-linear patterns.

The plot Q-Q Residuals shows that residuals do follow a straight line well and are normally distributed.

The Scale-location plot shows that residuals are spread almost equally along the ranges of predictors. The homoscedasticity condition is met.

The last plot shows that there are no influential cases to the regression results, no cases are outside of the Cook’s distance line.

So we can say that the residual diagnostic plots for the simulated data are acceptable.

(d)

[pic 7][pic 8]

[pic 9]

On plot Residuals vs Fitted residuals are spread around the horizontal line and do not seem to show any distinct non-linear patterns. On the second plot residuals seem to follow a straight line but there are observations that are more remote. The Scale-location plot is difficult to analyse due to the small number of observations that are spread widely. The last plot shows that there are no influential cases to the regression results, no cases are outside of the Cook’s distance line.

So it is really harder to tell if the assumptions are appropriate when we have fewer data points as they are spread more widely and it becomes harder to see the patterns.

(e)

[pic 10][pic 11]

The observations are widely spread so it is hard to tell for now whether linear regression model is appropriate in this case, we should check residuals.

[pic 12]

On plot Residuals vs Fitted residuals are not that equally spread around the horizontal line, but it still do not seem to show any distinct non-linear patterns.

...

Скачать:   txt (4 Kb)   pdf (910.7 Kb)   docx (922.4 Kb)  
Продолжить читать еще 2 страниц(ы) »
Доступно только на Essays.club