Skip to content

[Bug]: Filter function does not affect the results in the computed columns #2945

@Alejandro-84

Description

@Alejandro-84

JASP Version

0.19.0

Commit ID

No response

JASP Module

Other

What analysis are you seeing the problem on?

Computed variables

What OS are you seeing the problem on?

Windows 11

Bug Description

I have a variable with 20 scores (adult years of age), and one of them is a data entry error (200). If I calculate the mean using the Descriptive statistics module, I get a mean of 72.5

image

If I use the label editor to filter that case out, I get the right statistics (e.g., mean = 65.8)
image

image

However, when I calculated the standardized scores (z-scores) using the zScores function in JASP, I realized it still considers the filtered case for the calculation.

image

image

Which led to incorrect z-scores.

I tried with another function, in this case the mean function and it returned a mean of 72.55, including the 20 cases, even though the filter is still active.

image

And the max function returns the 200 scores (even though it was filtered out)

image

However, if I add this number (200) to the missing values list, it is not a problem anymore. The z-score was not calculated for this score.

image

And the mean function returns the mean that excludes that case (i.e., 65.8):

image

And the max function returns 80

image

So, I wonder if this issue also happens with all the other functions.

This is the dataset I used.
age.zip

Expected Behaviour

The filter function should exclude the filtered cases from the calculations, just as it excludes them from the other JASP modules.

Steps to Reproduce

  1. Create a new column (variable), and calculate the z-scores from the original variable using the z-Scores function (this also applies to the mean and max functions).
  2. Filter out the data entry error using the label editor. The z-scores will not change (the data entry error is not excluded).
  3. Add the data entry error to the missing values list. The z-scores will change (the data entry error is excluded)
  4. Open the descriptive statistics module; the results from either the label editor (filter) or the missing values list will be the same (both filter the data entry error).
    ...

Log (if any)

No response

More Debug Information

-------- Application Info --------
JASP Version: JASP 0.19.1
Build Branch: lockfiletesting
Build Date: Sep 9 2024 19:00:04 (Netherlands)
Last Commit: 8ac10c9c7aec029fdd695262d7bb4c3742a8ec89

-------- Basic Info --------
Operating System: Windows 11 Version 23H2
Product Version: 11
Kernel Type: winnt
Kernel Version: 10.0.22631
Architecture: x86_64
Install Path: C:/Program Files (x86)/JASP
Platfotm Name: windows
System Local: en_CA

-------- Extra Info --------
Current code page
Active code page: 437
Active code page: 65001

Final Checklist

  • I have included a screenshot showcasing the issue, if possible.
  • I have included a JASP file (zipped) or data file that causes the crash/bug, if applicable.
  • I have accurately described the bug, and steps to reproduce it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions