## two-dimensional data
n <- 1000
u <- runif(n)
thresh <- 0.4
x1 <- rnorm(n)*(u<thresh) +rnorm(n,mean=3)*(u>=thresh)
x2 <- rnorm(n)*(u<thresh) +rnorm(n,mean=9)*(u>=thresh)
bandwidth.scott( cbind(x1,x2) )
Run the code above in your browser using DataLab