Skip to contents

Generates data for studentized residual plot.

Usage

ols_prep_srplot_data(model, threshold = NULL)

Arguments

model

An object of class lm.

threshold

Threshold for detecting outliers. Default is 3.

Examples

model <- lm(read ~ write + math + science, data = hsb)
ols_prep_srplot_data(model)
#> $cminx
#> [1] -4
#> 
#> $cmaxx
#> [1] 4
#> 
#> $nseq
#> [1] -1 -2 -3
#> 
#> $pseq
#> [1] 1 2 3
#> 
#> $dsr
#>     obs           dsr  color fct_color
#> 1     1  1.5615178576 normal    normal
#> 2     2  1.5674686935 normal    normal
#> 3     3 -0.8622668267 normal    normal
#> 4     4  2.1255029597 normal    normal
#> 5     5 -1.0086194988 normal    normal
#> 6     6 -1.5536180050 normal    normal
#> 7     7 -0.0033083160 normal    normal
#> 8     8 -1.4291604750 normal    normal
#> 9     9  1.0654028866 normal    normal
#> 10   10  0.7204677404 normal    normal
#> 11   11  1.3900119349 normal    normal
#> 12   12 -0.1190230101 normal    normal
#> 13   13  1.3622240361 normal    normal
#> 14   14 -0.4650712801 normal    normal
#> 15   15 -0.1522931868 normal    normal
#> 16   16 -0.7369695795 normal    normal
#> 17   17 -0.5538375471 normal    normal
#> 18   18 -0.1206769984 normal    normal
#> 19   19  1.2094871126 normal    normal
#> 20   20  0.5875672266 normal    normal
#> 21   21  2.1249199600 normal    normal
#> 22   22 -0.8885924544 normal    normal
#> 23   23  0.3989106927 normal    normal
#> 24   24  0.5148854800 normal    normal
#> 25   25 -0.9253782818 normal    normal
#> 26   26 -1.1784121774 normal    normal
#> 27   27  0.3009278833 normal    normal
#> 28   28 -1.3949833362 normal    normal
#> 29   29  0.0687139016 normal    normal
#> 30   30  0.3301869369 normal    normal
#> 31   31 -0.7746718907 normal    normal
#> 32   32  2.3453042406 normal    normal
#> 33   33  0.1825653880 normal    normal
#> 34   34 -2.2528504213 normal    normal
#> 35   35 -0.4927644910 normal    normal
#> 36   36  0.0173928975 normal    normal
#> 37   37  0.4119453403 normal    normal
#> 38   38  0.0813920657 normal    normal
#> 39   39  1.1535955907 normal    normal
#> 40   40  0.0790182178 normal    normal
#> 41   41  0.4986514768 normal    normal
#> 42   42 -0.5841201617 normal    normal
#> 43   43 -0.4439399459 normal    normal
#> 44   44 -0.4647805161 normal    normal
#> 45   45  1.2103260683 normal    normal
#> 46   46 -1.1152833455 normal    normal
#> 47   47  0.9846953174 normal    normal
#> 48   48  0.2037596196 normal    normal
#> 49   49 -1.5841455905 normal    normal
#> 50   50  0.5046561856 normal    normal
#> 51   51 -0.8428749146 normal    normal
#> 52   52 -0.2244305253 normal    normal
#> 53   53 -1.2704393116 normal    normal
#> 54   54  1.4031499379 normal    normal
#> 55   55  0.8388462618 normal    normal
#> 56   56  0.1444303526 normal    normal
#> 57   57 -0.2679828969 normal    normal
#> 58   58 -0.4398184906 normal    normal
#> 59   59  1.0105795250 normal    normal
#> 60   60 -0.1085065460 normal    normal
#> 61   61  0.0643870692 normal    normal
#> 62   62 -2.2867946914 normal    normal
#> 63   63  0.6230980698 normal    normal
#> 64   64 -0.6392045195 normal    normal
#> 65   65  0.8728884281 normal    normal
#> 66   66 -0.0139993151 normal    normal
#> 67   67  0.5386382740 normal    normal
#> 68   68  0.4464274622 normal    normal
#> 69   69  0.9891610642 normal    normal
#> 70   70  0.8974746735 normal    normal
#> 71   71  0.0266382273 normal    normal
#> 72   72  0.5191148106 normal    normal
#> 73   73  1.0321756789 normal    normal
#> 74   74  0.8269809015 normal    normal
#> 75   75  0.7654046005 normal    normal
#> 76   76  0.5012495411 normal    normal
#> 77   77  0.1647799838 normal    normal
#> 78   78  1.3992743502 normal    normal
#> 79   79 -1.5838362422 normal    normal
#> 80   80 -0.0027914606 normal    normal
#> 81   81  0.9613788128 normal    normal
#> 82   82 -2.7157286565 normal    normal
#> 83   83  0.4544767500 normal    normal
#> 84   84  0.9176207661 normal    normal
#> 85   85  1.8373806393 normal    normal
#> 86   86 -1.0111400482 normal    normal
#> 87   87  0.4099709140 normal    normal
#> 88   88 -1.3353363732 normal    normal
#> 89   89  1.9065087673 normal    normal
#> 90   90 -0.3183460774 normal    normal
#> 91   91 -0.8765367429 normal    normal
#> 92   92  1.2869743107 normal    normal
#> 93   93  0.5489294217 normal    normal
#> 94   94 -1.2341012351 normal    normal
#> 95   95 -0.3135792639 normal    normal
#> 96   96 -1.5716965630 normal    normal
#> 97   97  0.6272069017 normal    normal
#> 98   98 -0.6031937785 normal    normal
#> 99   99 -1.0867225368 normal    normal
#> 100 100 -0.0814710621 normal    normal
#> 101 101  0.6722859307 normal    normal
#> 102 102 -1.7650237091 normal    normal
#> 103 103  0.4855645788 normal    normal
#> 104 104  1.5805326069 normal    normal
#> 105 105 -0.6547693963 normal    normal
#> 106 106  0.0510560203 normal    normal
#> 107 107  0.1004793698 normal    normal
#> 108 108 -1.1587167698 normal    normal
#> 109 109 -0.3520283143 normal    normal
#> 110 110  1.1354139618 normal    normal
#> 111 111  1.0243345531 normal    normal
#> 112 112  0.0937148829 normal    normal
#> 113 113  1.6459429024 normal    normal
#> 114 114  1.2554157147 normal    normal
#> 115 115  2.3559909773 normal    normal
#> 116 116 -0.7635191658 normal    normal
#> 117 117 -1.6323381935 normal    normal
#> 118 118  1.7411403007 normal    normal
#> 119 119 -1.0581953789 normal    normal
#> 120 120 -0.1806400874 normal    normal
#> 121 121  1.2960038448 normal    normal
#> 122 122  0.1456903754 normal    normal
#> 123 123  0.2354572097 normal    normal
#> 124 124 -0.3195889441 normal    normal
#> 125 125  0.1128426801 normal    normal
#> 126 126 -0.1901603269 normal    normal
#> 127 127  0.8320896124 normal    normal
#> 128 128 -1.9104540241 normal    normal
#> 129 129 -0.1665475040 normal    normal
#> 130 130 -0.4084949452 normal    normal
#> 131 131  0.4765839564 normal    normal
#> 132 132 -0.8872732015 normal    normal
#> 133 133  1.8610380414 normal    normal
#> 134 134 -0.9967369630 normal    normal
#> 135 135  1.5921286954 normal    normal
#> 136 136  2.0424695837 normal    normal
#> 137 137 -1.3005825705 normal    normal
#> 138 138 -0.6612591381 normal    normal
#> 139 139 -0.0105387554 normal    normal
#> 140 140  0.6269023965 normal    normal
#> 141 141 -2.4187322569 normal    normal
#> 142 142 -1.2875918541 normal    normal
#> 143 143  0.2004370441 normal    normal
#> 144 144 -0.3081322343 normal    normal
#> 145 145 -0.5838887690 normal    normal
#> 146 146 -0.0362707248 normal    normal
#> 147 147 -0.1383922701 normal    normal
#> 148 148 -0.2963394272 normal    normal
#> 149 149  0.5174614703 normal    normal
#> 150 150  0.1178180142 normal    normal
#> 151 151  0.7337200979 normal    normal
#> 152 152  1.0762759940 normal    normal
#> 153 153 -0.7091009803 normal    normal
#> 154 154 -0.6418437597 normal    normal
#> 155 155 -0.0742232793 normal    normal
#> 156 156  1.4675437974 normal    normal
#> 157 157 -0.0566833495 normal    normal
#> 158 158 -1.3193821602 normal    normal
#> 159 159 -0.0004592609 normal    normal
#> 160 160  0.3224538910 normal    normal
#> 161 161 -1.1362533725 normal    normal
#> 162 162  0.9570892807 normal    normal
#> 163 163 -1.4292598994 normal    normal
#> 164 164 -1.0817808039 normal    normal
#> 165 165 -0.1273570734 normal    normal
#> 166 166  0.3100580108 normal    normal
#> 167 167 -0.9430087540 normal    normal
#> 168 168 -1.0004205310 normal    normal
#> 169 169 -0.3266552443 normal    normal
#> 170 170  0.4779826970 normal    normal
#> 171 171 -1.1225943231 normal    normal
#> 172 172  0.4290093591 normal    normal
#> 173 173  0.5760876827 normal    normal
#> 174 174  0.0048134988 normal    normal
#> 175 175  0.1356998665 normal    normal
#> 176 176  0.5377568859 normal    normal
#> 177 177  0.6534943450 normal    normal
#> 178 178 -2.0759807456 normal    normal
#> 179 179 -0.1408588779 normal    normal
#> 180 180 -1.0289602984 normal    normal
#> 181 181  1.0827262779 normal    normal
#> 182 182 -0.2525935618 normal    normal
#> 183 183 -1.2382939110 normal    normal
#> 184 184 -0.0686983378 normal    normal
#> 185 185 -2.1645087644 normal    normal
#> 186 186  0.5376914283 normal    normal
#> 187 187 -0.2505785670 normal    normal
#> 188 188  0.5464032574 normal    normal
#> 189 189  0.9146555195 normal    normal
#> 190 190 -0.1569159057 normal    normal
#> 191 191 -0.4596571444 normal    normal
#> 192 192 -1.8397072164 normal    normal
#> 193 193 -0.4454613699 normal    normal
#> 194 194 -0.4936746801 normal    normal
#> 195 195 -1.5018059729 normal    normal
#> 196 196  0.6428872251 normal    normal
#> 197 197  0.2346403284 normal    normal
#> 198 198  0.7210780094 normal    normal
#> 199 199 -0.4691841142 normal    normal
#> 200 200  0.4105220868 normal    normal
#>