Fix as.function not working for GLMMs#23
Conversation
|
@copilot can you try again..? |
Add GLMM-specific variables (baseOffset, lp0, compDev, tolPwrss,
pwrssUpdate, GQmat, fac, verbose, dpars) to rho when the model is
a GLMM, following the pattern from the getME("devfun") section.
Also fix lower/upper bounds to include beta bounds for GLMMs with nAGQ > 0.
Add tests in test-glmer.R to verify the fix.
Co-authored-by: annahuynhly <97189987+annahuynhly@users.noreply.github.com>
Fixed in commit 7b170ff. The |
|
@copilot with your new additions, we have that the following code doesn't work either: Could you please fix this? |
Co-authored-by: annahuynhly <97189987+annahuynhly@users.noreply.github.com> Agent-Logs-Url: https://github.com/annahuynhly/lme4/sessions/b9f4b4e9-5797-47b7-b2bd-c7c276f1a7cf
... Fixed in commit 1a0552a. |
|
@copilot , we still have the same issue: |
Co-authored-by: annahuynhly <97189987+annahuynhly@users.noreply.github.com> Agent-Logs-Url: https://github.com/annahuynhly/lme4/sessions/8d789360-2fb1-4b60-b45e-f5e0286288fd
... Fixed in commit 53bbb4c. I added |
Fixes
as.function.merModso that it works correctly for GLMMs (glmerModobjects), not just LMMs.Problem
as.function(glmerMod)was always setting uprhowith only LMM-specific variables, causing a runtime error whenmkdevfuntried to access GLMM-specific variables likebaseOffset:Changes Made
R/lmer.R— Updatedas.function.merModto:isGLMM(x)and conditionally populaterhowith the required GLMM-specific variables:tolPwrss,compDev,nAGQ,lp0,baseOffset,pwrssUpdate,GQmat,fac,verbose, anddpars. This mirrors the pattern used ingetME("devfun").nAGQ > 0, following the same pattern asupdateGlmerDevfun.tests/testthat/test-glmer.R— Added tests verifying that:as.function(glmerMod)returns a callable function without error for bothnAGQ = 1andnAGQ = 0.update(., devFunOnly = TRUE).Testing
After the fix,
as.functionworks correctly for GLMMs:Original prompt
💡 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.