Hi all, Since two days I am trying to find a solution to be able to create beanplots for my data. When I call the beanplot function the following error appears:> beanplot(y1 ~ x1, log="", what=c(1,1,1,0), ylim=c(0,1)) > Error in bw.SJ(x, method = "dpi") : sample is too sparse to find TDWhat is really strange: I have 32 different vectors and the problem occurs for about 20 of them. All of the 32 vectors contain the same number of data values (about 20.000), within the same range, and without any NA values. The only thing which is slightly different sometimes is the distribution. I also had a look at the source code of the function which causes the error:> TD <- -TDh(cnt, b, n, d)if (!is.finite(TD) || TD <= 0) stop("sample is too sparse to find TD")> TDh <- function(x, h, n, d) .C(R_band_phi6_bin, as.integer(n),as.integer(length(x)), as.double(d), x, as.double(h), u = double(1))$u But this also doesn't really help me. Has anyone of you an idea what's causing my problem and how I can avoid it? The only thing I found so far was this thread: http://r.789695.n4.nabble.com/bandwidth-estimation-using-bw-SJ-td851441.html Greets, Enomis [[alternative HTML version deleted]]
Hello again, Well, I still couldn't solve my problem, but I think it really depends on the distribution of the data. When I only use the first e.g. 2000 values of my data vectors, there is no problem with creating the beanplots. But when I use some random data which is normally distributed, I can also create the plots for much larger sample sizes:> samplesize <- 200000 > tmp1 <- runif(samplesize, min=0, max=1) > tmp2 <- sample(1:13, samplesize, replace=TRUE)> beanplot(tmp1 ~ tmp2, log="", what=c(1,1,1,0), ylim=c(-1,2))Still, I do not know how I could be able to plot my original data. Anyone has got a clue? Enomis -- View this message in context: http://r.789695.n4.nabble.com/beanplot-Error-sample-is-too-sparse-to-find-TD-tp4291739p4298929.html Sent from the R help mailing list archive at Nabble.com.
Enomis wrote> >> beanplot(tmp1 ~ tmp2, log="", what=c(1,1,1,0), ylim=c(-1,2)) > Still, I do not know how I could be able to plot my original data. Anyone > has got a clue? >The same problem occurred in my code after I changed to a newer R version. The problem is related to the bandwidth selection. It can be circumvented by using another bandwidth selection method for density(), e.g. beanplot(y~x, bw="nrd"). -- View this message in context: http://r.789695.n4.nabble.com/beanplot-Error-sample-is-too-sparse-to-find-TD-tp4291739p4405983.html Sent from the R help mailing list archive at Nabble.com.