mixreg' provides the MLE estimates of a mixture of regression models with normal errors. The result from this function can be used as initial values of the mixregRM2` function.
mixreg(x, y, C =2, nstart =20, tol =1e-05)
Arguments
x: an n by p data matrix where n is the number of observations and p is the number of explanatory variables. The intercept term will automatically be added to the data.
y: an n-dimensional vector of response variable.
C: number of mixture components. Default is 2.
nstart: number of initializations to try. Default is 20.
tol: stopping criteria (threshold value) for the EM algorithm. Default is 1e-05.
Returns
A list containing the following elements: - pi: C-dimensional vector of estimated mixing proportions.
beta: C by (p + 1) matrix of estimated regression coefficients.
sigma: C-dimensional vector of estimated standard deviations.
lik: final likelihood.
run: total number of iterations after convergence.
Examples
data(tone)y = tone$tuned
x = tone$stretchratio
k =160x[151:k]=0y[151:k]=5est = mixreg(x, y,2, nstart =1)