loo icon indicating copy to clipboard operation
loo copied to clipboard

loo_compare and loo_model_weights have different behavior for list argument

Open avehtari opened this issue 5 years ago • 0 comments

If the list of loo objects has some named elements the output column names behave differently. For example,

> loo_compare(list(loo1,`Model f1+f2`=loo2))
            elpd_diff se_diff
Model f1+f2    0.0       0.0 
model1      -530.0      31.1 

> loo_model_weights(list(loo1,`Model f1+f2`=loo2))
Method: stacking
------
       weight
model1 0.000 
model2 1.000 

If all list elements are named, then both behave nicely

> loo_compare(list(`Model f1`=loo1,`Model f2`=loo2))
            elpd_diff se_diff
Model f1+f2    0.0       0.0 
Model f1    -530.0      31.1 
> loo_model_weights(list(`Model f1`=loo1,`Model f1+f2`=loo2))
Method: stacking
------
            weight
Model f1    0.000 
Model f1+f2 1.000 

It would be good to fix this, and then demonstrate the use of naming models in vignettes and help text, as people sometimes get confused what is the order as the order is not the same as the order of loo objects in the argument and the order can be different in loo_compare and in loo_model_weights.

avehtari avatar Jan 10 '21 17:01 avehtari