The components are sorted by the value of one of the parameters or according to an integer vector containing the permutation of the numbers from 1 to the number of components.

1 2 3 |

`object` |
An object of class |

`by` |
If a character vector, it needs to be one of |

`which` |
Name (or unique substring) of a parameter if |

`...` |
Currently not used. |

Friedrich Leisch and Bettina Gruen

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
set.seed(123)
beta <- matrix(1:16, ncol = 4)
beta
df1 <- ExLinear(beta, n = 100, sd = .5)
f1 <- flexmix(y~., data = df1, k = 4)
## There was label switching, parameters are not in the same order
## as in beta:
round(parameters(f1))
betas <- rbind(beta, .5)
betas
## This makes no sense:
summary(abs(as.vector(betas-parameters(f1))))
## We relabel the components by sorting the coefficients of x1:
r1 <- relabel(f1, by = "model", which = "x1")
round(parameters(r1))
## Now we can easily compare the fit with the true parameters:
summary(abs(as.vector(betas-parameters(r1))))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.