jasp-issues icon indicating copy to clipboard operation
jasp-issues copied to clipboard

[Feature Request]: Add the option of correlating variables conditional on other variables

Open evelynverona opened this issue 1 year ago • 2 comments

Description

It would be very good to have the option of correlating variables conditional on other variables. For example: to find the correlation of variable A and variable B according to sex.

Purpose

To have a more detaled way of correlate variables

Use-case

No response

Is your feature request related to a problem?

It would be very good to have the option of correlating variables conditional on other variables. For example: to find the correlation of variable A and variable B according to sex.

Is your feature request related to a JASP module?

Regression

Describe the solution you would like

As in other statistical software, it allows to divide the sample according to sex, age, socioeconomic level, etc; and after that, correlations can be made. In this way the correlations come out according to sex, age, etc.

Describe alternatives that you have considered

No response

Additional context

I send how the data can be presented in other statistical software. To do this, use the option DATA>SEGMENT FILES and set the variable "e.g.: sex", and option: compare groups. correlations by sex

evelynverona avatar Jun 15 '24 16:06 evelynverona

upcoming version 0.19 will enable this at least via the descriptives module. Graphically you can do this also via the flexplot module.

But I guess you do need the p-values, KIs etc? Then a current workaound would be to filter the data and do the analysis twice, via filtered files, e.g. one file with filtered women and one with filtered men.

Conditioning on metric variables like age is already possible via the "partial out" box in the correlation-module.

But all in all certainly still a valid request.

tomtomme avatar Jun 28 '24 08:06 tomtomme

@evelynverona Was my summary on this issue correct? You do not want to handle this via separate / filtered files and you want the p-values, KIs etc.?

tomtomme avatar Jul 06 '24 11:07 tomtomme

@evelynverona for your information. the upcoming version of jasp will include manual fix for this - now included in the latest 0.20 nightlies. If you want to test: https://static.jasp-stats.org/Nightlies/

Be warnded, those might be unstable.

See this pull request for how this is supposed to work now via manually removing levels of data that is not really there: https://github.com/jasp-stats/jasp-desktop/pull/5789

So you would duplicate your e.g. gender variable and remove one gender in each to do the analysis twice. This removes the hassle of switiching filters on and off and working within two separate data files / jasp instances. Let us know if this works for you. Until then I will close this as a duplicate of https://github.com/jasp-stats/jasp-issues/issues/1330 - which would solve this in a more general way

tomtomme avatar Mar 28 '25 09:03 tomtomme

Hi @evelynverona,

To add to @tomtomme's answer, you can also currently (0.19.3) get conditional descriptive statistics in the Descriptives module (specify a Split variable), where there is the option to ask for an association matrix (either covariances or correlation). This will not have p-values, but only correlations though.

Cheers Johnny

JohnnyDoorn avatar Mar 28 '25 10:03 JohnnyDoorn