Skip to content

loo.function should not require a r_eff argument #106

Closed

Description

@bgoodri

If the user is providing a function to calculate the log-likelihood contribution of each observation, why does the user also need to pass a call to relative_eff? This just seems unnecessary.

Activity

  1. jgabry commented on Apr 16, 2019

    @jgabry
    Member

    It does seem unnecessary. We can drop that and calculate it internally.

  2. jgabry commented on Apr 16, 2019

    @jgabry
    Member

    Actually, computing r_eff requires knowing which chain each posterior draw comes from. The chain id is not a required input to loo.function because LOO just needs all draws stacked together. In other words, dropping the r_eff argument would require adding a chain_id argument to loo.function or requiring a chain_id column in draws so that r_eff can be calculated internally.

    Here are three possibilities:

    # drop the r_eff argument and require a chain_id argument
    loo.function(x, ..., data, draws, chain_id)
    
    # drop the r_eff argument and require chain_id to be included in draws
    loo.function(x, ..., data, draws) # checks internally for a chain_id column in 'draws'
    
    # keep the r_eff argument and add a chain_id argument so the user can 
    # decide whether to compute r_eff and pass it in or provide chain_id and
    # let loo calculate r_eff
    loo.function(x, ..., data, draws, r_eff, chain_id)

    Anyone have a preference or other suggestions?

  3. bgoodri commented on Apr 16, 2019

    @bgoodri
    Author
  4. jgabry commented on Apr 16, 2019

    @jgabry
    Member

    Yeah if draws is an array then we don’t need the chain_id. I don’t think we should require it to be an array, but we could go with option (1) above but only requiring chain_id if draws is not an array.

    @avehtari and @paul-buerkner any preference here?

  5. avehtari commented on Mar 24, 2023

    @avehtari
    Member

    Now that we have posterior package, we have chain and iteration info often, and could compute r_eff based on those, and maybe then for the arrays/matrices without that info assume no r_eff computation unless additional information is provided?

  6. avehtari commented on Nov 29, 2023

    @avehtari
    Member

    Bumping this as I'm now in favor of reducing the need to enter r_eff. I would be fine with that r_eff=1 unless we do get chain and iteration information via draws object, and in those cases estimate r_eff internally

  7. avehtari commented on Feb 17, 2024

    @avehtari
    Member

    #235 reduced the need to provide r_eff. @bgoodri does that solve your problem?

  8. florence-bockting commented on Jun 8, 2026

    @florence-bockting
    Contributor

    I am closing this issue as #235 addresses the need to provide r_eff as requested in the issue description. Furthermore, the handling of r_eff in loo is being further developed in the refactoring PR #363. However, I am happy to reopen this issue if it is considered unresolved and still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions