Skip to main content
added 415 characters in body
Source Link
Dome
  • 21
  • 2

I found an outlier using the outlierTest function in the car package. However, I can see from the results that the Externally Studentized Residual and p-values. This is a result for the full model.

enter image description here

    rstudent unadjusted p-value Bonferroni p
348 5.872682         7.9377e-09   3.9689e-06

Cooks D Bar Plot:

enter image description hereenter image description here

After using removing the outlier I have used the ols_step_both_aic fromperformed normality test on residuals using the olsrr library and decidedfollowing code:

shapiro.test(resid(housing.lm)) 

R Console:

Shapiro-Wilk normality test

data:  resid(housing.lm)
W = 0.97068, p-value = 1.876e-08

The p-value is less than 0.05 indicating that 2 predictors are significant whichthe residuals may not be normally distributed. However, I assume it is not critical for linear regression as long as the other assumptions are bath and sqftmet.

I have also performed heteroscedasticity test using the following code:

ncvTest(housing.lm)

R console:

Non-constant Variance Score Test 
Variance formula: ~ fitted.values 
Chisquare = 0.3243994, Df = 1, p = 0.56898

When I fit the regression using the coded:

lm(price~ bath + sqft, data=without_outlierdata=data)

Summary: enter image description hereMy diagnostic plots looks as follows;

Although after removing the outlier sqft is not a significant predictor anymore. Did I make a wrong decision removing the outlier? If so why?enter image description here

Summary withWhen try to remove observation 348 based on the outlier:p-value sqft variable becomes insignificant. enter image description here

The diagnostic graphics from the chosen model look as follows:Is it better to keep it since it seems an influential point?

I found an outlier using the outlierTest function in the car package. However, I can see from the results that the Externally Studentized Residual and p-values. This is a result for the full model.

enter image description here

Cooks D Bar Plot:

enter image description here

After using removing the outlier I have used the ols_step_both_aic from the olsrr library and decided that 2 predictors are significant which are bath and sqft.

lm(price~ bath + sqft, data=without_outlier)

Summary: enter image description here

Although after removing the outlier sqft is not a significant predictor anymore. Did I make a wrong decision removing the outlier? If so why?

Summary with the outlier: enter image description here

The diagnostic graphics from the chosen model look as follows:

I found an outlier using the outlierTest function in the car package. However, I can see from the results that the Externally Studentized Residual and p-values. This is a result for the full model.

    rstudent unadjusted p-value Bonferroni p
348 5.872682         7.9377e-09   3.9689e-06

Cooks D Bar Plot:

enter image description here

I have performed normality test on residuals using the following code:

shapiro.test(resid(housing.lm)) 

R Console:

Shapiro-Wilk normality test

data:  resid(housing.lm)
W = 0.97068, p-value = 1.876e-08

The p-value is less than 0.05 indicating that the residuals may not be normally distributed. However, I assume it is not critical for linear regression as long as the other assumptions are met.

I have also performed heteroscedasticity test using the following code:

ncvTest(housing.lm)

R console:

Non-constant Variance Score Test 
Variance formula: ~ fitted.values 
Chisquare = 0.3243994, Df = 1, p = 0.56898

When I fit the regression using the coded:

lm(price~ bath + sqft, data=data)

My diagnostic plots looks as follows;

enter image description here

When try to remove observation 348 based on the p-value sqft variable becomes insignificant. Is it better to keep it since it seems an influential point?

added 8 characters in body
Source Link
User1865345
  • 10.3k
  • 12
  • 23
  • 40

I found an outlier using the outlierTest function in the car package. However, I can see from the results that the Externally Studentized Residual and p-values. This is a result for the full model.

enter image description here

Cooks D Bar Plot:

enter image description here

After using removing the outlier I have used the ols_step_both_aic from the olsrr library and decided that 2 predictors are significant which are bath and sqft.

lm(price~ bath + sqft, data=without_outlier)

lm(price~ bath + sqft, data=without_outlier)

Summary: enter image description here

Although after removing the outlier sqft is not a significant predictor anymore. Did I make a wrong decision removing the outlier? If so why?

Summary with the outlier: enter image description here

The diagnostic graphics from the chosen model look as follows:

I found an outlier using the outlierTest function in the car package. However, I can see from the results that the Externally Studentized Residual and p-values. This is a result for the full model.

enter image description here

Cooks D Bar Plot:

enter image description here

After using removing the outlier I have used the ols_step_both_aic from the olsrr library and decided that 2 predictors are significant which are bath and sqft.

lm(price~ bath + sqft, data=without_outlier)

Summary: enter image description here

Although after removing the outlier sqft is not a significant predictor anymore. Did I make a wrong decision removing the outlier? If so why?

Summary with the outlier: enter image description here

The diagnostic graphics from the chosen model look as follows:

I found an outlier using the outlierTest function in the car package. However, I can see from the results that the Externally Studentized Residual and p-values. This is a result for the full model.

enter image description here

Cooks D Bar Plot:

enter image description here

After using removing the outlier I have used the ols_step_both_aic from the olsrr library and decided that 2 predictors are significant which are bath and sqft.

lm(price~ bath + sqft, data=without_outlier)

Summary: enter image description here

Although after removing the outlier sqft is not a significant predictor anymore. Did I make a wrong decision removing the outlier? If so why?

Summary with the outlier: enter image description here

The diagnostic graphics from the chosen model look as follows:

Source Link
Dome
  • 21
  • 2

Outlier Detection using OutlierTest

I found an outlier using the outlierTest function in the car package. However, I can see from the results that the Externally Studentized Residual and p-values. This is a result for the full model.

enter image description here

Cooks D Bar Plot:

enter image description here

After using removing the outlier I have used the ols_step_both_aic from the olsrr library and decided that 2 predictors are significant which are bath and sqft.

lm(price~ bath + sqft, data=without_outlier)

Summary: enter image description here

Although after removing the outlier sqft is not a significant predictor anymore. Did I make a wrong decision removing the outlier? If so why?

Summary with the outlier: enter image description here

The diagnostic graphics from the chosen model look as follows: