Suppose there are two groups of (x, y) pairs, and that x and y are linearly correlated but with different slopes and/or intercepts for different groups.
We do not know which data point belongs to which group a priori, but we know that there are two groups.
I am looking for a method to fit simultaneously two linear models, such that the groups are automatically detected and models fitted. For a given x value, there will be two y-values predicted for both groups, I cannot implement with a GLM, as putting side-by-side the two design matrices, I would get collinear columns, which would break the fitting process. Appreciate any hints.
flexmixR package for mixture models – Ben May 16 '22 at 14:45