Am I missing something with IFMISS?

General help and assistance with jamovi. Bug reports can be made at our issues page: https://github.com/jamovi/jamovi/issues . (If you're unsure feel free to discuss it here)
Post Reply
Wake
Posts: 43
Joined: Tue Jun 26, 2018 8:31 am

Am I missing something with IFMISS?

Post by Wake »

I'm trying to use IFMISS and VMEAN to impute missing values in a transformation but IFMISS is giving a missing value when the source is missing, rather than the desired value. I've checked it with IFMISS($source,0,1) and it doesn't work with that either.

The source variable is an ordinal integer.

Please tell me what I'm doing wrong. I'm using jamovi 1.0.4.0

Cheers,

Wake
Attachments
ifmiss.jpg
ifmiss.jpg (116.78 KiB) Viewed 5471 times
User avatar
jonathon
Posts: 2620
Joined: Fri Jan 27, 2017 10:04 am

Re: Am I missing something with IFMISS?

Post by jonathon »

ah yes, you're right (the issue is actually to do with the V functions in transformed variables - VMEAN($source) is (incorrectly) returning a missing value. it works with computed variables.

working on a fix.

cheers and thanks for reporting.

jonathon
User avatar
jonathon
Posts: 2620
Joined: Fri Jan 27, 2017 10:04 am

Re: Am I missing something with IFMISS?

Post by jonathon »

hmm, this is actually a tricky one ...

in most cases, the current behaviour is the correct one. if you're transforming a variable, and the source is a missing value, you typically want the result to be a missing value.

if one considers a series of recode conditions, for example, you don't want a missing value to be recoded to the 'else' value - you want it to come through as a missing value.

however, this seems to be an exception to that rule ... i'll have to think about the best way to handle it.

jonathon
Wake
Posts: 43
Joined: Tue Jun 26, 2018 8:31 am

Re: Am I missing something with IFMISS?

Post by Wake »

The problem seems to primarily be with IFMISS, rather than VMEAN.

IFMISS appears to work when using "Compute" but not when using "Transform".

Apart from instances like this where transform doesn't appear to work I feel that the compute function is redundant and could be removed altogether. Transformations can be calculations as well as arbitrary recodes.

Cheers,

Wake
User avatar
jonathon
Posts: 2620
Joined: Fri Jan 27, 2017 10:04 am

Re: Am I missing something with IFMISS?

Post by jonathon »

still thinking about this, but, this is actually the way you're *supposed* to recoding missing values:
Screen Shot 2019-07-30 at 07.58.48.png
Screen Shot 2019-07-30 at 07.58.48.png (171.76 KiB) Viewed 5441 times
cheers

jonathon
User avatar
jonathon
Posts: 2620
Joined: Fri Jan 27, 2017 10:04 am

Re: Am I missing something with IFMISS?

Post by jonathon »

after thinking about this for a while, i think the current behaviour is probably the best one.

i could change it so it will transform missing values, but it ends up breaking a lot of other use-cases. i think the solution here is to use `if $source == NA`.

i notice, we do actually recommend this in our docs: https://blog.jamovi.org/2018/10/23/tran ... ables.html

it might be worth us adding a note about why this IFMISS strategy doesn't work.

thanks for bringing this up though.

jonathon
Wake
Posts: 43
Joined: Tue Jun 26, 2018 8:31 am

Re: Am I missing something with IFMISS?

Post by Wake »

I'm very happy to use if $source == NA instead of IFMISS. It just didn't occur to me to try it.

If IFMISS doesn't work in transform then it would be great if it either didn't appear in the list of available transformations or if it could enter if $source == NA into the function window when selected.

Best wishes,

Wakefield
User avatar
jonathon
Posts: 2620
Joined: Fri Jan 27, 2017 10:04 am

Re: Am I missing something with IFMISS?

Post by jonathon »

so it *does* work in the transforms, it's just that when the $source value is NA, the result is always NA unless there's an explicit if $source == NA condition. so one could still use IFMISS in transforms, say like this:

if $source > VMEAN(IFMISS($source, 1.0, $source)) use ...

so it can still be useful in transforms

jonathon
Post Reply