Skip to content

Conversation

Copy link

Copilot AI commented Sep 10, 2025

This PR adds optimizer control settings to the classical Linear Mixed Models (LMM) and Generalized Linear Mixed Models (GLMM) modules, allowing users to adjust optimizer parameters when models fail to converge.

Changes Made

UI Enhancements

  • Added "Advanced" section with optimizer settings as a separate QML component
  • Optimizer-specific controls that appear based on selected optimizer method:
    • Nelder-Mead: maxfun, FtolAbs, FtolRel, XtolRel
    • bobyqa: npt, rhobeg, rhoend, maxfun
    • nlminb: tol, relTol, maxit
    • Default/BFGS: Maximum iterations, Convergence tolerance
    • Check convergence: Toggle for convergence warnings/errors (available for all optimizers)

Code Organization

  • Created a reusable Advanced.qml component in the common folder containing optimizer settings
  • This component is added to the bottom of both LMM and GLMM QML files for better modularity
  • Removed optimizer settings from the main Options section to improve code separation

Backend Implementation

  • Updated .mmCreateOptimizerControl() function to handle optimizer-specific parameters according to each optimizer's documentation
  • Updated all fitting functions to use optimizer controls:
    • .mixedInterceptML() for intercept-only models
    • afex::mixed() calls for full models
  • Controls are passed through to underlying lmer/glmer functions via optCtrl parameter

Error Message Improvements

  • Updated convergence failure message to direct users to optimizer settings instead of stating they're not supported
  • Changed from: "(JASP currently does not support modifying the optimizer settings.)"
  • To: "Try adjusting the optimizer settings in the Advanced Options section."

Testing

  • Added unit tests for both LMM and GLMM with custom optimizer settings
  • Tests validate that new options are processed without errors

Scope

This enhancement is only available for classical models (LMM and GLMM). Bayesian models continue to use their existing MCMC control settings and are unaffected by these changes.

Motivation

Complex mixed models often encounter convergence issues that can be resolved by adjusting optimizer settings. This was previously impossible in JASP, forcing users to abandon analyses or switch to other tools. These new controls provide the flexibility needed to handle challenging models while maintaining JASP's user-friendly interface.

Fixes #252.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits September 10, 2025 11:46
Co-authored-by: FBartos <38475991+FBartos@users.noreply.github.com>
Co-authored-by: FBartos <38475991+FBartos@users.noreply.github.com>
Copilot AI changed the title [WIP] Allow optimizer control settings for classical LMM and GLMM Add optimizer control settings for classical LMM and GLMM Sep 10, 2025
Copilot finished work on behalf of FBartos September 10, 2025 11:53
Copilot AI requested a review from FBartos September 10, 2025 11:53
Copy link
Collaborator

@FBartos FBartos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot put the QML interface into a new common separate qml section called Advanced thats added the bottom of the LMM and GLMM's qml

Co-authored-by: FBartos <38475991+FBartos@users.noreply.github.com>
Copy link
Author

Copilot AI commented Sep 10, 2025

@copilot put the QML interface into a new common separate qml section called Advanced thats added the bottom of the LMM and GLMM's qml

Done! I've extracted the optimizer settings into a new common QML component called Advanced.qml in the common folder. This component is now added to the bottom of both LMM and GLMM QML files instead of being part of the Options section. The changes are committed in 7256221.

Copilot AI requested a review from FBartos September 10, 2025 12:04
Copilot finished work on behalf of FBartos September 10, 2025 12:04
Co-authored-by: FBartos <38475991+FBartos@users.noreply.github.com>
Copilot AI requested a review from FBartos September 10, 2025 13:55
Copilot finished work on behalf of FBartos September 10, 2025 13:55
@FBartos
Copy link
Collaborator

FBartos commented Oct 30, 2025

so, this turned to be much more complicated than expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow optimizer control settings for classical LMM and GLMM

2 participants