Posterior point estimates of the deviance residual at each observed row, from
the fitted likelihood, matching augment()'s residual column.
Usage
# S3 method for class 'kb_fit'
residuals(object, ...)Details
The deviance residual is computed per draw, then summarised with the posterior
median, from the likelihood of the fit's model (see kb_model_describe()).
Where the cover calibration has a presence part, the residual combines the
deviances of plant presence and biomass and is signed by the difference
from the expected biomass.
See also
fitted() for fitted values, and augment().
Other fit methods:
augment.kb_fit(),
coef.kb_fit(),
fitted.kb_fit(),
glance.kb_fit(),
kb_model_describe(),
kb_samples(),
kb_stancode(),
log_lik.kb_fit(),
posterior_epred.kb_fit(),
posterior_linpred.kb_fit(),
posterior_predict.kb_fit(),
prior_summary.kb_fit(),
summary.kb_fit(),
tidy.kb_fit()
Examples
residuals(fit_weight_sim_nereo)
#> [1] -0.1167826644 1.9128178445 0.6398947746 -0.1537870533 -0.8765039066
#> [6] 0.0529056476 0.3894708912 -1.0544870503 -1.2482304651 0.5082563693
#> [11] -0.1573951045 -1.2063851620 -2.6598214644 1.1188454061 -0.2035139725
#> [16] 0.5272214715 0.2607772418 -0.2893630435 1.0525908144 1.2003773196
#> [21] 0.5717863129 -0.5054483997 -0.4831715129 0.9664297132 -0.8021483036
#> [26] 1.6568625136 -0.0276455757 0.7657152277 0.0634183857 0.1527459264
#> [31] 0.3267502359 0.6975155762 0.4874606687 0.3599720196 -0.8130766994
#> [36] -0.6953097155 -1.2235970495 0.4275492436 -1.8190253295 0.2458536044
#> [41] 0.7648278973 1.0379386948 1.5501704177 -0.3785648636 -0.1665816468
#> [46] 0.4546306177 -0.6237696758 1.2886474298 0.4994986549 -0.2586999943
#> [51] 0.3660347077 -0.4369223202 -0.0709045261 -0.8756911827 -0.1960408043
#> [56] -0.7221706941 -0.9491199315 0.0468649075 0.8248380795 -1.0918213831
#> [61] 0.0292360931 0.6213012103 -0.2727335703 -0.1424201188 0.1997984903
#> [66] 0.0949654676 1.0585569727 0.1062278823 -0.7477594665 0.7599286532
#> [71] 0.8495092757 -0.2740767597 -0.1840065721 0.2242726161 -0.4274532486
#> [76] 0.4204264883 -2.9840745865 0.9124179023 -0.8391203859 0.5076007009
#> [81] -0.9945225548 0.8773109678 -0.8126691810 -0.8254221471 2.3291777032
#> [86] 0.6616927356 0.3098911985 -0.6365429760 -0.4015063570 -0.2968735749
#> [91] 0.1102142739 -0.7510567163 -1.4021317156 0.4625247955 -1.5652624080
#> [96] 0.9021102399 -0.4450957007 0.5458029130 1.5475118612 0.6242894354
#> [101] -0.8390056411 -0.2755762787 1.2247562229 0.2110944621 0.1571023505
#> [106] 0.2379701232 -1.8726667435 -0.9187035318 -1.5856975998 0.7859781760
#> [111] -0.0059237836 -0.5955335112 0.4802977431 0.4906137863 1.2161958778
#> [116] 1.1964201225 -0.1283553399 -1.3701128282 -0.6888112455 -0.2823981083
#> [121] 0.4553580013 -0.1816589528 0.2419720090 0.4051935708 0.9298168524
#> [126] -0.0758799126 -2.1669976956 -0.2339105459 -0.6735602201 -1.5444985244
#> [131] 0.0012110921 -1.2511958031 -0.4976999898 1.8073414680 -3.0446227889
#> [136] 2.0110140751 -0.3371848621 -0.0004112483 1.2998617234 -0.0087879058
#> [141] 1.8025973409 0.3659269211 0.6190074467 -1.8691157426 -1.5595939622
#> [146] 0.1896337914 -1.1282555908 0.3437478062 0.9920739888 0.5512861700
#> [151] -1.0894366992 -0.6398259436 0.3194974871 2.0982328046 0.0257735398
#> [156] -1.6181952307 0.8459527379 1.2511102918 1.2348214180 1.0096003136
#> [161] 1.9084008522 -0.0530502972 -0.5001315356 -0.5737429280 0.2476333979
#> [166] 1.2713365379 -0.2106870680 0.5380781043 -1.4295134056 0.4609878007
#> [171] -1.7255193414 -0.2208506205 1.3108372299 -0.7618867571 0.1286014789
#> [176] -0.1134044763 -0.7931174713 -1.1822713667 1.4040709581 0.7396986317
#> [181] -0.0522453845 1.0431374084 -0.1441763439 -0.5922634339 -0.5022856968
#> [186] -0.0534206420 0.9595854148 1.5204575871 -0.6242792282 -1.3580097030
#> [191] -0.2312408590 0.7503531329 -0.6785891988 -0.4796368131 -0.7373886761
#> [196] -1.6954202783 -1.0607813462 1.0958533206 0.5508488891 -0.7269726954
#> [201] -0.0300400807 0.5043597426 1.3694936057 -0.0749288637 -0.2336787074
#> [206] 0.8861245900 1.1280173683 -1.0761187453 0.4834202979 0.2223833285
#> [211] -0.1245636053 -0.3302598964 -0.2369092741 -1.5478981202 0.5027751449
#> [216] -0.9054010081 2.1588804768 -1.4235404773 0.9539545130 -0.9762034259
#> [221] -1.1173006005 -0.0780296543 1.0317293835 -1.7090559527 1.7997519117
#> [226] -1.8980434319 -0.3986369118 0.3630126292 1.4915654018 -0.0811916098
#> [231] -0.4055574972 1.0547099549 -1.7620123980 0.3207975928 -0.2989113827
#> [236] 0.3702284608 1.2246275033 -0.1896649098 0.2163033735 0.4954352438
#> [241] -1.1956854779 1.2012064201 1.4485474292 -0.8482619094 1.3415231845
#> [246] 1.6541254509 0.0450898349 -0.6881389524 0.8686122342 -0.9837986996
#> [251] -0.0301468664 -0.5129797629 -1.1592914908 -0.0192058290 0.6563364499
#> [256] -1.7454408656 0.7871213617 0.6254035660 0.2246777525 -0.4304616416
#> [261] -0.1582646484 0.7360732985 -0.0366883895 -1.3538938589 0.7637256424
#> [266] 1.5833079627 1.6327009681 -0.3636601559 -1.3392656097 2.5809265798
#> [271] 0.0717788400 0.4233686473 -0.9700884251 0.7754999633 -0.7098407330
#> [276] 0.4857367609 -1.8635361264 0.4453890675 0.3174352526 -2.0070024773
#> [281] -0.3499528715 0.9808878558 -1.2782514942 -1.7550337251 1.2639306121
#> [286] -0.8641698139 1.0006810569 -1.6739131536 -0.6710710314 0.8366269526
#> [291] -0.0323841419 -0.8415706274 -1.2502295841 0.6516849526 -0.2546720540
#> [296] 0.3451133183 -0.7660602013 0.1298454894 0.2361648825 0.6049164305
#> [301] 1.0632373161 -0.1988524679 -1.1760204202 -1.1599323762 0.4347660306
#> [306] 0.2828441955 -1.5662298490 -0.5009998687 1.2504541829 0.7739722189
#> [311] 0.4703435522 0.4528110162 0.8131084867 -0.0020310829 -0.3101394202
#> [316] -0.8772258377 0.6991509595 0.4308253123 0.6630795881 0.1742414523
#> [321] -2.0644076111 -2.0097409285 -1.4417629537 -1.2120641338 1.3958755450
#> [326] 0.0533086642 -0.6724991221 2.3324002426 -0.8122297801 -0.1660692044
#> [331] -0.5296263626 -0.7879745467 0.5713816192 1.2120356074 1.0338250498
#> [336] 1.0331156193 -0.4466118687 1.5333009943 0.6791711796 1.0935466504
#> [341] -0.4403826834 -0.6142083746 -1.6689267866 -0.1995213694 1.3556701560
#> [346] 1.1788205834 -0.6118149419 -0.0751422571 1.5552252682 -0.6297943033
#> [351] 2.6417126323 -0.8326297979 -0.2242428284 -0.6184449093 0.2884924881
#> [356] -0.7328707481 -2.4204101718 1.4190705012 1.2137908119 0.6271169716
#> [361] 0.2553674933 -0.3931620285 -0.6993171270 0.2234443327 0.3843838676
#> [366] 1.6642937349 -1.0869281554 -0.5772004866 0.7789802575 -1.9307672191
#> [371] -0.5579674174 0.3000790106 0.9504449706 -0.9116989670 -0.7850212242
#> [376] 2.2028011700 -0.2160653712 -1.6267569429 -0.3027953084 0.5578982062
#> [381] 2.2588999059 0.3367024054 1.2403561253 1.9095884094 -2.5311693289
#> [386] -2.2707174966 -0.6603595400 -1.0667590701 -0.2925214975 0.1211875350
#> [391] -0.0096475407 1.2294446879 -0.3255191339 -1.0772442121 -0.3748322593
#> [396] 0.0588691778 0.4982433348 -0.7777837973 0.8125678934 -0.3040828473
#> [401] -0.4180540439 0.0087885075 1.6965597470 -0.1784622398 -0.4405368213
#> [406] -0.5196914197 -0.0871565086 -1.1977839779 0.8453777630 0.2141966936
#> [411] -2.7368373688 0.5396000796 -0.6915628100 -0.8089215070 0.6603076887
#> [416] -0.8518101265 1.7394801955 0.7808571875 0.0652168501 1.4788646898
#> [421] 1.0821443963 0.3428084607 -0.8071495080 0.0762797904 -1.3827634975
#> [426] 0.3264042565 -0.1042576243 -1.1962555407 1.2362277566 0.9984228297
#> [431] 0.4198416405 0.4010908977 -0.2924389326 0.0655856875 -0.2711962682
#> [436] -0.8846356612 0.4182118536 0.8470550763 -0.0616112411 0.1747730103
#> [441] -0.8423052064 0.1550900970 0.2528084524 0.5344305478 0.0987879313
#> [446] -1.0498938909 -1.0037297270 -0.2725010859 0.1280939188 -0.3113762721
#> [451] 0.4031557398 0.8296916999 0.3714248144 -0.8872017778 -1.1600095742
#> [456] 0.2391711297 -0.6283606213 -0.0945704588 1.0355754718 -0.3440801689
#> [461] 1.2186654524 -0.5303178349 -1.2845942534 -1.1454171013 1.6318495880
#> [466] 0.2867163802 0.6251045154 0.2611939814 1.0355731820 -0.2009355011
#> [471] -0.9837516205 -0.4281400596 -2.6380123911 -0.7066177963 0.1054791743
#> [476] 0.2415878394 1.9174134977 0.8205560190 -0.0038549877 1.7434967351
#> [481] -1.5475998636 -0.4693466793 1.3969959740 -0.0635157372 0.8241771949
#> [486] 1.3024010053 0.7710586203 -1.1040905706 0.4582890332 -0.7922888500
#> [491] -2.3651248372 -0.3511991869 -0.9755638470 0.1383553613 0.3470159312
#> [496] -1.2196498145 0.3682953155 0.6263574105 -0.4958326996 0.1699723011
#> [501] 0.2221375642 -1.4778786888 0.8055383242 1.0116128924 -0.0971166553
#> [506] 0.1773385405 0.4229061303 -1.0710720713 -0.9739277502 0.4900871469
#> [511] 1.2856625891 0.0821213861 1.4707244485 -0.3418265415 1.7350179765
#> [516] -0.3302719484 -1.0697681778 -1.0489167476 -0.1841675429 0.4401316903
#> [521] -2.4145205644 -1.7126679462 -1.4649389478 -0.2356193135 -1.2238190107
#> [526] -0.2551479456 -1.3525789885 2.4479605603 -0.0089120683 -0.6721119316
#> [531] -1.3400306126 0.6684581348 1.4348231322 0.6253319922 0.3706999275
#> [536] 1.4946161788 0.7306170960 0.3599423205 -1.1887364144 -0.3619597127
#> [541] 0.8872624062 -0.3866440671 0.4797678077 -0.4962165714 0.1821771451
#> [546] -0.2361638490 -0.0229139836 -0.8863349775 1.4346508997 -0.2891105464
#> [551] 0.9473519083 -0.4648823636 0.3222019198 -0.2344933522 -0.0618382150
#> [556] 2.6278407779 -0.4921503949 0.2717912340 -0.2941450277 0.5152321370
#> [561] 0.8976341796 -0.3610662997 0.2393717724 -0.0368284542 -0.4501924824
#> [566] 0.2532511930 0.2287561719 1.9413562093 -0.8509149139 -0.5551284206
#> [571] 1.5668929057 -0.9134888703 -0.8815330878 -0.8438070876 -0.2888305128
#> [576] -0.9820736319 -0.4969955830 0.6760246921 0.2113604648 -1.5661043995
#> [581] -0.1539130283 -0.5998241126 0.2716437010 -1.5575035615 0.5766365871
#> [586] 0.3713562362 0.6366354886 0.6004363371 0.3768864550 0.8295629752
#> [591] -0.2213688552 2.2411447733 -1.3123145149 -1.2903599804 0.9494209666
#> [596] 0.5170210401 0.0793313255 0.9261028230 -1.0562863996 -0.7301308019
#> [601] -0.2731765841 -0.8125985508 -0.2233185587 0.6724657026 1.2444992200
#> [606] -0.6487525464 0.2640997324 0.3151809182 0.5184165280 0.3816664216
#> [611] 1.5325178825 0.0784559815 -1.1190511300 0.4766862706 0.5932796314
#> [616] -0.2255942114 -0.8987303332 -1.5336020090 -0.1055062467 0.6674473544
#> [621] -0.3090098006 1.3006599123 -1.8350299910 1.0638653140 0.0180651413
#> [626] 2.2949849656 -0.2174717344 -0.0320284383 0.0987447002 0.0416510166
#> [631] -0.7417666283 0.2709906121 -1.6223167164 -0.0475271943 0.1622364808
#> [636] -1.6561484088 1.0699350130 0.9690115525 0.1525338006 1.0543982750
#> [641] 1.1602940191 0.6962480185 0.5510155091 0.1739323980 0.1142972593
#> [646] -1.6741266997 -0.0770391950 0.0306861160 -0.3943600655 -0.4938652691
#> [651] -1.3524685061 -0.6609216509 2.8008075341 1.0599029597 0.2787815032
#> [656] -0.4675652805 -0.5716110095 0.4498622971 -0.5733416340 0.0394938940