Closed knokknok closed 1 year ago
@knokknok I've implemented gridsearch initialization, including parallel computation support. See the lcmethodLcmmGMM
documentation for details.
Example specification:
method <- lcMethodLcmmGMM(
fixed = Y ~ Time,
mixture = ~ Time,
random = ~ 1,
id = "Id",
time = "Time",
nClusters = 3,
init = "gridsearch",
gridsearch.maxiter = 10,
gridsearch.rep = 50,
gridsearch.parallel = TRUE
)
Let me know if you run into any issues.
Thanks! Out of curiosity, why did you reimplement the grid search functionality instead of calling lcmm's?
Mainly because I already had a custom implementation that I created 4 years ago for a simulation study (see here), which was the basis for creating this package.
I (probably) had a good reason for it at the time but which I don't quite remember haha. Most likely an issue with the hlme
call evaluation outside of the global environment, or the annoyance of (re)constructing that call dynamically.
Anyways, using the same parallel back-end as the rest of the latrend package is a nice bonus :)
Sorry to reopen but I get an error when the number of clusters includes 1 in lcMethods
(I think it is the trigger):
Error in { :
task 1 failed - "hasName(x = envir, name = "lme") is not TRUE"
Thanks, I've added this as a test case. Gridsearch init is now ignored for nClusters = 1
so it's easier to estimate lcmm for 1:N clusters.
Unfortunately I submitted the 1.5.1 CRAN release a couple of hours ago so this fix will not be pushed to CRAN until 2 weeks later at minimum.
Since there was a problem with the CRAN submission this fix will be on the 1.5.1 CRAN release.
Thanks for the suggestion. I will implement this in the coming weeks
Note that for repeated fitting with automatic selection of the best result you can already use the lcFitRepMin method modifier. Still, the gridsearch approach will be faster since it does an initial quick exploration for different random starts.