Closed Gootjes closed 1 year ago
Maybe also a comment more in general: what is nclasses is a range (2:6
), how should the splits
argument be dealt with? Should it be a matrix with the same width as length(nclasses)?
Dear @Gootjes , thank you for pointing this out! I solved it in a slightly different way, by moving the isfac line outside of the conditional, as it's used regardless of whether the user provides splits or not. That's why I closed the PR!
Maybe also a comment more in general: what is nclasses is a range (2:6), how should the splits argument be dealt with? Should it be a matrix with the same width as length(nclasses)?
By design, mixture_starts()
accepts only one model, not a list of models. Only the wrapper functions deal with mixture models in batch. Mixture_starts is an internal function that is exposed so users can troubleshoot/override defaults.
I don't love the idea of making matrices of splits; if a user is comfortable binding things into matrices, they're probably also comfortable using lapply()
across their model list instead. But for users who are not comfortable with such operations, I think it would be confusing if the function accepts different objects: vectors and matrices.
A sidenote, per the documentation of mixture_starts, it is possible to create a model and in step 2 set the start values. However, the initial model creation via mx_mixture also tries to set the start values. If this fails, because of missing data or other reasons, there seems to be no way of setting the starting values manually with the splits argument to mx_mixture.
Can you give an example of where setting starting values fails? It should work with missing data. Have you tried setting run = FALSE
?
A line of code was missing in the function
mixture_starts
which leads to:Error in FUN(X[[i]], ...) : object 'isfac' not found
The error occurs when using the splits argument in a call to
mx_mixture
ormx_growth_mixture
.The line of code that needs to be added can look like:
The line can also be inserted at line 540 (outside the loop) since data columns are constant.
A sidenote, per the documentation of
mixture_starts
, it is possible to create a model and in step 2 set the start values. However, the initial model creation viamx_mixture
also tries to set the start values. If this fails, because of missing data or other reasons, there seems to be no way of setting the starting values manually with thesplits
argument tomx_mixture
.