# NOT RUN {
fit1 <- mixreg(y~x,data=kilnAfull,ncomp=3,seed=173)
plot(fit1) # Components 1 and 2 seem to have got swapped and
# the component 1 (???) line is a bit skew-wiff.
# There's a point that looks to be a bit of an outlier.
# It has been identified to be point 1171.
with(kilnAfull,text(x[1171],y[1171],labels="1171",
adj=-0.3,col="red"))
# Removing this point gives kilnAoneOut.
fit2 <- mixreg(y~x,data=kilnAoneOut,ncomp=3,seed=173)
plot(fit2) # Still no good; same as fit1, although the "outlier" is gone.
# }
# NOT RUN {
vfit <- visualFit(y~x,data=kilnAoneOut,ncomp=3)
fit3 <- mixreg(y~x,data=kilnAoneOut,ncomp=3,thetaStart=vfit$theta)
plot(fit3) # Much better.
chk <- mixreg(y~x,data=kilnAfull,ncomp=3,thetaStart=vfit$theta)
plot(chk) # No good; same as fit1 and fit2 but without the swapping
# of components 1 and 2. It was the outlier that caused the
# problem, not the random starting values.
# }
# NOT RUN {
thStrt <- list(
list(beta=c(26.07,48808),sigsq=1.1573,lambda=0.33333333),
list(beta=c(23.48,32387),sigsq=1.8730,lambda=0.33333333),
list(beta=c(-0.0597,20760),sigsq=0.2478,lambda=0.33333333)
)
# Roughly vfit$theta.
fit3.a <- mixreg(y~x,data=kilnAoneOut,ncomp=3,thetaStart=thStrt)
plot(fit3.a) # Sames as fit3.
chk.a <- mixreg(y~x,data=kilnAfull,ncomp=3,thetaStart=thStrt)
plot(chk.a) # Same as chk.
# }
Run the code above in your browser using DataLab