Page 1 of 1

VariableSupplier: restrict content variables

Posted: Tue Feb 25, 2025 9:34 am
by JavierMG
Hi,

I'm trying to create a preprocessing step where only covariate (continuous) variables are normalized, however Variable supplier passes all variables not just the specified covariates. Is it possible to restrict the content to just a subset of all the variables? Thank you in advance!

This is my analysis file:

Code: Select all

 
    - name: stdCovs
      title: Standard Scaling
      type: Array
      items: (covs)
      default: [[]]
      template: 
        type: Variables
        name: var
This is my ui file:

Code: Select all

  - type: CollapseBox
    collapsed: true
    label: Preprocessing
    style: list
    stretchFactor: 1
    children:
      - type: VariableSupplier
        persistentItems: false
        stretchFactor: 1
        children:
          - type: TargetLayoutBox
            label: Standard Scaling
            children:
              - type: ListBox
                name: stdCovs
                label: Standard Scaling
                showColumnHeaders: false
                stretchFactor: 1
                fullRowSelect: true
                columns:
                  - name: var
                    stretchFactor: 1
                    template:
                      type: VariablesListBox
                      isTarget: true

Re: VariableSupplier: restrict content variables

Posted: Tue Feb 25, 2025 11:57 pm
by jonathon
hi,

so take a look at the linear regression from jmv, you'll see we have separate boxes for covariates and factors. that's the recommended way of handling this. we discourage analyses which infer how variables should be treated based on their types. as per our docs:
Avoid inferring how the user wants to treat the variable based on its type, i.e. avoid an ‘independent variables’ option, where if the user assigns a nominal variable, it is treated as a factor, and if the user assigns a continuous variable, it is treated as a covariate – this is implied behaviour, and users make mistakes.
https://dev.jamovi.org/tuts0202-handling-data.html
Screenshot 2025-02-26 at 10.53.21.png
Screenshot 2025-02-26 at 10.53.21.png (36.07 KiB) Viewed 121392 times

Re: VariableSupplier: restrict content variables

Posted: Wed Feb 26, 2025 9:31 am
by JavierMG
Hi Jonathon,

Thank you very much for your quick reply!

I think I might not have expressed myself correctly. What I want is another Variable Supplier under a collapse box where only the Covariates appear (they don't necessarily have to be numerical, although they should really). eg. if the user specifies B as a Covariate, then the new box under the collapse box should only have the variable B as an option, right now I have all A, B, and C irrespectively if they are specified as Dependent Variable, Covariates or Factors (again, doesn't matter if they are continous or categorical although it shouldn't). Can this be implemented or should I avoid such an approach?

Thank you in advance!

Re: VariableSupplier: restrict content variables

Posted: Wed Feb 26, 2025 11:20 pm
by jonathon
ah ok ... sorry, i inferred (incorrectly) what i thought you were trying to do.

you're after something like the following from GAMLj3 (i.e. where the user specifies factors and covariates, and only factors appear in the 'Components' supplier further down? [although in your case, you want to do the opposite, with only the covariates appearing])

jonathon


Screenshot 2025-02-27 at 10.17.15.png
Screenshot 2025-02-27 at 10.17.15.png (74.44 KiB) Viewed 119858 times

Re: VariableSupplier: restrict content variables

Posted: Thu Feb 27, 2025 9:14 am
by JavierMG
Hi Jonathon,

Don't worry, my bad. Yes this is exactly what I want! How could it be achieved? Sorry if its trivial, I'm new to this. Thank you.

Javier

Re: VariableSupplier: restrict content variables

Posted: Thu Feb 27, 2025 9:32 am
by jonathon
i don't actually know myself ... but i'll ask damo and/or marcello to chip in. expect to hear from them soon.

cheers

jonathon

Re: VariableSupplier: restrict content variables

Posted: Sat Mar 01, 2025 10:52 pm
by dropmann
Hi Javier,

To implement this you'll need to do more than just the y.yaml. This link will give you some insights https://dev.jamovi.org/ui-advanced-customisation.html. In jamovi an example is in the ANOVA. Here is a link to the js file for the ANOVA where the model supplier is populated https://github.com/jamovi/jmv/blob/0a41 ... ova.js#L24. Let me know if you need any more assistance.

kind regards,
Damian

Re: VariableSupplier: restrict content variables

Posted: Mon Mar 03, 2025 11:09 am
by JavierMG
Hi,

Thank you very much Damian, I will have a look!

cheers,

Javier

Re: VariableSupplier: restrict content variables

Posted: Fri Jul 04, 2025 11:26 am
by JavierMG
Hi Damian,

I've tried adding a {supplier}_{update} method similar to the example on the example on https://github.com/jamovi/jmv/blob/0a41 ... ova.js#L24 , but my js export section gets deleted when I install the module. Also my regression.src.js file explicitly states it should not be edited. I'm guessing my approach of just adding an update function to module.exports is not enough but I'm not exactly sure on how to proceed, any help would be much appreciated. Thank you in advanced.

cheers,

Javier

Re: VariableSupplier: restrict content variables

Posted: Tue Jul 08, 2025 1:26 am
by jonathon
is your compilerMode set to 'tame'?

https://dev.jamovi.org/ui-basic-design.html

jonathon