JanaJarecki / cognitivemodels

Cognitivemodels is an open-source R library to create, fit, test, and compare computational cognitive models based on machine-learning principles.
25 stars 4 forks source link

Wrong order in y option leads to error about x option? #40

Closed FlorianSeitz closed 4 years ago

FlorianSeitz commented 4 years ago

https://github.com/JanaJarecki/cognitivemodels/blob/e890596d7d11745b2f01e24a4cdbecbaff0a28f6/tests/testthat/test_shortfall.R#L164

Error in private$check_input() : Probabilities (which are the 2nd, 4th, 6th... element of right side of "formula") must sum to 1, but the following variables in your data do NOT sum to 1: [x1, x2]. Check the probability variables in "formula" and in "data".

Wrong order in y option leads to error about x option. I guess this is because you always use the letter "x" to display the error in case of a false order, right? The error by itself is super comprehensible, maybe we could even improve it by stating the exact variables where it occurs (i.e., "the following variables in your data do NOT sum to 1: [y2, I(1-py)]").

JanaJarecki commented 4 years ago

-> @todo implement the gamble functions in PT