search for: bkde2d

Displaying 20 results from an estimated 29 matches for "bkde2d".

Did you mean: kde2d
2011 Dec 22
1
overlaid filled contour plots
...ernel density estimates, showing three such plots overlaid, similar to this plot http://euclid.psych.yorku.ca/SCS/Private/Test/ridge-boot2.pdf except that I would like to have the contours *filled* (using transparent colors). To make this reproducible, I've saved the results of KernSmooth::bkde2D() in the following file: http://euclid.psych.yorku.ca/SCS/Private/Test/bkde2D-boot.RData From this, the essence of my plot can be produced by the following: # show calls to bkde2D() #library(KernSmooth) #dest0 <- bkde2D(lbt[,wh], bandwidth=.5, range.x=list(c(-16, 8), c(-5,5))) #dest1 <- b...
2011 Sep 09
2
How to translate the 2D-density matrix (the output of bkde2D function) into matrix of datapoints' amounts?
It is known that function bkde2D (package "KernSmooth") returns a matrix of density estimates over the mesh induced by x1 and x2. In Details it is written that "... heights of the kernel, scaled by the bandwidths, at each datapoint are summed. This sum, after a normalization, is the corresponding fhat value in the o...
2015 Feb 18
0
smoothScatter() and the KernSmooth package
...adNamespace(name) : there is no package called ?KernSmooth? Calls: MDPlot ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> Execution halted I looked at the code in smoothScatter and there is a call to grDevices:::.smoothScatterCalcDensity(), which in turn calls KernSmooth::bkde2D(). This gets fixed by adding KernSmooth as suggested package in EDASeq. I was able to reproduce this issue (and the fix) in a small R package: https://github.com/drisso/rmini/tree/smooth I have a few questions: isn't it unusual the way smoothScatter calls grDevices:::.smoothScatterCalcDensit...
2003 May 12
1
Name spaces in R 1.7.0
...rt "linbin2D" from its namespace. Via trial and error we found to possible solutions: 1) Edit the file NAMESPACE in the directory where KernSmooth is installed such that linbin2D is exported too. 2) Add something like linbin2D <- get("linbin2D", envir=environment(bkde2D)) to the code. We don't like 1) since it messes around with R installation. And 2) is not nice in case that some students what to run the code under R 1.6.x . We wonder whether there is another way of accessing non-exported objects from a package? Cheers, Berwin
2010 Feb 06
1
Why does smoothScatter clip when xlim and ylim increased?
Hi: Is there a way to get smoothScatter to not clip when I increase the xlim and ylim parameters? Consider the following example: set.seed(17) x1<-rnorm(100) x2<-rnorm(100) smoothScatter(x1,x2) #Now if I increase xlim and ylim notice that the plot seems to be clipped at the former xlim, and ylim boundaries: smoothScatter(x1,x2, xlim=c(-5,5), ylim=c(-5,5)) Thanks. Jen sessionInfo() R
2002 Dec 09
1
3D density estimation
I am trying to carry out density estimation for three dimensions (with anywhere between a few hundred and ~8000 data points). Which leads me to ask: a) is there any equivalent to kde2d (in MASS) or bkde2D (in KernSmooth) out there for three dimensions? b) if not, my skills only seem to extend as far as writing a function which measures density as the number of data points falling within a sphere at each point on a 3D grid. The results for spheres of the minimum size to cover all the space (i.e...
2005 Apr 28
1
strange behaviour of importFrom directive in name space
...ack", "plotNorm2", "plotPlate", "readCytoSet", "readFCS", "readSDM", "removeCensored", "setPradaPars", "smoothScatter", "thresholds") importFrom("KernSmooth", "bkde2D") importFrom("RColorBrewer", "brewer.pal") importFrom("utils", "getFromNamespace", "assignInNamespace") importFrom("MASS", "cov.rob") S3method("$", "cytoFrame") exportClasses("cytoFrame", &quot...
2005 Apr 28
1
strange behaviour of importFrom directive in name space
...ack", "plotNorm2", "plotPlate", "readCytoSet", "readFCS", "readSDM", "removeCensored", "setPradaPars", "smoothScatter", "thresholds") importFrom("KernSmooth", "bkde2D") importFrom("RColorBrewer", "brewer.pal") importFrom("utils", "getFromNamespace", "assignInNamespace") importFrom("MASS", "cov.rob") S3method("$", "cytoFrame") exportClasses("cytoFrame", &quot...
2003 Oct 22
1
2 D non-parametric density estimation
...his estimated density to determine the area associated with a 95% probability contour for the data. Given the strong correlation between x and y, I have not been real happy w/ the results obtained using kernel density estimators with separate smoothing parameters for the x and y directions - e.g., bkde2D (KernSmooth library), sm (sm library), kde2d (MASS library). It seems to me that a better alternative would be to transform the data to have ~0 correlation, estimate the density, then transform back to the original scale. Does this seem reasonable for this sort of problem? Has anyone written co...
2010 Dec 09
1
Bivariate kernel density bandwidth selection
I've been trying to implement bivariate kernel density estimation. For data like mine, function "kde" from package "ks" with bandwidth matrix derived by function "Hscv" seems like a very good choice. Unfortunately, Hscv seems unmanageably slow except for very small sample sizes (up to a few hundred) and my sample sizes are quite large (up to a few thousand).
2007 Sep 07
1
contourplot lines, text, and mtext
...contourplot (in the lattice package) and I want to add straight lines to it, how do I do this? I see that there are llines() and lsegement() functions for lattice plots, but they don't seem to do anything in this case: library(lattice) library(KernSmooth) x=rnorm(10000) y=x+rnorm(x,0,.5) a=bkde2D(cbind(x,y),.7) z=as.vector(a$fhat) grid=expand.grid(x=a$x1,y=a$x2) grid$z=z contourplot(z~x*y,data=grid,region=T,col.regions=gray(seq(1,0,len=255)),colorkey=T,cuts=50,contour=F) llines(x=c(-5,5),y=c(-5,5)) > NULL lsegments(x0=-5,y0=-5,x1=5,y1=5) I'm just trying to do the equivalent of abli...
2006 Mar 31
1
mutual information for two time series
...ogp<-numeric(100) rhplogp<-numeric(100) mut<-numeric(lmax) jointplogp<-matrix(0,nrow=100,ncol=100) lh<-as.vector(datin[,1]) rh<-as.vector(datin[,2]) rhemb<-embed(rh,lmax) lhc<-lh[1:length(rhemb[,1])] for (i in 1:lmax) { rhc<-rhemb[,i] kd<-bkde2D(cbind(lhc,rhc),bandwidth=c(dpik(lhc),dpik(rhc)),gridsize=c(100,10 0),truncate=T) #2d kernel density estimate in 2 dimensions) kdmat<-as.matrix(kd$fhat) for (j in 1:100){ p<-sum(kdmat[j,]) lhplogp[j]<-p*log(p) }...
2004 Feb 12
1
Kernel Density Estimator for 2D Binned Data
...er to more efficiently manage the volume of data. I now wish to construct a smooth kernel density estimate (Gaussian kernel function) using this binned data. Does anyone in the R community know of an R function (or S-plus or Mathematica or Matlab or C++ or even Fortran) to do this. (Note that bkde2D, ash2 etc will not work with binned data input and using 4 x 10^7 raw samples on a 0(n^2) algorithm is probably not feasible) Thanks in advance. Regards, James McCulloch Post-Doc Fellow University of Technology Sydney DISCLAIMER\ ================================================...{{dro...
2004 Apr 10
2
Density Estimation
Dear Sir/Madam; Would you please tell me what is the command that allows the estimation of the Kernel Density for some data. Thanks, Thami Rachidi [[alternative HTML version deleted]]
2008 Aug 15
0
how to draw a 4d picture with density estimation?
I have 3 row data in the format as x,y,time I want to draw it as a 3d picture;x as x axis, y as y axis, the xy's density as z axis, the corresponding time as color. I have read the manual of R and failed, Since kde2d and bkde2d give grid data, this grid data cannot match its original time. Could anyone do me a favor? thanks.
2010 Apr 06
2
checking bivariate normality
x <- iris$Sepal.Length[1:50]/iris$Sepal.Width[1:50] y <- iris$Petal.Length[1:50]/iris$Petal.Width[1:50] I want to check whether (x,y) follows a bivariate normal distribution or not, using density plot or scatter plot. Is it possible to plot a bivariate density in R. I cant find any. Arindam Fadikar M.Stat Indian Statistical Institute. New Delhi, India [[alternative HTML version
2007 May 19
2
density
Hello, I have a n*2 matrix, called "plan", which contains n observations from 2 variates. I want a kernel density estimate of the joint distribution of these 2 variates. I try : density(plan). Unfortunately, R thinks there is 2n observations (if n=10, 20 observations), where there is only n. How to to make a multivariate kernel density estimate ? Thank you very much.
2008 Sep 15
1
How to plot contours for joint density of 2 independently distributed r.v.?
X and Y are independently distributed random variables. I would like to study the contours of the joint density of these two variables. Any function to call? Thank you very much! -- View this message in context: http://www.nabble.com/How-to-plot-contours-for-joint-density-of-2-independently-distributed-r.v.--tp19493126p19493126.html Sent from the R help mailing list archive at Nabble.com.
2011 Feb 24
2
how to plot equalprobable error ellipse?
hi,R users, Now I have some scatter figures, is there some method can plot equalprobable error ellipse ? -- TANG Jie Email: totangjie@gmail.com Tel: 0086-2154896104 Shanghai Typhoon Institute,China [[alternative HTML version deleted]]
2012 Mar 10
1
How to fit a line through the "Mountain crest", i.e., through the highest density of points - in a "loess-like" fashion.
Hi, I'm trying to normalize data by fitting a line through the highest density of points (in a 2D plot). In other words, if you visualize the data as a density plot, the fit I'm trying to achieve is the line that goes through the "crest" of the mountain. This is similar yet different to what LOESS does. I've been using loess before, but it does not exactly that as it takes