SBC icon indicating copy to clipboard operation
SBC copied to clipboard

Parameter vectors of length 1 are dropped from results$stats

Open lunafazio opened this issue 2 years ago • 2 comments

It seems SBC doesn't expect a length 1 variable to have an index, but if this corresponds to a vector parameter, Stan will still append an index to the parameter name. Therefore when intersect is used here, parameter vectors of length 1 will be dropped from the $stats output.

Reprex here.

(I'm just sharing this for awareness as SBC still warns that a variable has been dropped and a user-side workaround is fairly simple)

lunafazio avatar Nov 06 '22 09:11 lunafazio

Thanks for reporting this. The underlying problem here is that R does not distinguish between a scalar and vector of length 1 while C++ and Stan do. In best case scenario, this problem could automatically disappear once https://github.com/stan-dev/posterior/issues/187 is resolved. But I agree that in the meantime we might want to provide some workaround.

martinmodrak avatar Nov 06 '22 12:11 martinmodrak

Note to self: the currently developed system for variable attributes could be used to resolve this.

martinmodrak avatar Jun 26 '24 11:06 martinmodrak