# Example: clustering data generated from a Gaussian
# mixture model of three components
x <- c(rnorm(50, mean=-1, sd=0.3),
rnorm(50, mean=1, sd=0.3),
rnorm(50, mean=3, sd=0.3))
res <- Ckmeans.1d.dp(x)
plot(res)
y <- (rnorm(length(x)))^2
res <- Ckmeans.1d.dp(x, y=y)
plot(res)
res <- Ckmedian.1d.dp(x)
plot(res)
Run the code above in your browser using DataLab