Cook’s distance are used for estimate of the influence of an single observation.

scoreCooksDistance(object, print = TRUE)

Arguments

object

An object of class ModelAudit.

print

If TRUE progress is printed.

Value

numeric vector

Details

Cook’s distance is a tool for identifying observations that may negatively affect the model. They may be also used for indicating regions of the design space where it would be good to obtain more observations. Data points indicated by Cook’s distances are worth checking for validity.

Cook’s Distances are calculated by removing the i-th observation from the data and recalculating the model. It shows how much all the values in the model change when the i-th observation is removed.

Models of classes other than lm and glm the distances are computed directly from the definition, so this may take a while.

See also

Examples

library(car) lm_model <- lm(prestige~education + women + income, data = Prestige) lm_au <- audit(lm_model, data = Prestige, y = Prestige$prestige) scoreCooksDistance(lm_au)
#> gov.administrators general.managers accountants #> 2.428267e-03 2.832697e-01 1.626121e-03 #> purchasing.officers chemists physicists #> 1.082658e-03 1.377992e-02 4.882702e-03 #> biologists architects civil.engineers #> 6.387086e-03 6.269429e-04 2.971297e-03 #> mining.engineers surveyors draughtsmen #> 5.231977e-06 1.622283e-02 4.172801e-03 #> computer.programers economists psychologists #> 9.065386e-03 3.516136e-04 2.169004e-02 #> social.workers lawyers librarians #> 4.736014e-03 2.362512e-03 5.954443e-04 #> vocational.counsellors ministers university.teachers #> 1.987192e-02 8.388665e-02 1.484911e-02 #> primary.school.teachers secondary.school.teachers physicians #> 1.584048e-03 2.548978e-05 6.166504e-02 #> veterinarians osteopaths.chiropractors nurses #> 3.858089e-02 3.102104e-02 5.185906e-02 #> nursing.aides physio.therapsts pharmacists #> 4.911175e-04 5.498177e-02 1.893992e-04 #> medical.technicians commercial.artists radio.tv.announcers #> 3.391784e-02 5.101554e-03 1.935625e-04 #> athletes secretaries typists #> 3.390048e-04 6.852068e-06 1.779877e-03 #> bookkeepers tellers.cashiers computer.operators #> 1.487824e-03 1.014634e-03 5.068692e-04 #> shipping.clerks file.clerks receptionsts #> 3.824718e-03 3.959903e-02 3.093447e-03 #> mail.carriers postal.clerks telephone.operators #> 6.563431e-04 4.892611e-04 1.462173e-03 #> collectors claim.adjustors travel.clerks #> 1.760987e-02 1.937443e-03 8.541219e-03 #> office.clerks sales.supervisors commercial.travellers #> 6.700605e-03 3.567173e-04 8.673946e-03 #> sales.clerks newsboys service.station.attendant #> 1.562527e-02 1.177427e-01 4.948243e-02 #> insurance.agents real.estate.salesmen buyers #> 1.459960e-03 9.756845e-05 9.584963e-05 #> firefighters policemen cooks #> 1.019968e-04 6.862129e-05 2.592845e-05 #> bartenders funeral.directors babysitters #> 1.659973e-02 3.232608e-03 1.266394e-02 #> launderers janitors elevator.operators #> 8.930962e-03 1.188528e-02 8.503645e-03 #> farmers farm.workers rotary.well.drillers #> 4.899856e-02 1.148605e-02 1.561217e-03 #> bakers slaughterers.1 slaughterers.2 #> 8.279081e-03 4.390716e-03 9.233956e-04 #> canners textile.weavers textile.labourers #> 1.749033e-03 6.540165e-03 1.489118e-03 #> tool.die.makers machinists sheet.metal.workers #> 9.062896e-04 2.451712e-03 1.151053e-04 #> welders auto.workers aircraft.workers #> 5.388366e-03 9.738267e-07 2.200670e-03 #> electronic.workers radio.tv.repairmen sewing.mach.operators #> 4.934191e-02 4.137224e-03 1.397534e-02 #> auto.repairmen aircraft.repairmen railway.sectionmen #> 1.269647e-03 1.665114e-03 1.638252e-10 #> electrical.linemen electricians construction.foremen #> 1.183954e-04 2.873767e-03 2.019788e-02 #> carpenters masons house.painters #> 1.491918e-02 1.027504e-02 4.754342e-04 #> plumbers construction.labourers pilots #> 3.493312e-03 1.594688e-03 1.748322e-03 #> train.engineers bus.drivers taxi.drivers #> 9.635459e-03 1.574710e-03 5.745797e-03 #> longshoremen typesetters bookbinders #> 8.498365e-03 8.455003e-05 7.186315e-04