Skip to contents

Generates data for standardized residual chart.

Usage

ols_prep_srchart_data(model, threshold = NULL)

Arguments

model

An object of class lm.

threshold

Threshold for detecting outliers. Default is 2.

Examples

model <- lm(read ~ write + math + science, data = hsb)
ols_prep_srchart_data(model)
#>     obs        sdres   color fct_color txt
#> 1     1  1.555819633  normal    normal  NA
#> 2     2  1.561675116  normal    normal  NA
#> 3     3 -0.862831585  normal    normal  NA
#> 4     4  2.106681912 outlier   outlier   4
#> 5     5 -1.008574955  normal    normal  NA
#> 6     6 -1.548045087  normal    normal  NA
#> 7     7 -0.003316788  normal    normal  NA
#> 8     8 -1.425374806  normal    normal  NA
#> 9     9  1.065035938  normal    normal  NA
#> 10   10  0.721353278  normal    normal  NA
#> 11   11  1.386718381  normal    normal  NA
#> 12   12 -0.119323473  normal    normal  NA
#> 13   13  1.359260285  normal    normal  NA
#> 14   14 -0.466003875  normal    normal  NA
#> 15   15 -0.152674104  normal    normal  NA
#> 16   16 -0.737830022  normal    normal  NA
#> 17   17 -0.554819632  normal    normal  NA
#> 18   18 -0.120981513  normal    normal  NA
#> 19   19  1.208061519  normal    normal  NA
#> 20   20  0.588551117  normal    normal  NA
#> 21   21  2.106117154 outlier   outlier  21
#> 22   22 -0.889069785  normal    normal  NA
#> 23   23  0.399769150  normal    normal  NA
#> 24   24  0.515853473  normal    normal  NA
#> 25   25 -0.925717636  normal    normal  NA
#> 26   26 -1.177245555  normal    normal  NA
#> 27   27  0.301628477  normal    normal  NA
#> 28   28 -1.391629085  normal    normal  NA
#> 29   29  0.068889032  normal    normal  NA
#> 30   30  0.330939987  normal    normal  NA
#> 31   31 -0.775463353  normal    normal  NA
#> 32   32  2.318833396 outlier   outlier  32
#> 33   33  0.183017265  normal    normal  NA
#> 34   34 -2.229788221 outlier   outlier  34
#> 35   35 -0.493719077  normal    normal  NA
#> 36   36  0.017437424  normal    normal  NA
#> 37   37  0.412820670  normal    normal  NA
#> 38   38  0.081599110  normal    normal  NA
#> 39   39  1.152623378  normal    normal  NA
#> 40   40  0.079219301  normal    normal  NA
#> 41   41  0.499609999  normal    normal  NA
#> 42   42 -0.585104328  normal    normal  NA
#> 43   43 -0.444852053  normal    normal  NA
#> 44   44 -0.465712850  normal    normal  NA
#> 45   45  1.208893240  normal    normal  NA
#> 46   46 -1.114590192  normal    normal  NA
#> 47   47  0.984771628  normal    normal  NA
#> 48   48  0.204259668  normal    normal  NA
#> 49   49 -1.578080360  normal    normal  NA
#> 50   50  0.505618450  normal    normal  NA
#> 51   51 -0.843498219  normal    normal  NA
#> 52   52 -0.224976198  normal    normal  NA
#> 53   53 -1.268454000  normal    normal  NA
#> 54   54  1.399694850  normal    normal  NA
#> 55   55  0.839481117  normal    normal  NA
#> 56   56  0.144792469  normal    normal  NA
#> 57   57 -0.268619695  normal    normal  NA
#> 58   58 -0.440726242  normal    normal  NA
#> 59   59  1.010524693  normal    normal  NA
#> 60   60 -0.108781128  normal    normal  NA
#> 61   61  0.064551267  normal    normal  NA
#> 62   62 -2.262513898 outlier   outlier  62
#> 63   63  0.624072749  normal    normal  NA
#> 64   64 -0.640171087  normal    normal  NA
#> 65   65  0.873419026  normal    normal  NA
#> 66   66 -0.014035158  normal    normal  NA
#> 67   67  0.539616346  normal    normal  NA
#> 68   68  0.447342142  normal    normal  NA
#> 69   69  0.989215474  normal    normal  NA
#> 70   70  0.897920398  normal    normal  NA
#> 71   71  0.026706394  normal    normal  NA
#> 72   72  0.520084931  normal    normal  NA
#> 73   73  1.032003552  normal    normal  NA
#> 74   74  0.827648573  normal    normal  NA
#> 75   75  0.766214550  normal    normal  NA
#> 76   76  0.502209717  normal    normal  NA
#> 77   77  0.165190456  normal    normal  NA
#> 78   78  1.395867291  normal    normal  NA
#> 79   79 -1.577776110  normal    normal  NA
#> 80   80 -0.002798609  normal    normal  NA
#> 81   81  0.961564645  normal    normal  NA
#> 82   82 -2.672611202 outlier   outlier  82
#> 83   83  0.455399463  normal    normal  NA
#> 84   84  0.917990782  normal    normal  NA
#> 85   85  1.826344254  normal    normal  NA
#> 86   86 -1.011082263  normal    normal  NA
#> 87   87  0.410843756  normal    normal  NA
#> 88   88 -1.332676655  normal    normal  NA
#> 89   89  1.893822187  normal    normal  NA
#> 90   90 -0.319078402  normal    normal  NA
#> 91   91 -0.877055261  normal    normal  NA
#> 92   92  1.284825000  normal    normal  NA
#> 93   93  0.549910423  normal    normal  NA
#> 94   94 -1.232457987  normal    normal  NA
#> 95   95 -0.314303049  normal    normal  NA
#> 96   96 -1.565834736  normal    normal  NA
#> 97   97  0.628179750  normal    normal  NA
#> 98   98 -0.604175061  normal    normal  NA
#> 99   99 -1.086221201  normal    normal  NA
#> 100 100 -0.081678305  normal    normal  NA
#> 101 101  0.673227789  normal    normal  NA
#> 102 102 -1.755575702  normal    normal  NA
#> 103 103  0.486513993  normal    normal  NA
#> 104 104  1.574526785  normal    normal  NA
#> 105 105 -0.655725709  normal    normal  NA
#> 106 106  0.051186424  normal    normal  NA
#> 107 107  0.100734072  normal    normal  NA
#> 108 108 -1.157705328  normal    normal  NA
#> 109 109 -0.352817705  normal    normal  NA
#> 110 110  1.134577332  normal    normal  NA
#> 111 111  1.024205853  normal    normal  NA
#> 112 112  0.093952754  normal    normal  NA
#> 113 113  1.638813153  normal    normal  NA
#> 114 114  1.253574859  normal    normal  NA
#> 115 115  2.329107718 outlier   outlier 115
#> 116 116 -0.764332752  normal    normal  NA
#> 117 117 -1.625450724  normal    normal  NA
#> 118 118  1.732186258  normal    normal  NA
#> 119 119 -1.057872190  normal    normal  NA
#> 120 120 -0.181087524  normal    normal  NA
#> 121 121  1.293762738  normal    normal  NA
#> 122 122  0.146055514  normal    normal  NA
#> 123 123  0.236026624  normal    normal  NA
#> 124 124 -0.320323477  normal    normal  NA
#> 125 125  0.113127957  normal    normal  NA
#> 126 126 -0.190629620  normal    normal  NA
#> 127 127  0.832743375  normal    normal  NA
#> 128 128 -1.897669259  normal    normal  NA
#> 129 129 -0.166962128  normal    normal  NA
#> 130 130 -0.409365912  normal    normal  NA
#> 131 131  0.477526378  normal    normal  NA
#> 132 132 -0.887755135  normal    normal  NA
#> 133 133  1.849451744  normal    normal  NA
#> 134 134 -0.996753530  normal    normal  NA
#> 135 135  1.585931101  normal    normal  NA
#> 136 136  2.026141808 outlier   outlier 136
#> 137 137 -1.298294306  normal    normal  NA
#> 138 138 -0.662210459  normal    normal  NA
#> 139 139 -0.010565740  normal    normal  NA
#> 140 140  0.627875386  normal    normal  NA
#> 141 141 -2.389349205 outlier   outlier 141
#> 142 142 -1.285436316  normal    normal  NA
#> 143 143  0.200929631  normal    normal  NA
#> 144 144 -0.308846127  normal    normal  NA
#> 145 145 -0.584872950  normal    normal  NA
#> 146 146 -0.036363485  normal    normal  NA
#> 147 147 -0.138739855  normal    normal  NA
#> 148 148 -0.297031425  normal    normal  NA
#> 149 149  0.518430776  normal    normal  NA
#> 150 150  0.118115521  normal    normal  NA
#> 151 151  0.734585723  normal    normal  NA
#> 152 152  1.075841436  normal    normal  NA
#> 153 153 -0.710002052  normal    normal  NA
#> 154 154 -0.642808757  normal    normal  NA
#> 155 155 -0.074412301  normal    normal  NA
#> 156 156  1.463243682  normal    normal  NA
#> 157 157 -0.056828037  normal    normal  NA
#> 158 158 -1.316895946  normal    normal  NA
#> 159 159 -0.000460437  normal    normal  NA
#> 160 160  0.323193485  normal    normal  NA
#> 161 161 -1.135410609  normal    normal  NA
#> 162 162  0.957294389  normal    normal  NA
#> 163 163 -1.425472939  normal    normal  NA
#> 164 164 -1.081311281  normal    normal  NA
#> 165 165 -0.127677902  normal    normal  NA
#> 166 166  0.310775417  normal    normal  NA
#> 167 167 -0.943275254  normal    normal  NA
#> 168 168 -1.000418384  normal    normal  NA
#> 169 169 -0.327402186  normal    normal  NA
#> 170 170  0.478926247  normal    normal  NA
#> 171 171 -1.121849862  normal    normal  NA
#> 172 172  0.429905143  normal    normal  NA
#> 173 173  0.577072081  normal    normal  NA
#> 174 174  0.004825825  normal    normal  NA
#> 175 175  0.136040947  normal    normal  NA
#> 176 176  0.538734666  normal    normal  NA
#> 177 177  0.654451588  normal    normal  NA
#> 178 178 -2.058671932 outlier   outlier 178
#> 179 179 -0.141212409  normal    normal  NA
#> 180 180 -1.028806096  normal    normal  NA
#> 181 181  1.082250700  normal    normal  NA
#> 182 182 -0.253198990  normal    normal  NA
#> 183 183 -1.236612467  normal    normal  NA
#> 184 184 -0.068873429  normal    normal  NA
#> 185 185 -2.144443243 outlier   outlier 185
#> 186 186  0.538669187  normal    normal  NA
#> 187 187 -0.251179818  normal    normal  NA
#> 188 188  0.547383622  normal    normal  NA
#> 189 189  0.915037032  normal    normal  NA
#> 190 190 -0.157307808  normal    normal  NA
#> 191 191 -0.460584788  normal    normal  NA
#> 192 192 -1.828617426  normal    normal  NA
#> 193 193 -0.446375056  normal    normal  NA
#> 194 194 -0.494629892  normal    normal  NA
#> 195 195 -1.497019264  normal    normal  NA
#> 196 196  0.643851583  normal    normal  NA
#> 197 197  0.235207999  normal    normal  NA
#> 198 198  0.721962673  normal    normal  NA
#> 199 199 -0.470120330  normal    normal  NA
#> 200 200  0.411395626  normal    normal  NA
ols_prep_srchart_data(model, threshold = 3)
#>     obs        sdres  color fct_color txt
#> 1     1  1.555819633 normal    normal  NA
#> 2     2  1.561675116 normal    normal  NA
#> 3     3 -0.862831585 normal    normal  NA
#> 4     4  2.106681912 normal    normal  NA
#> 5     5 -1.008574955 normal    normal  NA
#> 6     6 -1.548045087 normal    normal  NA
#> 7     7 -0.003316788 normal    normal  NA
#> 8     8 -1.425374806 normal    normal  NA
#> 9     9  1.065035938 normal    normal  NA
#> 10   10  0.721353278 normal    normal  NA
#> 11   11  1.386718381 normal    normal  NA
#> 12   12 -0.119323473 normal    normal  NA
#> 13   13  1.359260285 normal    normal  NA
#> 14   14 -0.466003875 normal    normal  NA
#> 15   15 -0.152674104 normal    normal  NA
#> 16   16 -0.737830022 normal    normal  NA
#> 17   17 -0.554819632 normal    normal  NA
#> 18   18 -0.120981513 normal    normal  NA
#> 19   19  1.208061519 normal    normal  NA
#> 20   20  0.588551117 normal    normal  NA
#> 21   21  2.106117154 normal    normal  NA
#> 22   22 -0.889069785 normal    normal  NA
#> 23   23  0.399769150 normal    normal  NA
#> 24   24  0.515853473 normal    normal  NA
#> 25   25 -0.925717636 normal    normal  NA
#> 26   26 -1.177245555 normal    normal  NA
#> 27   27  0.301628477 normal    normal  NA
#> 28   28 -1.391629085 normal    normal  NA
#> 29   29  0.068889032 normal    normal  NA
#> 30   30  0.330939987 normal    normal  NA
#> 31   31 -0.775463353 normal    normal  NA
#> 32   32  2.318833396 normal    normal  NA
#> 33   33  0.183017265 normal    normal  NA
#> 34   34 -2.229788221 normal    normal  NA
#> 35   35 -0.493719077 normal    normal  NA
#> 36   36  0.017437424 normal    normal  NA
#> 37   37  0.412820670 normal    normal  NA
#> 38   38  0.081599110 normal    normal  NA
#> 39   39  1.152623378 normal    normal  NA
#> 40   40  0.079219301 normal    normal  NA
#> 41   41  0.499609999 normal    normal  NA
#> 42   42 -0.585104328 normal    normal  NA
#> 43   43 -0.444852053 normal    normal  NA
#> 44   44 -0.465712850 normal    normal  NA
#> 45   45  1.208893240 normal    normal  NA
#> 46   46 -1.114590192 normal    normal  NA
#> 47   47  0.984771628 normal    normal  NA
#> 48   48  0.204259668 normal    normal  NA
#> 49   49 -1.578080360 normal    normal  NA
#> 50   50  0.505618450 normal    normal  NA
#> 51   51 -0.843498219 normal    normal  NA
#> 52   52 -0.224976198 normal    normal  NA
#> 53   53 -1.268454000 normal    normal  NA
#> 54   54  1.399694850 normal    normal  NA
#> 55   55  0.839481117 normal    normal  NA
#> 56   56  0.144792469 normal    normal  NA
#> 57   57 -0.268619695 normal    normal  NA
#> 58   58 -0.440726242 normal    normal  NA
#> 59   59  1.010524693 normal    normal  NA
#> 60   60 -0.108781128 normal    normal  NA
#> 61   61  0.064551267 normal    normal  NA
#> 62   62 -2.262513898 normal    normal  NA
#> 63   63  0.624072749 normal    normal  NA
#> 64   64 -0.640171087 normal    normal  NA
#> 65   65  0.873419026 normal    normal  NA
#> 66   66 -0.014035158 normal    normal  NA
#> 67   67  0.539616346 normal    normal  NA
#> 68   68  0.447342142 normal    normal  NA
#> 69   69  0.989215474 normal    normal  NA
#> 70   70  0.897920398 normal    normal  NA
#> 71   71  0.026706394 normal    normal  NA
#> 72   72  0.520084931 normal    normal  NA
#> 73   73  1.032003552 normal    normal  NA
#> 74   74  0.827648573 normal    normal  NA
#> 75   75  0.766214550 normal    normal  NA
#> 76   76  0.502209717 normal    normal  NA
#> 77   77  0.165190456 normal    normal  NA
#> 78   78  1.395867291 normal    normal  NA
#> 79   79 -1.577776110 normal    normal  NA
#> 80   80 -0.002798609 normal    normal  NA
#> 81   81  0.961564645 normal    normal  NA
#> 82   82 -2.672611202 normal    normal  NA
#> 83   83  0.455399463 normal    normal  NA
#> 84   84  0.917990782 normal    normal  NA
#> 85   85  1.826344254 normal    normal  NA
#> 86   86 -1.011082263 normal    normal  NA
#> 87   87  0.410843756 normal    normal  NA
#> 88   88 -1.332676655 normal    normal  NA
#> 89   89  1.893822187 normal    normal  NA
#> 90   90 -0.319078402 normal    normal  NA
#> 91   91 -0.877055261 normal    normal  NA
#> 92   92  1.284825000 normal    normal  NA
#> 93   93  0.549910423 normal    normal  NA
#> 94   94 -1.232457987 normal    normal  NA
#> 95   95 -0.314303049 normal    normal  NA
#> 96   96 -1.565834736 normal    normal  NA
#> 97   97  0.628179750 normal    normal  NA
#> 98   98 -0.604175061 normal    normal  NA
#> 99   99 -1.086221201 normal    normal  NA
#> 100 100 -0.081678305 normal    normal  NA
#> 101 101  0.673227789 normal    normal  NA
#> 102 102 -1.755575702 normal    normal  NA
#> 103 103  0.486513993 normal    normal  NA
#> 104 104  1.574526785 normal    normal  NA
#> 105 105 -0.655725709 normal    normal  NA
#> 106 106  0.051186424 normal    normal  NA
#> 107 107  0.100734072 normal    normal  NA
#> 108 108 -1.157705328 normal    normal  NA
#> 109 109 -0.352817705 normal    normal  NA
#> 110 110  1.134577332 normal    normal  NA
#> 111 111  1.024205853 normal    normal  NA
#> 112 112  0.093952754 normal    normal  NA
#> 113 113  1.638813153 normal    normal  NA
#> 114 114  1.253574859 normal    normal  NA
#> 115 115  2.329107718 normal    normal  NA
#> 116 116 -0.764332752 normal    normal  NA
#> 117 117 -1.625450724 normal    normal  NA
#> 118 118  1.732186258 normal    normal  NA
#> 119 119 -1.057872190 normal    normal  NA
#> 120 120 -0.181087524 normal    normal  NA
#> 121 121  1.293762738 normal    normal  NA
#> 122 122  0.146055514 normal    normal  NA
#> 123 123  0.236026624 normal    normal  NA
#> 124 124 -0.320323477 normal    normal  NA
#> 125 125  0.113127957 normal    normal  NA
#> 126 126 -0.190629620 normal    normal  NA
#> 127 127  0.832743375 normal    normal  NA
#> 128 128 -1.897669259 normal    normal  NA
#> 129 129 -0.166962128 normal    normal  NA
#> 130 130 -0.409365912 normal    normal  NA
#> 131 131  0.477526378 normal    normal  NA
#> 132 132 -0.887755135 normal    normal  NA
#> 133 133  1.849451744 normal    normal  NA
#> 134 134 -0.996753530 normal    normal  NA
#> 135 135  1.585931101 normal    normal  NA
#> 136 136  2.026141808 normal    normal  NA
#> 137 137 -1.298294306 normal    normal  NA
#> 138 138 -0.662210459 normal    normal  NA
#> 139 139 -0.010565740 normal    normal  NA
#> 140 140  0.627875386 normal    normal  NA
#> 141 141 -2.389349205 normal    normal  NA
#> 142 142 -1.285436316 normal    normal  NA
#> 143 143  0.200929631 normal    normal  NA
#> 144 144 -0.308846127 normal    normal  NA
#> 145 145 -0.584872950 normal    normal  NA
#> 146 146 -0.036363485 normal    normal  NA
#> 147 147 -0.138739855 normal    normal  NA
#> 148 148 -0.297031425 normal    normal  NA
#> 149 149  0.518430776 normal    normal  NA
#> 150 150  0.118115521 normal    normal  NA
#> 151 151  0.734585723 normal    normal  NA
#> 152 152  1.075841436 normal    normal  NA
#> 153 153 -0.710002052 normal    normal  NA
#> 154 154 -0.642808757 normal    normal  NA
#> 155 155 -0.074412301 normal    normal  NA
#> 156 156  1.463243682 normal    normal  NA
#> 157 157 -0.056828037 normal    normal  NA
#> 158 158 -1.316895946 normal    normal  NA
#> 159 159 -0.000460437 normal    normal  NA
#> 160 160  0.323193485 normal    normal  NA
#> 161 161 -1.135410609 normal    normal  NA
#> 162 162  0.957294389 normal    normal  NA
#> 163 163 -1.425472939 normal    normal  NA
#> 164 164 -1.081311281 normal    normal  NA
#> 165 165 -0.127677902 normal    normal  NA
#> 166 166  0.310775417 normal    normal  NA
#> 167 167 -0.943275254 normal    normal  NA
#> 168 168 -1.000418384 normal    normal  NA
#> 169 169 -0.327402186 normal    normal  NA
#> 170 170  0.478926247 normal    normal  NA
#> 171 171 -1.121849862 normal    normal  NA
#> 172 172  0.429905143 normal    normal  NA
#> 173 173  0.577072081 normal    normal  NA
#> 174 174  0.004825825 normal    normal  NA
#> 175 175  0.136040947 normal    normal  NA
#> 176 176  0.538734666 normal    normal  NA
#> 177 177  0.654451588 normal    normal  NA
#> 178 178 -2.058671932 normal    normal  NA
#> 179 179 -0.141212409 normal    normal  NA
#> 180 180 -1.028806096 normal    normal  NA
#> 181 181  1.082250700 normal    normal  NA
#> 182 182 -0.253198990 normal    normal  NA
#> 183 183 -1.236612467 normal    normal  NA
#> 184 184 -0.068873429 normal    normal  NA
#> 185 185 -2.144443243 normal    normal  NA
#> 186 186  0.538669187 normal    normal  NA
#> 187 187 -0.251179818 normal    normal  NA
#> 188 188  0.547383622 normal    normal  NA
#> 189 189  0.915037032 normal    normal  NA
#> 190 190 -0.157307808 normal    normal  NA
#> 191 191 -0.460584788 normal    normal  NA
#> 192 192 -1.828617426 normal    normal  NA
#> 193 193 -0.446375056 normal    normal  NA
#> 194 194 -0.494629892 normal    normal  NA
#> 195 195 -1.497019264 normal    normal  NA
#> 196 196  0.643851583 normal    normal  NA
#> 197 197  0.235207999 normal    normal  NA
#> 198 198  0.721962673 normal    normal  NA
#> 199 199 -0.470120330 normal    normal  NA
#> 200 200  0.411395626 normal    normal  NA