Mixed Models Module

Everything related to the development of modules in jamovi
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Mixed Models Module

Post by jonathon »

OK, i can open the .omv, see the results, etc. but as soon as i make a change, the analysis goes blank. similarly, if i try and start an analysis from scratch, it seems to never run, and just remains blank.

i assume i'm missing something?

(the other issue is that it's 23:00 here, and i should probably go to bed, so i probably won't get back to you about this till tomorrow).

with thanks
User avatar
mcfanda@gmail.com
Posts: 457
Joined: Thu Mar 23, 2017 9:24 pm

Re: Mixed Models Module

Post by mcfanda@gmail.com »

sure (this is for later then)
I know what you see, but as soon as i put completeWhenFilled: false in the .a.yaml file everything works
User avatar
mcfanda@gmail.com
Posts: 457
Joined: Thu Mar 23, 2017 9:24 pm

Re: Mixed Models Module

Post by mcfanda@gmail.com »

HI Jonathon,
I have now a reasonably working version of both the GLM and the Mixed model of the GAMLj suite ( :-) ). Both follow the guidelilnes you gave by email. There are still some issues but they do a lot of things quite well. Here are the links:

https://github.com/mcfanda/gamlj_glm

https://github.com/mcfanda/gamlj_mixed

please let me know
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Mixed Models Module

Post by jonathon »

hey marcello,

sorry, i've been a bit busy the last couple of days. i'll try and take a look at this on the weekend.

cheers

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

Re: Mixed Models Module

Post by jonathon »

hey marcello, this is looking pretty good!

1. were you going to combine these into a single module?

GLM

2. stats::summary()

glm errors because you use stats::summary(), which i think you've fixed, but just haven't committed yet.

3. factors coding default

what's the difference between `deviation` and `default` in `Factors Coding`?

4. error with mismatching variable types

if i drop a continuous variable into `Fixed Factors` a cryptic error is thrown. two things you can do:

a) prevent the assigning of continuous variables with the `permitted` property (you're already using `suggested`)

b) check that the factors actually *are* factors, and generate an informative error message if not.

5. contrast labels

Code: Select all

#
#  Estimates                                         
#  ───────────────────────────────────────────────────
#                     Contrast                       
#  ───────────────────────────────────────────────────
#    (Intercept)      Intercept                      
#    dose1            1000 - 500, 1000, 2000         
#    dose2            2000 - 500, 1000, 2000         
#    supp1            VC - OJ                        
#    dose1 ✻ supp1    1000 - 500, 1000, 2000 ✻ VC - OJ
#    dose2 ✻ supp1    2000 - 500, 1000, 2000 ✻ VC - OJ
#  ───────────────────────────────────────────────────
#
#

you've used the R-style notation (dose1 * supp1), which might be good -- i personally think it's completely uninformative (:P), but it might still be good to include it for people who are wanting to compare results from R, or who are learning R. i like the `1000 - 500, 1000, 2000 ✻ VC - OJ` notation because it's clearer what's going on -- but i am wondering if i can be made clearer again -- maybe through the use of brackets? is `1000 - (500, 1000, 2000) ✻ VC - OJ` clearer? or just cluttered? ravi, what do you think?

i'd be inclined to conceal the 'r-style' contrast labels by default, and turn them on with an option. i'd also populate the 'nice' contrast labels in the init phase (prevent the grow-shrink-grow thing that happens to the table).

6. aliased coefficients in the model
glm aliased coefficients error.omv
(6.45 KiB) Downloaded 411 times
i appreciate this error message is technically correct, but doesn't really give the (non-technical) user an idea what the issue is. be good if it could be caught, and translated to something more human-friendly ... of course, exactly how you explain 'aliased co-efficients' to a lay-person i have no idea :P ... did you have any thoughts ravi?

7. simple effects errors
glm simple effects error.omv
(9.58 KiB) Downloaded 416 times
glm simple effects error 2.omv
(8.77 KiB) Downloaded 424 times
Mixed module
mixed not doing anything.omv
(3.95 KiB) Downloaded 436 times
i couldn't actually get this to work. i might be missing something, but have you committed everything? above is an example of blank results where i would have expected them to be ... not blank :)

hope this helps!

jonathon
User avatar
mcfanda@gmail.com
Posts: 457
Joined: Thu Mar 23, 2017 9:24 pm

Re: Mixed Models Module

Post by mcfanda@gmail.com »

Thanks a lot for the help throughout this nice project.

1. I'm not sure. I'm not very fond of big packages in general (think about R "car" that you need to install half CRAN just to do an anova), but I rather like when people can cherry-pick the functions that they need. I also see your point, so, maybe we can offer them as separated modules and as a big module, so users can choose if they need only one of them or the whole package. At the end, the full gamlj should contain four modules.

I's need some assistance to make one module out of many modules, because I do not know how to proceed.

2. fixed, it was in the develop branch

3. At the moment no difference, but here is the rationale: The module needs factors to be defined at init() phase. If the factors has no levels, it gets the deviation contrasts which is the standard for the Type III SS based tests. However, if the users defines a custom contrasts in the data tab (I guess in future release of jamovi this will be possible), the module will use the levels it finds already in the contrast. This will give users more freedom, I guess.

4. fixed using your option a. BTW how do you allow nominal text variables? At the moment I have "permit: nominal and ordinal", but in one of your examples I found "nominal text variables" that did not pass the permit restriction.

5. I like the parenthesis suggestion, I fixed that. A for the dummies name I think that users coming from R will like them, and I also like that people get use to the fact that contrasts are actually variables that decompose the categorical variables. The display of both the dummies names and the contrast definitions is a good way , IMHP, to help people learning the basics of linear models. Furthermore, dummies names make a reference to the adjacent labels, saying which variable gropus the labels refer to. They also are a reference for the simple effects tables and other tables (in mixed and future modules) in which contrasts definitions will be awkward to show.
Finally, I fixed the init(). (this init() thing is a bit a pain in arse, but I agree the rendering is much better.

6. fixed by allowing the results (same strategy of the ANCOVA module) but put forward a warning in which aliasing is (very briefly) explained. I did the same for the mixed module where things a bit weired when it comes to aliases, but it should work in the majority of the aliased designs.

7.1 7.2 They now work (there were small bugs that were fixed along development). Btw, I notice that to make the examples work I should re-install the module after the .omw file is opened. Is that by design?

7.3 The model in your example would have worked, but the set-up was incomplete. As in SPSS mixed, one has to specify the clustering variable(s) by assigning it to "clusters". I guess in your example the clustering variable was region. When one does that, one has to specify the random effect (at least one) in the "Random Effects" tab.

here is your example working
mixed doing something.omv
(19.51 KiB) Downloaded 406 times
However, Mixed still needs a bit of work in the UI, defining the random components (the random effect panel). It works now, but it does not update in an intuitive way when the user put factors or covariate in and out the variable definition. For the rest, I updated the code following your suggestions on the GLM.

Thanks again, I'm loving this :-)
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Mixed Models Module

Post by jonathon »

hey,
I'm not sure. I'm not very fond of big packages in general (think about R "car" that you need to install half CRAN just to do an anova), but I rather like when people can cherry-pick the functions that they need.
yup, i hear you. we added semPlot to jamovi (only) for the path diagram for CFA, and it added 200meg to our install size!

the other side of it is that a glm and a mixed module will have common dependencies, which will now need to be downloaded twice (once for each module). it's also pretty standard for R packages to provide several functions/analyses in them, but whatever you think is best.

to some extent it comes down to the way you think your users will work. if lots of people will use both modules, then i'd bundle them together, if A will be used by these people, and B will be used by these others, and there's not a lot of overlap, then separating them makes sense.
However, if the users defines a custom contrasts in the data tab (I guess in future release of jamovi this will be possible), the module will use the levels it finds already in the contrast. This will give users more freedom, I guess.
ah yup. so in R, you attach your constrasts *to* the data before running the analysis, and you're imagining that we'll do something similar and 'default' will be use these attached contrasts. i don't know, but i don't expect we'll do it this way. we'll probably have the user specify the contrasts in the analysis UI itself. what contrasts you want, has always seemed to me a property of the analysis, so i was always puzzled by the R way of doing it.

either way, you could ditch 'default' until we actually implement it :)
how do you allow nominal text variables?
i think 'permitted: nominal' implies 'permitted: nominaltext'. this is because there will never be a scenario when you *would* allow nominal but not nominal text. i'll check with damo, and come back to you if i'm wrong.
5. I like the parenthesis suggestion, I fixed that. A for the dummies name I think that users coming from R will like them, and I also like that people get use to the fact that contrasts are actually variables that decompose the categorical variables. The display of both the dummies names and the contrast definitions is a good way , IMHP, to help people learning the basics of linear models. Furthermore, dummies names make a reference to the adjacent labels, saying which variable gropus the labels refer to. They also are a reference for the simple effects tables and other tables (in mixed and future modules) in which contrasts definitions will be awkward to show.
Finally, I fixed the init(). (this init() thing is a bit a pain in arse, but I agree the rendering is much better.
yup! yeah, you are exactly right about init() at times being a pain in the arse, but it is really nice when you get it just right :)
Btw, I notice that to make the examples work I should re-install the module after the .omw file is opened. Is that by design?
can you describe this a bit more, i don't follow.
The model in your example would have worked, but the set-up was incomplete. As in SPSS mixed, one has to specify the clustering variable(s) by assigning it to "clusters". I guess in your example the clustering variable was region. When one does that, one has to specify the random effect (at least one) in the "Random Effects" tab.
ah, OK. yeah, this is a tricky one. generally we put all the 'required' options at the top level, and the 'optional' options down in expanders -- but this may be impractical given the amount of options mixed requires. you might consider throwing an error message "please specify X in section Y" ... (maybe we should invent a different sort of message which isn't an error). i think the user needs some sort of feedback as to why they're not getting any results.
Thanks again, I'm loving this :-)
its exciting to have jamovi coming together, and exciting to have people like you jumping in!

cheers

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

Re: Mixed Models Module

Post by jonathon »

ok, for 'permitting' nominal text variables, you probably want

permitted:
- ordinal
- nominal
- nominaltext
User avatar
mcfanda@gmail.com
Posts: 457
Joined: Thu Mar 23, 2017 9:24 pm

Re: Mixed Models Module

Post by mcfanda@gmail.com »

OK, revision done, including one bundle for the two modules. Here it is

https://github.com/mcfanda/gamlj

nice week end to all :-)
snfraser
Posts: 7
Joined: Thu May 25, 2017 7:48 pm

Re: Mixed Models Module

Post by snfraser »

This looks fantastic. I can't wait to try it!
Post Reply