Displaying 20 results from an estimated 4000 matches similar to: "How to get the number of modes using kde2d"
2008 Oct 04
0
difference between sm.density() and kde2d()
Dear R users,
I used sm.density function in the sm package and kde2d() in the MASS package
to estimate the bivariate density. Then I calculated the Kullback leibler
divergence meassure between a distribution and the each of the estimated
densities, but the asnwers are different. Is there any difference between
the kde2d and sm.density estimates? if there is a difference, then which is
the best
2002 Oct 15
5
Specification change requests
Hi,
as Conrad suggested, I've made a complete list of all points in the
specification, which I beleive are errors, or where the explanation
is unclear, contains unneccessary steps and so on.
I hope someone has time to look through the points and if and when
accepting or rejecting them be so very kind and inform me about it.
I will also once again try to work through the residue
2002 Sep 23
2
More errors in the file format specification Was: Test files for decoder implementation
Hi,
I've found some more errors in the file format specification (or
at least points, where the specification and actual libvorbis implementation
mismatch):
- Floor 1 / curve computation / step 1: amplitude value synthesis
21) vector [floor1_final_Y] element [i] =
[predicted] - (([val] - 1) divided by 2 using integer division)
hould be:
21) vector [floor1_final_Y] element [i] =
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
2009 Dec 02
2
Joint density kde2d works improperly?
Dear all,
Please, look at the following code:
attach(geyser)
f1 <- kde2d(duration, waiting, n = 5)
a <- 0
for (i in 1:5){
for (j in 1:5){
a <- a + f1$z[i,j]
}
}
As far as I understood from Help kde2d returns matrix elements of which are
values of joint probability mass function Pr(X=x,Y=y) therefore, sum of its
elements should sum to 1.
Which is not the case from my check.
Where is
2011 Nov 24
2
Question on density values obtained from kde2d() from package MASS
Hello,
I am a little bit confused regarding the density values obtained from the function kde2d() from the package MASS because the are not in the intervall [0,1] as I would expect them to be. Here is an example:
x <- c(0.0036,0.0088,0.0042,0.0022,-0.0013,0.0007,0.0028,-0.0028,0.0019,0.0026,-0.0029,-0.0081,-0.0024,0.0090,0.0088,0.0038,0.0022,0.0068,0.0089,-0.0015,-0.0062,0.0066)
y <-
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
2012 Nov 28
1
Plot 3d density
I want to create a 3d plot with densities.
I use the function density to first create a 2d dimensional plot for
specific x values, the function then creates the density and puts them
into a y variable. Now I have a second set of x values and put it
again into the density function and I get a second set of y variables
and so on.... I want to put those sets into a 3d plot, I hope you know
what I
2005 Jan 14
1
kde2d and borders
Hallo,
I want to use kde2d to visualize data on a sphere given in spherical
coordinates. Now the problem is, that "phi == 2*pi = 0", so in principal
I have to connect (in a graphical view) the left and right border of my
plot (and the bottom and top). Has anyone any idea how to do that ?
Thanks,
Manuel
--
-------------------------------------
Manuel Metz
Sternwarte der
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
2009 Mar 17
1
help with 3-D plot of kernel density estimates
Hi,
I guess I have a naive question. I use kde2d function in a standard way to
estimate kernel densities of x and y (x and y are vectors) and plot them
using image().
f1=kde2d(x,y)
image(f1)
But what if I want to see kernel estimates of three variables, x, y and z (a
vector) plotted together ? Something in which x<->y is plotted and colored
according to the corresponding value of z ?
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
2004 Dec 22
0
weighted kernel density estimation
Dear wizaRds,
I use the MASS::kde2d function to estimate density of the two first
principal components. I do that to have a graphic visualisation of a
"group structure" in my dataset. So far, no problem.
But i would like to estimate that density using weights according to the
COS?? values that tells me if my observation is well represented on the
factorial plan 1-2. I would like to
2013 Oct 15
1
plotting a marginal distribution on the plane behind a persp() plot
R'istas:
I am trying to plot a marginal distribution on the plane behind a persp() plot. My existing code is:
library(MASS)
X <- mvrnorm(1000,mu=c(0,0),Sigma=matrix(c(1,0,0,1),2))
X.kde <- kde2d(X[,1],X[,2],n=25) # X.kde is list: $x 1*n, $y 1*n, $z n*n
persp(X.kde,phi=30,theta=60,xlab="x_b",ylab="x_a",zlab="f") ->res
Any suggestions are very
2003 Sep 17
0
Persp and color (again)
Hi guys,
After all the discussion yesterday about persp and color, I decided to
have a more closer look at demo(persp), and decided to write a function to
generate 'topo-like' colours to plot perspectives (Thanks a lot to Uwe
Ligges for his enlightning comments regarding the code in the demo).
Here it goes, I believe that this function will be pretty useful to a lot
of people:
2007 May 04
1
Partitioning a kde2d into equal probability areas
Hi,
I'd like to partition a 2d probability density function into regions of
equal probability. It is straightforward in the 1d case, like
qnorm(seq(0,1,length=5)) but for 2d I'd need more constraints.
Any suggestions for how to approach this? Is seems like a spatial
sampling problem but I'm not sure where to look.
Thanks for your time,
Dave
--
Dr. David Forrest
drf at
2007 Jun 08
2
how to find how many modes in 2 dimensions case
Hi,
Does anyone know how to count the number of modes in 2 dimensions using
kde2d function?
Thanks
Pat
2003 Oct 22
1
2 D non-parametric density estimation
I have spatial data in 2 dimensions - say (x,y). The correlation
between x and y is fairly substantial. My goal is to use a
non-parametric approach to estimate the multivariate density describing
the spatial locations. Ultimately, I would like to use this estimated
density to determine the area associated with a 95% probability contour
for the data.
Given the strong correlation between x and
2003 Sep 01
0
Re: Plotting bivariate normal distributions.
You'll find that it is a lot easier to do it in R:
# lets first simulate a bivariate normal sample
library(MASS)
bivn <- mvrnorm(1000, mu = c(0, 0), Sigma = matrix(c(1, .5, .5, 1), 2))
# now we do a kernel density estimate
bivn.kde <- kde2d(bivn[,1], bivn[,2], n = 50)
# now plot your results
contour(bivn.kde)
image(bivn.kde)
persp(bivn.kde, phi = 45, theta = 30)
# fancy contour with
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