The variable name z_class is used for LatenClass.
In basic mode (data.frame, no model given, so MixtComp infers the model according to the data type), when a variable named z_class is given with the wrong type (numeric instead of integer), it is processed as a gaussian variable and the real z_class variable (partition) can not be accessed in the output and it generates bugs in other functions
library(RMixtComp)
X <- data.frame(x = rnorm(100), y = c(rnorm(50), rnorm(50, 2)), z_class = rep(c(1., NA, 2., NA), each = 25))
sapply(X, class)
res <- mixtCompLearn(X, nClass = 2)
res$variable$type$z_class
# [1] "Gaussian" # instead of "LatentClass"
# res$variable$param$z_class has gaussian parameter
plot(res)
# error
Idea:
When inferring type, refuse to use a variable named z_class if it is not an integer and send a warning to the user
The variable name
z_class
is used for LatenClass. In basic mode (data.frame, no model given, so MixtComp infers the model according to the data type), when a variable namedz_class
is given with the wrong type (numeric instead of integer), it is processed as a gaussian variable and the realz_class
variable (partition) can not be accessed in the output and it generates bugs in other functionsIdea:
When inferring type, refuse to use a variable named z_class if it is not an integer and send a warning to the user