# NOT RUN {
### Example 1
# Data
data(acidity)
x <- acidity
# Fitting the model under default specifications
out <- MixNRMI2cens(x,x)
# Plotting density estimate + 95<!-- % credible interval -->
attach(out)
m <- ncol(qx)
ymax <- max(qx[,m])
par(mfrow=c(1,1))
hist(x,probability=TRUE,breaks=20,col=grey(.9),ylim=c(0,ymax))
lines(xx,qx[,1],lwd=2)
lines(xx,qx[,2],lty=3,col=4)
lines(xx,qx[,m],lty=3,col=4)
detach()
# }
# NOT RUN {
# }
# NOT RUN {
### Example 2
# Data
data(salinity)
# Fitting the model under special specifications
out <- MixNRMI2cens(xleft=salinity$left,xright=salinity$right,Nit=5000,distr.pz0=10,
mu.pz0=1,sigma.pz0=2)
# Plotting density estimate + 95<!-- % credible interval -->
attach(out)
m <- ncol(qx)
ymax <- max(qx[,m])
par(mfrow=c(1,1))
plot(xx,qx$"q0.5",lwd=2,type="l",ylab="Density",xlab="Data")
lines(xx,qx[,2],lty=3,col=4)
lines(xx,qx[,m],lty=3,col=4)
# Plotting number of clusters
par(mfrow=c(2,1))
plot(R,type="l",main="Trace of R")
hist(R,breaks=min(R-0.5):max(R+0.5),probability=TRUE)
detach()
# }
Run the code above in your browser using DataLab