mixpoissonreg
ObjectsR/2_diagnostic_functions.R
residuals.mixpoissonreg.Rd
Function to return 'pearson' or 'score' residuals for mixed Poisson regression models.
# S3 method for mixpoissonreg residuals(object, type = c("pearson", "score"), ...)
object | an object of class "mixpoissonreg" containing results from the fitted model. |
---|---|
type | the type of residual to be returned. Currently, the options are 'pearson' or 'score'. The default is set to 'pearson'. Notice that these residuals coincide for Negative-Binomial models. |
... | Currently not used. |
A vector containing the residuals of a mixpoissonreg object.
# \donttest{ data("Attendance", package = "mixpoissonreg") daysabs_fit <- mixpoissonreg(daysabs ~ gender + math + prog | gender + math + prog, data = Attendance) residuals(daysabs_fit)#> 1 2 3 4 5 6 #> -0.20020751 -0.36982797 -0.81365965 -0.71274807 -0.77161447 0.95583403 #> 7 8 9 10 11 12 #> 0.59879043 -0.10211517 0.65955550 1.86252199 0.10085653 -0.25688007 #> 13 14 15 16 17 18 #> -0.18551196 -0.52515709 -0.54087075 -0.78481649 -0.88633645 -1.00802455 #> 19 20 21 22 23 24 #> -0.41667891 2.06044840 -0.80994512 -0.84559028 -0.74493818 -0.84110025 #> 25 26 27 28 29 30 #> -0.11423002 -0.40692364 -0.08371292 -1.04619304 -0.49612777 -0.76354560 #> 31 32 33 34 35 36 #> -0.99179958 -0.90228306 -0.45531980 -0.89656058 -0.82997730 2.24541482 #> 37 38 39 40 41 42 #> 0.07082488 0.07512401 -0.94828140 2.36325281 -0.39915233 1.22792689 #> 43 44 45 46 47 48 #> 1.42511094 0.33976381 0.27334744 -0.54579871 -0.48212767 -0.46354828 #> 49 50 51 52 53 54 #> 0.28067626 2.10404685 -0.15492098 -0.85010384 3.20143290 0.66599369 #> 55 56 57 58 59 60 #> 2.66000772 -0.69817561 2.19349329 -0.53130205 -0.68346270 -0.75830030 #> 61 62 63 64 65 66 #> -0.76868864 -0.18289954 -0.43488205 0.31839093 -0.28701870 1.35422335 #> 67 68 69 70 71 72 #> -0.91208797 -0.60624051 -0.13113087 -0.31651005 -0.82118301 0.73017052 #> 73 74 75 76 77 78 #> -0.77546851 0.16543036 -0.77506803 -0.03625775 -0.33714607 -0.50663443 #> 79 80 81 82 83 84 #> 3.39545595 1.67065809 0.59700456 0.21191889 -0.95321653 0.09614543 #> 85 86 87 88 89 90 #> -0.81464738 0.06614945 0.48057105 0.19016834 0.66612193 -0.09193099 #> 91 92 93 94 95 96 #> 1.75256272 -0.20137638 0.14243340 2.91833295 -0.28558849 -0.82617388 #> 97 98 99 100 101 102 #> 0.27334744 0.46876777 1.76464878 0.52100413 -0.64200484 -0.90134113 #> 103 104 105 106 107 108 #> -0.43488205 0.27692751 1.97425813 -0.90869789 -0.40437975 -0.52552578 #> 109 110 111 112 113 114 #> -0.88471789 0.38463189 1.57202780 -0.32744166 -0.53343965 0.45590880 #> 115 116 117 118 119 120 #> 0.89873292 -0.19075853 3.36214981 0.14587381 -0.41766385 0.27692751 #> 121 122 123 124 125 126 #> -0.21157137 -0.70687533 -0.69778987 0.24921786 0.10862856 0.95583403 #> 127 128 129 130 131 132 #> -0.87266653 -0.35276171 -0.51723632 2.72034807 1.09691365 0.80472109 #> 133 134 135 136 137 138 #> 0.22249993 -0.76272686 -0.88239085 0.01556875 -0.74219370 0.54016287 #> 139 140 141 142 143 144 #> -0.33555891 2.18228673 -0.83976382 1.00534096 -1.17508473 -0.06156278 #> 145 146 147 148 149 150 #> -0.41456759 -0.40587699 -0.59603241 1.72081521 0.38811327 2.74005105 #> 151 152 153 154 155 156 #> -0.01645995 1.24924193 0.52117698 -0.13978377 0.18086638 0.47036536 #> 157 158 159 160 161 162 #> -0.90134113 -0.70977793 0.10085653 -0.69204125 -0.69204125 -0.09450537 #> 163 164 165 166 167 168 #> -0.60140007 -0.73635786 -0.66622971 -0.76671351 -0.66622971 1.14715351 #> 169 170 171 172 173 174 #> -0.01846952 0.37231245 1.02174999 0.49928430 -0.37324608 -0.17680776 #> 175 176 177 178 179 180 #> -0.65545725 -0.67717473 0.35534460 -0.39471935 -0.77087973 0.38052348 #> 181 182 183 184 185 186 #> -0.67833495 1.33231191 -0.61717949 -0.64310394 -0.46478308 4.52763825 #> 187 188 189 190 191 192 #> -0.28998074 3.67414170 -0.83663362 -0.08877624 -0.43687463 -0.16652992 #> 193 194 195 196 197 198 #> -0.18542350 -0.59694209 -0.52854626 -0.41829594 1.26241046 -0.95079292 #> 199 200 201 202 203 204 #> -0.78411599 -0.42191070 -0.74418909 2.05033642 -0.59510568 -0.68086189 #> 205 206 207 208 209 210 #> -0.85481997 -0.73657818 -0.83761766 -0.69726252 -1.07021401 -0.75026727 #> 211 212 213 214 215 216 #> -0.24085369 -0.64661010 -0.92770855 -0.68086189 0.38052348 0.13360244 #> 217 218 219 220 221 222 #> -0.54704577 -0.94073571 -0.77205663 0.30551865 -0.86422324 0.24415512 #> 223 224 225 226 227 228 #> -0.84746865 -0.22877926 0.09816993 1.35868141 -0.72273548 -0.63787942 #> 229 230 231 232 233 234 #> -0.67350705 -0.85025525 -0.65673967 0.57048488 -0.47092466 -0.65545725 #> 235 236 237 238 239 240 #> -1.05220752 -0.74813446 -0.40763656 -0.55115664 -0.22566644 -0.18542350 #> 241 242 243 244 245 246 #> -0.49172597 -0.46748721 0.81897758 1.47005988 2.06285637 -0.82310857 #> 247 248 249 250 251 252 #> 1.00862238 -0.39915233 -0.76570571 -0.48322291 -0.80501438 0.38424170 #> 253 254 255 256 257 258 #> -1.02421193 3.18597921 -0.60664070 -0.27362076 -0.31032755 -0.70339957 #> 259 260 261 262 263 264 #> -0.36719740 4.71779745 -0.75097412 2.66604046 -0.96917249 -0.31651005 #> 265 266 267 268 269 270 #> 1.34544677 -0.82040814 1.01790374 0.28902890 -0.67833495 -0.08612586 #> 271 272 273 274 275 276 #> 0.08413330 -0.74418909 0.21985649 -0.66261984 -0.37022161 0.55354798 #> 277 278 279 280 281 282 #> -0.33696339 -0.69959340 -0.66261984 -0.31579747 1.28341800 0.10284439 #> 283 284 285 286 287 288 #> -0.71688090 -0.44638565 -0.09585084 -0.55753269 -0.43080158 -0.13398968 #> 289 290 291 292 293 294 #> 0.81897758 -0.73416540 1.56651720 -0.89180494 -0.59196210 -0.96325248 #> 295 296 297 298 299 300 #> 0.51231691 1.88427112 0.20199108 -0.81819156 -0.74418909 -0.42191070 #> 301 302 303 304 305 306 #> 0.26170540 -0.69817561 -0.15686835 -0.38336721 -0.07773000 -0.52195149 #> 307 308 309 310 311 312 #> 0.22383594 1.04507724 -0.54818755 -0.78968567 0.11332581 -0.94575118 #> 313 314 #> -0.70487803 -0.17483471#> 1 2 3 4 5 6 #> -0.20020751 -0.36982797 -0.81365965 -0.71274807 -0.77161447 0.95583403 #> 7 8 9 10 11 12 #> 0.59879043 -0.10211517 0.65955550 1.86252199 0.10085653 -0.25688007 #> 13 14 15 16 17 18 #> -0.18551196 -0.52515709 -0.54087075 -0.78481649 -0.88633645 -1.00802455 #> 19 20 21 22 23 24 #> -0.41667891 2.06044840 -0.80994512 -0.84559028 -0.74493818 -0.84110025 #> 25 26 27 28 29 30 #> -0.11423002 -0.40692364 -0.08371292 -1.04619304 -0.49612777 -0.76354560 #> 31 32 33 34 35 36 #> -0.99179958 -0.90228306 -0.45531980 -0.89656058 -0.82997730 2.24541482 #> 37 38 39 40 41 42 #> 0.07082488 0.07512401 -0.94828140 2.36325281 -0.39915233 1.22792689 #> 43 44 45 46 47 48 #> 1.42511094 0.33976381 0.27334744 -0.54579871 -0.48212767 -0.46354828 #> 49 50 51 52 53 54 #> 0.28067626 2.10404685 -0.15492098 -0.85010384 3.20143290 0.66599369 #> 55 56 57 58 59 60 #> 2.66000772 -0.69817561 2.19349329 -0.53130205 -0.68346270 -0.75830030 #> 61 62 63 64 65 66 #> -0.76868864 -0.18289954 -0.43488205 0.31839093 -0.28701870 1.35422335 #> 67 68 69 70 71 72 #> -0.91208797 -0.60624051 -0.13113087 -0.31651005 -0.82118301 0.73017052 #> 73 74 75 76 77 78 #> -0.77546851 0.16543036 -0.77506803 -0.03625775 -0.33714607 -0.50663443 #> 79 80 81 82 83 84 #> 3.39545595 1.67065809 0.59700456 0.21191889 -0.95321653 0.09614543 #> 85 86 87 88 89 90 #> -0.81464738 0.06614945 0.48057105 0.19016834 0.66612193 -0.09193099 #> 91 92 93 94 95 96 #> 1.75256272 -0.20137638 0.14243340 2.91833295 -0.28558849 -0.82617388 #> 97 98 99 100 101 102 #> 0.27334744 0.46876777 1.76464878 0.52100413 -0.64200484 -0.90134113 #> 103 104 105 106 107 108 #> -0.43488205 0.27692751 1.97425813 -0.90869789 -0.40437975 -0.52552578 #> 109 110 111 112 113 114 #> -0.88471789 0.38463189 1.57202780 -0.32744166 -0.53343965 0.45590880 #> 115 116 117 118 119 120 #> 0.89873292 -0.19075853 3.36214981 0.14587381 -0.41766385 0.27692751 #> 121 122 123 124 125 126 #> -0.21157137 -0.70687533 -0.69778987 0.24921786 0.10862856 0.95583403 #> 127 128 129 130 131 132 #> -0.87266653 -0.35276171 -0.51723632 2.72034807 1.09691365 0.80472109 #> 133 134 135 136 137 138 #> 0.22249993 -0.76272686 -0.88239085 0.01556875 -0.74219370 0.54016287 #> 139 140 141 142 143 144 #> -0.33555891 2.18228673 -0.83976382 1.00534096 -1.17508473 -0.06156278 #> 145 146 147 148 149 150 #> -0.41456759 -0.40587699 -0.59603241 1.72081521 0.38811327 2.74005105 #> 151 152 153 154 155 156 #> -0.01645995 1.24924193 0.52117698 -0.13978377 0.18086638 0.47036536 #> 157 158 159 160 161 162 #> -0.90134113 -0.70977793 0.10085653 -0.69204125 -0.69204125 -0.09450537 #> 163 164 165 166 167 168 #> -0.60140007 -0.73635786 -0.66622971 -0.76671351 -0.66622971 1.14715351 #> 169 170 171 172 173 174 #> -0.01846952 0.37231245 1.02174999 0.49928430 -0.37324608 -0.17680776 #> 175 176 177 178 179 180 #> -0.65545725 -0.67717473 0.35534460 -0.39471935 -0.77087973 0.38052348 #> 181 182 183 184 185 186 #> -0.67833495 1.33231191 -0.61717949 -0.64310394 -0.46478308 4.52763825 #> 187 188 189 190 191 192 #> -0.28998074 3.67414170 -0.83663362 -0.08877624 -0.43687463 -0.16652992 #> 193 194 195 196 197 198 #> -0.18542350 -0.59694209 -0.52854626 -0.41829594 1.26241046 -0.95079292 #> 199 200 201 202 203 204 #> -0.78411599 -0.42191070 -0.74418909 2.05033642 -0.59510568 -0.68086189 #> 205 206 207 208 209 210 #> -0.85481997 -0.73657818 -0.83761766 -0.69726252 -1.07021401 -0.75026727 #> 211 212 213 214 215 216 #> -0.24085369 -0.64661010 -0.92770855 -0.68086189 0.38052348 0.13360244 #> 217 218 219 220 221 222 #> -0.54704577 -0.94073571 -0.77205663 0.30551865 -0.86422324 0.24415512 #> 223 224 225 226 227 228 #> -0.84746865 -0.22877926 0.09816993 1.35868141 -0.72273548 -0.63787942 #> 229 230 231 232 233 234 #> -0.67350705 -0.85025525 -0.65673967 0.57048488 -0.47092466 -0.65545725 #> 235 236 237 238 239 240 #> -1.05220752 -0.74813446 -0.40763656 -0.55115664 -0.22566644 -0.18542350 #> 241 242 243 244 245 246 #> -0.49172597 -0.46748721 0.81897758 1.47005988 2.06285637 -0.82310857 #> 247 248 249 250 251 252 #> 1.00862238 -0.39915233 -0.76570571 -0.48322291 -0.80501438 0.38424170 #> 253 254 255 256 257 258 #> -1.02421193 3.18597921 -0.60664070 -0.27362076 -0.31032755 -0.70339957 #> 259 260 261 262 263 264 #> -0.36719740 4.71779745 -0.75097412 2.66604046 -0.96917249 -0.31651005 #> 265 266 267 268 269 270 #> 1.34544677 -0.82040814 1.01790374 0.28902890 -0.67833495 -0.08612586 #> 271 272 273 274 275 276 #> 0.08413330 -0.74418909 0.21985649 -0.66261984 -0.37022161 0.55354798 #> 277 278 279 280 281 282 #> -0.33696339 -0.69959340 -0.66261984 -0.31579747 1.28341800 0.10284439 #> 283 284 285 286 287 288 #> -0.71688090 -0.44638565 -0.09585084 -0.55753269 -0.43080158 -0.13398968 #> 289 290 291 292 293 294 #> 0.81897758 -0.73416540 1.56651720 -0.89180494 -0.59196210 -0.96325248 #> 295 296 297 298 299 300 #> 0.51231691 1.88427112 0.20199108 -0.81819156 -0.74418909 -0.42191070 #> 301 302 303 304 305 306 #> 0.26170540 -0.69817561 -0.15686835 -0.38336721 -0.07773000 -0.52195149 #> 307 308 309 310 311 312 #> 0.22383594 1.04507724 -0.54818755 -0.78968567 0.11332581 -0.94575118 #> 313 314 #> -0.70487803 -0.17483471#> 1 2 3 4 5 6 #> -0.396542094 -0.396542094 -0.666838134 -0.531690114 -0.531690114 0.819790084 #> 7 8 9 10 11 12 #> 0.549494045 0.008901965 0.414346025 2.023428505 0.424411887 -0.261394074 #> 13 14 15 16 17 18 #> -0.261394074 -0.418522964 -0.534998083 -0.937134173 -0.801986153 -0.937134173 #> 19 20 21 22 23 24 #> -0.508527903 2.306418302 -0.666838134 -0.937134173 -0.801986153 -0.937134173 #> 25 26 27 28 29 30 #> 0.144049985 -0.418522964 0.008901965 -0.937134173 -0.666838134 -0.688537780 #> 31 32 33 34 35 36 #> -0.937134173 -0.801986153 -0.531690114 -0.937134173 -0.937134173 2.847010381 #> 37 38 39 40 41 42 #> 0.144049985 -0.261394074 -0.508527903 2.711862362 -0.261394074 1.495530183 #> 43 44 45 46 47 48 #> 1.630678203 0.279198005 0.279198005 -0.396542094 -0.666838134 -0.531690114 #> 49 50 51 52 53 54 #> 0.279198005 1.765826223 -0.126246054 -0.937134173 2.711862362 0.684642064 #> 55 56 57 58 59 60 #> 3.657898500 -0.801986153 1.561585684 -0.238513087 -0.531690114 -0.666838134 #> 61 62 63 64 65 66 #> -0.801986153 0.008901965 -0.396542094 0.144049985 -0.126246054 1.225234144 #> 67 68 69 70 71 72 #> -0.418522964 -0.396542094 0.104608564 -0.261394074 -0.937134173 0.279198005 #> 73 74 75 76 77 78 #> -0.854801407 0.144049985 -0.854801407 0.301516544 -0.396542094 -0.666838134 #> 79 80 81 82 83 84 #> 3.793046520 2.171270282 0.819790084 -0.126246054 -0.688537780 -0.126246054 #> 85 86 87 88 89 90 #> -0.937134173 0.031501728 0.549494045 0.549494045 0.424411887 -0.126246054 #> 91 92 93 94 95 96 #> 2.171270282 -0.261394074 -0.261394074 1.651590623 0.008901965 -0.801986153 #> 97 98 99 100 101 102 #> 0.279198005 0.549494045 1.495530183 0.684642064 -0.418522964 -0.937134173 #> 103 104 105 106 107 108 #> -0.396542094 0.414346025 0.751541237 -0.801986153 0.121506667 -0.531690114 #> 109 110 111 112 113 114 #> -0.937134173 0.279198005 0.954938104 0.008901965 -0.531690114 0.414346025 #> 115 116 117 118 119 120 #> 0.684642064 -0.126246054 3.793046520 0.481526421 -0.531690114 0.414346025 #> 121 122 123 124 125 126 #> -0.126246054 -0.688537780 -0.666838134 -0.126246054 -0.261394074 0.819790084 #> 127 128 129 130 131 132 #> -0.328518026 -0.261394074 -0.531690114 3.117306421 1.225234144 1.090086124 #> 133 134 135 136 137 138 #> 0.684642064 -0.801986153 -0.598532841 0.008901965 -0.801986153 0.414346025 #> 139 140 141 142 143 144 #> -0.531690114 1.741595561 -0.666838134 0.819790084 -0.508527903 -0.261394074 #> 145 146 147 148 149 150 #> -0.261394074 -0.396542094 -0.531690114 1.765826223 0.684642064 2.101615315 #> 151 152 153 154 155 156 #> -0.126246054 0.954938104 0.481526421 -0.148508149 0.391521483 0.391521483 #> 157 158 159 160 161 162 #> -0.937134173 -0.801986153 0.424411887 -0.854801407 -0.854801407 -0.215194760 #> 163 164 165 166 167 168 #> -0.534998083 -0.666838134 -0.854801407 -0.854801407 -0.854801407 1.383821858 #> 169 170 171 172 173 174 #> -0.215194760 0.279198005 1.064018534 0.424411887 -0.534998083 0.008901965 #> 175 176 177 178 179 180 #> -0.854801407 -0.854801407 0.424411887 -0.666838134 -0.854801407 0.424411887 #> 181 182 183 184 185 186 #> -0.666838134 0.931551114 -0.534998083 -0.854801407 -0.534998083 4.262051769 #> 187 188 189 190 191 192 #> -0.148508149 4.262051769 -0.937134173 0.031501728 -0.534998083 -0.215194760 #> 193 194 195 196 197 198 #> 0.104608564 -0.396542094 -0.666838134 -0.328518026 1.383821858 -0.937134173 #> 199 200 201 202 203 204 #> -0.801986153 -0.534998083 -0.854801407 3.302641799 -0.534998083 -0.854801407 #> 205 206 207 208 209 210 #> -0.801986153 -0.854801407 -0.598532841 -0.854801407 -0.598532841 -0.854801407 #> 211 212 213 214 215 216 #> -0.215194760 -0.854801407 -0.598532841 -0.854801407 0.424411887 0.104608564 #> 217 218 219 220 221 222 #> -0.534998083 -0.937134173 -0.801986153 0.424411887 -0.801986153 0.279198005 #> 223 224 225 226 227 228 #> -0.854801407 -0.396542094 0.144049985 0.819790084 -0.854801407 -0.854801407 #> 229 230 231 232 233 234 #> -0.854801407 -0.937134173 -0.666838134 0.744215211 -0.534998083 -0.854801407 #> 235 236 237 238 239 240 #> -0.688537780 -0.801986153 -0.215194760 -0.598532841 -0.261394074 0.104608564 #> 241 242 243 244 245 246 #> -0.534998083 -0.531690114 1.064018534 1.703625181 1.900974243 -0.801986153 #> 247 248 249 250 251 252 #> 1.383821858 -0.261394074 -0.801986153 -0.534998083 -0.854801407 0.424411887 #> 253 254 255 256 257 258 #> -0.937134173 3.622445122 -0.666838134 -0.215194760 -0.215194760 -0.854801407 #> 259 260 261 262 263 264 #> -0.534998083 5.221461740 -0.666838134 2.663035152 -0.688537780 -0.261394074 #> 265 266 267 268 269 270 #> 0.481526421 -0.854801407 0.744215211 0.104608564 -0.666838134 -0.215194760 #> 271 272 273 274 275 276 #> -0.238513087 -0.854801407 0.104608564 -0.854801407 -0.534998083 0.279198005 #> 277 278 279 280 281 282 #> -0.534998083 -0.854801407 -0.854801407 -0.534998083 0.684642064 0.104608564 #> 283 284 285 286 287 288 #> -0.854801407 -0.534998083 -0.238513087 -0.534998083 -0.534998083 0.008901965 #> 289 290 291 292 293 294 #> 1.064018534 -0.854801407 1.703625181 -0.937134173 -0.534998083 -0.937134173 #> 295 296 297 298 299 300 #> 0.424411887 1.360382163 -0.148508149 -0.854801407 -0.854801407 -0.534998083 #> 301 302 303 304 305 306 #> 0.104608564 -0.801986153 -0.215194760 -0.215194760 -0.215194760 -0.261394074 #> 307 308 309 310 311 312 #> 0.104608564 1.383821858 -0.534998083 -0.801986153 0.104608564 -0.937134173 #> 313 314 #> -0.854801407 -0.215194760