JenniNiku / gllvm

Generalized Linear Latent Variable Models
https://jenniniku.github.io/gllvm/
48 stars 20 forks source link

Bugfixes, nlm optimizer, and allFit #45

Closed BertvanderVeen closed 3 years ago

BertvanderVeen commented 3 years ago
BertvanderVeen commented 3 years ago

I've added an optimizer to the R-package "nlm" from base R, and written a simple function that re-fits a GLLVM model object with all three optimizers and starting values "zero", "random", "res", "res" and "n.init = 3", so that users can more simply find the best fitting model.

Lme4 has something similar for glmer() objects, which I know from experience to be very useful.

BertvanderVeen commented 3 years ago

Though I haven't extensively tested this, nlm seems more robust to poor starting values than optim in some cases (specifically, I have observed one case where optim couldn't start from the initial values at all with Bernoulli responses, whereas nlm could, but also the other way around). Additionally, for the same set of starting values, nlm occasionally provides a (slightly) better fit than both optim and nlminb.

I have now added the Niku et al. 2019 reference to the allFit documentation, as the function essentially implements the four recommended sets of starting values (though without jitter for "res").

JenniNiku commented 3 years ago

Hi, I'm going to do this week a CRAN update for the package but I probably don't have enough time to review and test the new feature "allfit" yet. So is it possible to separate the bug fixes to their own pull request so I can include them to the CRAN update?

JenniNiku commented 3 years ago

I tried to find if I can just merge the bug fixes but didn't find such button here.

BertvanderVeen commented 3 years ago

No problem, I'll have a look later.

BertvanderVeen commented 3 years ago

Closing this, see PR #46 instead.