Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Studentized residuals vs leverage plot should return threshold value #17

Closed
aravindhebbali opened this issue Jun 3, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@aravindhebbali
Copy link
Member

commented Jun 3, 2017

ols_rsdlev_plot() should return the threshold value used to detect outliers/high leverage observations.

> library(caret)
> data("Sacramento")
> lm_fit2 <- lm(price  ~ beds + baths + log(sqft), data = Sacramento)
> k <- ols_rsdlev_plot(lm_fit2)

> k$Observation
 [1] 153 154 157 173 292 294 313 321 322 329 331 333 382 511 519 542 543 548
[19] 549 550 551 552 553 612 781 784 794 801 803 807 808 811 813

> k$Leverage
 [1] 0.005154382 0.005179942 0.006462719 0.007670588 0.010350976 0.004144309
 [7] 0.005912154 0.006578520 0.003590944 0.003791068 0.006412857 0.009159017
[13] 0.007381757 0.004838080 0.002197520 0.002910620 0.001414019 0.003441322
[19] 0.006293067 0.005176886 0.003759983 0.007418039 0.006981809 0.004851921
[25] 0.006582164 0.006158209 0.001802081 0.005008438 0.005968402 0.002935425
[31] 0.002940705 0.006304095 0.008970625

> k$`Studentized Residuals`
 [1]  2.131717  2.434828  3.315315 -2.016768  4.447093  2.274949  2.710143
 [8]  2.208636  2.292741  3.020921  2.141023  4.471201 -2.153874  2.006514
[15]  2.445023  2.174906  3.588165  2.945940  2.494206  3.543963  4.098482
[22]  2.753821  3.699032 -2.221324  2.168987  2.231032  2.276834  4.058212
[29]  4.278508  2.967438  2.951958  2.243076  4.593773

@aravindhebbali aravindhebbali self-assigned this Jun 3, 2017

@aravindhebbali aravindhebbali added this to the v0.2.0 milestone Jun 5, 2017

aravindhebbali added a commit that referenced this issue Jun 5, 2017

@aravindhebbali

This comment has been minimized.

Copy link
Member Author

commented Jun 5, 2017

ols_rsdlev_plot() returns the threshold value used to to detect outliers/high leverage observations.

> library(olsrr)
> library(caret)
> data("Sacramento")
> lm_fit2 <- lm(price  ~ beds + baths + log(sqft), data = Sacramento)
> k <- ols_rsdlev_plot(lm_fit2)

> k$leverage
   Observation    Leverage Studentized Residuals
1          153 0.005154382              2.131717
2          154 0.005179942              2.434828
3          157 0.006462719              3.315315
4          173 0.007670588             -2.016768
5          292 0.010350976              4.447093
6          294 0.004144309              2.274949
7          313 0.005912154              2.710143
8          321 0.006578520              2.208636
9          322 0.003590944              2.292741
10         329 0.003791068              3.020921
11         331 0.006412857              2.141023
12         333 0.009159017              4.471201
13         382 0.007381757             -2.153874
14         511 0.004838080              2.006514
15         519 0.002197520              2.445023
16         542 0.002910620              2.174906
17         543 0.001414019              3.588165
18         548 0.003441322              2.945940
19         549 0.006293067              2.494206
20         550 0.005176886              3.543963
21         551 0.003759983              4.098482
22         552 0.007418039              2.753821
23         553 0.006981809              3.699032
24         612 0.004851921             -2.221324
25         781 0.006582164              2.168987
26         784 0.006158209              2.231032
27         794 0.001802081              2.276834
28         801 0.005008438              4.058212
29         803 0.005968402              4.278508
30         807 0.002935425              2.967438
31         808 0.002940705              2.951958
32         811 0.006304095              2.243076
33         813 0.008970625              4.593773
Warning message:
In grob$name <- vp$name : reached elapsed time limit

> k$threshold
[1] 0.011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.