Skip to content

unexpected set_prior behaviour with vector inputs #1888

Description

@daskandalis

When coef= and resp= are both vectors, set_prior behaves unexpectedly if the user is expecting an expanded grid of the vector inputs.

The behaviour when coef and resp are the same size may lead to surprising prior combinations:

set_prior( 'normal(0,1)',
           class='b',
           coef = c('x1','x2'),
           resp = c('w','u') )

returns

prior class coef group resp dpar nlpar   lb   ub tag source
 normal(0,1)     b   x1          y            <NA> <NA>       user
 normal(0,1)     b   x2          z            <NA> <NA>       user

The source of the error when coef and resp are not the same size is not necessarily clear to the user:

set_prior( 'normal(0,1)',
           class='b',
           coef = c('x1','x2'),
           resp = c('w','u','v') )      

returns

Error in `set_prior()`:
! Processing arguments of 'set_prior' has failed:
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
  arguments imply differing number of rows: 1, 2, 3

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions