[Gretl-devel] Re: Cumulated values of matrix with missing values
Am 06.05.2021 um 13:02 schrieb Allin Cottrell: On Thu, 6 May 2021, Sven Schreiber wrote: Am 06.05.2021 um 10:05 schrieb Sven Schreiber: Right, but I'm wondering whether this isn't inefficient because the ok values are overwritten with themselves. Or aren't they internally? BTW, shouldn't this work? matrix m = {1, NA} eval misszero(m[2]) I'm getting an error "is matrix not series", but m[2] should -I believe- be auto-converted to scalar type here. Actually no. The policy for some time now has been that a 1x1 submatrix remains a matrix in the course of calculation, and is auto-converted to a scalar only on assignment. This seemed to be the way to minimize unexpected results. OK. What does work then is a workaround like misszero(min(m[2])). (BTW, it is undocumented that min and max work on a matrix.) thanks sven ___ Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/
[Gretl-devel] Re: Cumulated values of matrix with missing values
On Thu, 6 May 2021, Sven Schreiber wrote: Am 06.05.2021 um 10:05 schrieb Sven Schreiber: Right, but I'm wondering whether this isn't inefficient because the ok values are overwritten with themselves. Or aren't they internally? BTW, shouldn't this work? matrix m = {1, NA} eval misszero(m[2]) I'm getting an error "is matrix not series", but m[2] should -I believe- be auto-converted to scalar type here. Actually no. The policy for some time now has been that a 1x1 submatrix remains a matrix in the course of calculation, and is auto-converted to a scalar only on assignment. This seemed to be the way to minimize unexpected results. Allin ___ Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/
[Gretl-devel] Re: Cumulated values of matrix with missing values
Am 06.05.2021 um 10:05 schrieb Sven Schreiber: Right, but I'm wondering whether this isn't inefficient because the ok values are overwritten with themselves. Or aren't they internally? BTW, shouldn't this work? matrix m = {1, NA} eval misszero(m[2]) I'm getting an error "is matrix not series", but m[2] should -I believe- be auto-converted to scalar type here. cheers sven ___ Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/
[Gretl-devel] Re: Cumulated values of matrix with missing values
Am 06.05.2021 um 09:42 schrieb atecon: Am 06.05.2021 08:38 schrieb Sven Schreiber: I'd say it's expected because nans propagate. Basically you don't know what 3 + nan is. To get what you want, I was going to say "do cum(misszero(m))", but that doesn't work on a matrix. Maybe it should? (But remember the old fact that a NaN and a missing value is not always the same thing.) True, 3 + nan remains unclear or is actually not defined. Fine for me if that's how it is handled -- just wanted to know what's expected in this case. Replacing nan values in matrix can be easily done by: m = ok(m) ? m : VALUE # VALUE is some numeric value Right, but I'm wondering whether this isn't inefficient because the ok values are overwritten with themselves. Or aren't they internally? cheers sven ___ Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/
[Gretl-devel] Re: Cumulated values of matrix with missing values
Am 06.05.2021 08:38 schrieb Sven Schreiber: Am 06.05.2021 um 07:42 schrieb atecon: Hi all, I just would like to ask whether this behavior is actually expected: matrix m = {1, NA; 2, 3} print m eval cum(m) ? print m m (2 x 2) 1 nan 2 3 ? eval cum(m) 1 nan 3 nan I expected the entry (2,2) to be 3 as this is the first valid value of the 2nd column. I'd say it's expected because nans propagate. Basically you don't know what 3 + nan is. To get what you want, I was going to say "do cum(misszero(m))", but that doesn't work on a matrix. Maybe it should? (But remember the old fact that a NaN and a missing value is not always the same thing.) True, 3 + nan remains unclear or is actually not defined. Fine for me if that's how it is handled -- just wanted to know what's expected in this case. Replacing nan values in matrix can be easily done by: m = ok(m) ? m : VALUE # VALUE is some numeric value Thanks, Artur ___ Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/
[Gretl-devel] Re: Cumulated values of matrix with missing values
Am 06.05.2021 um 07:42 schrieb atecon: Hi all, I just would like to ask whether this behavior is actually expected: matrix m = {1, NA; 2, 3} print m eval cum(m) ? print m m (2 x 2) 1 nan 2 3 ? eval cum(m) 1 nan 3 nan I expected the entry (2,2) to be 3 as this is the first valid value of the 2nd column. I'd say it's expected because nans propagate. Basically you don't know what 3 + nan is. To get what you want, I was going to say "do cum(misszero(m))", but that doesn't work on a matrix. Maybe it should? (But remember the old fact that a NaN and a missing value is not always the same thing.) cheers sven ___ Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/