easystats / easystats/performance

Outliers in glmmTMB

Open
#95 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement :boom: Low priority :sleeping:
Dominant language
R
Stars
1.2k
Forks
109
Avg merge
6h 34m
Merged PRs (30d)
8

Description

From R mixed models list:

I don't know about packages that will directly work with glmmTMB objects, but computing Cook's distances can be easily done by hand. Let b be the vector with the estimated fixed effects from the model and V(b) the corresponding var-cov matrix. You can extract these with fixef() and vcov() from your model. Now leave out either a single observation or a cluster of observations (e.g., all observations corresponding to an individual) and let b_{-i} denote the estimated fixed effects when fitting the data to this subset of the dataset. Then Cook's distances is simply

D_i = (b - b_{-i})' V(b)^{-1} (b - b_{-i})

Now rinse and repeat for every i, which is easily done in a loop. It might take a while to complete depending on how complex your model is.

Some might compute D_i with V(b_{-i})^{-1} in place of V(b)^{-1}. Can be done easily at the same time, so you could do both and compare.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by reviewing how the package handles model-specific performance metrics and how glmmTMB objects expose fixef() and vcov(); clarify the supported outlier method and the expected validation before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.