jasp-stats / jasp-issues

This repository is solely meant for reporting of bugs, feature requests and other issues in JASP.
59 stars 29 forks source link

Coding of factors in LMM (and some thoughts after trying the visual modeling module (beta) #728

Closed mservantufc closed 1 year ago

mservantufc commented 4 years ago

I just ran a linear mixed effects model (LMM) on some data (amazing job guys). I have a few questions/suggestions: 1- I wonder how categorical variables are treated by JASP in a LMM. For example, consider a response accuracy variable that I would like to use as a fixed factor. I could simply code accuracy levels as 'correct' and 'error'. In this case, does JASP apply a treatment contrast by default (error coded as 0 and correct as 1)? Is it possible to specify a sum contrast instead, or do you I have to recode the variable (-1 for error and 1 for correct)? Now Imagine that I have a color variable with 4 modalities (red, yellow, blue, black) that I want to treat as a fixed factor. Should I directly provide a contrast matrix (pain)? What would JASP do if I simply code the modalities as 'red', 'yellow', 'blue','black'? 2- I am aware of the debates regarding p-values for LMM, but it might be useful to give either Kenward-Roger or Satterthwaite approximation for degrees of freedom, and the corresponding p-value (the afex package does this in R). 3- Looks like there's a bug in the plot of the statistical model. My data is a standard random dot motion task with 6 coherence levels and 18 subjects (attached file). I simply modeled logRT ~coherence *accuracy, and plotted the statistical model with 3 clusters. However, the legend of the plot mentions 3 subjects (2, 9, 11). Weird, because the same plot in the flexplot module looks correct, with 3 clusters of subjects (1-7, 7-13, 13-18). I am running JA template.txt

SP on windows 10.

TarandeepKang commented 4 years ago

I would agree regarding point 2. These methods are also implemented in the LmerTest package. If the the team is against df or p values for LMMs, as there is indeed controversy, perhaps there could be some additional guidance on interpretation of the output without p values, provided in the help documentation? Not necessary for me specifically, but I'm sure this would be useful to students and those who are new to using the method. As a side note, are there any plans to implement Bayesian LMMs in JASP?

EJWagenmakers commented 4 years ago

Yes, GLMM, both frequentist and Bayes, are planned for the upcoming release. The Bayesian version won't have Bayes factors though.

dustinfife commented 4 years ago

Glad you're liking flexplot! Here's my comments to your comments:

  1. It applies treatment contrasts by default. As of right now, there's no option to change this. But, if you're an R user, you can use flexplot to visualize a lme4 model. As long as lme4 accepts sum contrasts, I don't think flexplot will have any problems.

  2. Maybe. I'm hesitant because people tend to over-interpret p-values. On the other hand, it's another level of information. I've considered having a checkbox in the Results Display panel (unchecked by default) that reports p-values. I've also thought that these p-values can be derived from sampling distributions (NHST), bootstrapping, or bayesian posterior distributions. EJ, I know the bayesglm function reports p-values. Any statistical issues you see with reporting these bayesian p-values?

And, to @TarandeepKang, I'm writing a stats textbook based on my approach to teaching data analysis. The entire book will be guidance on how to interpret output without p-values. Maybe I'll link to that in future iterations of Visual Modeling.

  1. When visualizing mixed models, Visual Modeling randomly selects three clusters to visualize. If you want to see all clusters, select the number of clusters under the Plot Controls menu.

Hope that helps!

github-actions[bot] commented 1 year ago

This issue will be automatically closed in 42 days due to inactivity. Feel free to leave a comment if you believe this is still relevant.

github-actions[bot] commented 1 year ago

Automatically closed due to inactivity.