JenniNiku / gllvm

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

gllvm fails when both TR and control.start are supplied #77

Closed hrlai closed 1 year ago

hrlai commented 1 year ago

Hi devs, here's another potential bug that can happen when both arguments TR and control.start are supplied to binomial gllvm version 1.3.3:

library(gllvm)

## Load a dataset from the mvabund package
library(mvabund)
data(antTraits)
y <- as.matrix(antTraits$abund)
X <- as.matrix(antTraits$env)
TR <- antTraits$traits

y2 <- matrix(as.integer(y > 0), nrow(y), ncol(y))

# Use 5 initial runs and pick the best one
fitvX_5 <- gllvm(
    y2,
    X = X,
    TR = TR,
    family = "binomial",
    control.start = list(n.init = 2)
)

This returns:

Error in binomial(link = link) : 
  link "link" not available for binomial family; available links are ‘logit’, ‘probit’, ‘cloglog’, ‘cauchit’, ‘log’

If you remove either TR or control.start, it works...

JenniNiku commented 1 year ago

Thanks for noting, I will fix this.

JenniNiku commented 1 year ago

This have been fixed now, in commit abcdd726c6ffbc51684aecb65bde87ca0dbd6341