similar to: How to do a probability density based filtering in 2D?

Displaying 20 results from an estimated 10000 matches similar to: "How to do a probability density based filtering in 2D?"

2012 Mar 10
1
How to improve the robustness of "loess"? - example included.
Hi, I posted a message earlier entitled "How to fit a line through the "Mountain crest" ..." I figured loess is probably the best way, but it seems that the problem is the robustness of the fit. Below I paste an example to illustrate the problem: tmp=rnorm(2000) X.background = 5+tmp; Y.background = 5+ (10*tmp+rnorm(2000)) X.specific = 3.5+3*runif(1000);
2008 Jun 25
1
confidence bounds using contour plot
Hello I'm trying to calculate 2d confindence bounds into a scatterplot using the function "kde2d" (package MASS) and a contour plot. I found a similar post providing a solution - unfortunatly I do not realy understand which data I have to use to calculated the named "quantile": Post URL: http://tolstoy.newcastle.edu.au/R/help/03b/5384.html > (...) > >> Is
2006 Jun 14
1
Estimate region of highest probabilty density
Estimate region of highest probabilty density Dear R-community I have data consisting of x and y. To each pair (x,y) a z value (weight) is assigned. With kde2d I can estimate the densities on a regular grid and based on this make a contour plot (not considering the z-values). According to an earlier post in the list I adjusted the kde2d to kde2d.weighted (see code below) to estimate the
2010 Feb 15
4
density estimates for fixed points
Problem: Based on a n x 2 data matrix i want a kernel estimate of the bivariate density. However, i also wish to specify wich points the density should be calculated at. I can offcourse just write the full kernel density estimate as a R-code, but surely there must already exist some package for this operation? The package density(), seems to create a new matrix (depending on n), where the
2008 Jan 16
1
Probability weights with density estimation
I am a physician examining an NHANES dataset available at the NCHS website: http://www.cdc.gov/nchs/about/major/nhanes/nhanes2005-2006/demo_d.xpt http://www.cdc.gov/nchs/about/major/nhanes/nhanes2005-2006/hdl_d.xpt http://www.cdc.gov/nchs/about/major/nhanes/nhanes2005-2006/tchol_d.xpt Thank you to the R authors and the foreign package authors in particular. Importing from the SAS export
2007 Nov 26
2
2d Joint Density Plot
Hi all, I'm fairly new to R, so I'm still trying to feel out what is available to me. I would like to be able to plot joint density in a two dimensional plot where density is indicated by color or darkness gradients, like a 2d color coded topographic map. Ideally, the output would be something I could then plot other points or lines on. Currently, I'm calculating joint density with
2006 Apr 23
3
bivariate weighted kernel density estimator
Is there code for bivariate kernel density estimation? For bivariate kernels there is kde2d in MASS kde2d.g in GRASS KernSur in GenKern (list probably incomplete) but none of them seems to accept a weight parameter (like density does since R 2.2.0) -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at
2008 Oct 04
3
How to plot countours with fixted densities?
Hello, I used the following codes to generate bivariate normal dependence structure with unit Frechet margins. Sigma <- matrix(c(1,.5*sqrt(1),.5*sqrt(1),1),2,2) # generate y <- mvrnorm(Nsam, c(0,0), Sigma) # random v <- cbind(pnorm(y[,1],mean = 0, sd = 1), pnorm(y[,2],mean = 0, sd = 1)) z <- cbind(-1/log(v[,1]),-1/log(v[,2])) z1 <- z[,1] z2 <- z[,2] And to
2006 Jun 24
1
Overlaying 2D kernel density plots on scatterplot matrix
Hi all We are pretty new to R here and trying to achieve something that we believe is possible but it?s not easy to work out how to do it. We are producing scatterplot matrices for e.g. 10 variables. What we would like to do is superimpose 2D kernel density estimators on top of each plot so that we end up with a scatterplot matrix of 2D kernel density (contour) plots. The kernel density plots
2006 Jan 19
2
function kde2d
Good evening, I am Marta Colombo, student at Milan's Politecnico. Thank you very much for your kindness, this mailing list is really useful. I am using the function kde2d for two-dimensional kernel density estimation and I'd like to know something more about this kind of density estimator. In particular I'd like to know: what bandwidth is used ? Thank you in advance for your attention
2009 Nov 25
3
Concave hull
Dear friends, Do you know how to calculate the CONCAVE hull of a set of points (2- dimensional or n-dimensional)? is that possible in R? (With a "smoothing" parameter of course). Best, -- Corrado Topi Global Climate Change & Biodiversity Indicators Area 18,Department of Biology University of York, York, YO10 5YW, UK Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk
2007 Aug 10
1
kde2d error message
Hello! I am trying to do a smooth with the kde2d function, and I'm getting an error message about NAs. Does anyone have any suggestions? Does this function not do well with NAs in general? fit <- kde2d(X, Y, n=100,lims=c(range(X),range(Y))) Error in if (from == to || length.out < 2) by <- 1 : missing value where TRUE/FALSE needed Thanks in advance!! Jen [[alternative
2012 Apr 18
1
ggplot2 stat_density2d issue.
Hello, I'd be very grateful for help with some ggplot2's stat_density2d issues. First issue is with data limits. xlim() and ylim() doesn't seem to work; instead, estimates (and plotting) seems to be constrained to range(x), range(y) no matter what i do. The documentation says i can pass in kde2d's parameters to ... but pussing kde2d's "lims" parameter achieves
2008 Jun 04
5
help understanding why #function(x, y) (if((x-y)>=0) {2^(x-y)} else{-(2^abs(x-y))})# doesn't work like I think it should
Hello R users and developers, I am trying to write several functions (fairly new at this) in order to avoid using loops on large data frames (because they are slow). I wrote the function below and it seems to get hung on the first part of the if statement and then applies that condition to rest of the function. So if (x-y) is greater than 0 the function uses the true statement for the
2007 Aug 30
2
Need help putting histograms on the diagonal of a splom plot
Hello, I am in need of help in putting histograms on the diagonal of a plot produced with splom(). The plot matrix I am trying to produce is to have standard scatterplots in the upper-left triangle, contour plots in the lower-right triangle, and histograms on the diagonal. I have a function that does the first two, but the histograms on the diagonal has been beyond my ability. Here is my
2018 Mar 08
3
add single points to a level plot
Hi all, I'm trying to add single points with known coordinates to a level plot, but could not find the proper answer. I got to know that layer() function is good for this, but I don't know which package is related to this function. The source is here: https://stackoverflow.com/questions/28597149/add-xy-points-to-raster-map-generated-by-levelplot but my question is a little different as I
2002 Jan 18
1
New R on Mac user fails to run MASS
My R installation (Mac OS9.2.2) is working, but when I try to run the examples from Venables & Ripley (p. 6): R : Copyright 2001, The R Development Core Team Version 1.4.0 (2001-12-19) ... > library(MASS) > x<-rnorm(1000) > y<-rnorm(1000) > truehist(c(x,y+3),nbins=25) % Plots nicely > dd<-con2tr(kde2d(x,y)) % Doesn't complain > contourplot(z ~ x + y,
2006 May 11
1
Conditional contour plots for estimated density functions using Lattice
Does anybody here have a suggestion for a clever way of creating contour plots for estimated bivariate density functions conditional on a factor? The contourplot function in the 'lattice' package only accepts data that are on the form 'z ~ x * y', not on the form 'x,y' or 'y~x'; otherwise I could probably have used the panel function to do the needed conversion.
2018 Mar 08
0
add single points to a level plot
Hi all, I ran the code: > s <- stack(replicate(2, raster(matrix(runif(100), 10)))) > xy <- data.frame(coordinates(sampleRandom(s, 10, sp=TRUE)), + z1=runif(10), z2=runif(10)) > levelplot(s, margin=FALSE, at=seq(0, 1, 0.05)) + + layer(sp.points(xy, pch=ifelse(pts$z1 < 0.5, 2, 3), cex=2, col=1), columns=1) + + layer(sp.points(xy, pch=ifelse(pts$z2 < 0.5, 2,
2004 Oct 15
1
2d approx
Hi, I am looking for a function that generalizes 'approx' to two (or more) dimensions. The references on the approx help page point toward splines, but a) splines is what I am trying to avoid in the first place and b) splines (except for mgcv splines) seem to be one dimensional. Here is a more detailed account. Using mgcv:gam I fit an additive model xy.gam according to the formula y ~