Questions tagged [kernel-density]

kernel density estimation is a non-parametric way to estimate the probability density function of a random variable.

Kernel density estimation is a fundamental data smoothing problem where inferences about the population are made, based on a finite data sample. Kernel density estimates are closely related to histograms, but can be endowed with properties such as smoothness or continuity by using a suitable kernel

http://en.wikipedia.org/wiki/Kernel_density_estimation

656 questions
4
votes
1 answer

Height values for each point in a plot

I have a data of protein-protein interactions in a data frame entitled: s1m. Each DB and AD pair make an interaction and I can plot it as well: > head(s1m) DB_num AD_num [1,] 2 8153 [2,] 7 3553 [3,] 8 4812 [4,] 13 …
4
votes
1 answer

kde2d density comparison

I have a question about the kde2d (Kernel density estimator). I am computing two different kde2d for two different sets of data in the same space of variables. When I compare both with a filled.contour2 or contours I see that the set with lower…
Andre
  • 41
  • 3
4
votes
2 answers

Density plots with multiple groups

I am trying to produce something similar to densityplot() from the lattice package, using ggplot2 after using multiple imputation with the mice package. Here is a reproducible example: require(mice) dt <- nhanes impute <- mice(dt, seed =…
Joe King
  • 2,955
  • 7
  • 29
  • 43
3
votes
1 answer

Seaborn error with kde plot: The following variable cannot be assigned with wide-form data `hue`

I have a pandas dataframe df with two columns (type and IR) as this one: type IR 0 a 0.1 1 b 0.3 2 b 0.2 3 c 0.8 4 c 0.5 ... I want to plot three distributions (one for each type) with the values of…
Palinuro
  • 184
  • 1
  • 1
  • 15
3
votes
1 answer

Python--calculate normalized probability of a value given a list of samples

So, as the title says, I'm trying to calculate the probability of a value given a list of samples, preferably normalized so the probability is 0
Tessa
  • 79
  • 1
  • 11
3
votes
1 answer

How to calculate percent overlap in distributions in r?

I have a dummy dataframe below where I'd like to calculate the pairwise percent overlap between site distributions. Basically, what percent of site1 and site2 are overlapping, site2 vs site3 and site1 vs site3? structure(list(site = c("site1",…
T1802173
  • 101
  • 4
3
votes
0 answers

Why does stat_density2d not always depict densities correctly?

I am currently working on a project, and so far I have extracted data. Im in the works of visualising some of it. Thats where the issue starts. I have an issue with ggmap density-plotting, especially in areas with smaller amounts of points. I can…
3
votes
1 answer

What is the Python equivalent (i.e. same output) for the R function density()?

In R, there is a function called density(). The syntax for the function is - density(x, bw = "nrd0", adjust = 1, kernel = c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight","cosine", "optcosine"), weights = NULL,…
Ral'akkai
  • 53
  • 5
3
votes
1 answer

Kernel density estimation for periodic data

Is it possible to obtain a KDE for periodic data in sklearn or a different Python package? Here is a simplified example: I am creating a mockup dataset from two normal distributions and map it to the interval from 0 to 20. import numpy as np import…
fuenfundachtzig
  • 7,952
  • 13
  • 62
  • 87
3
votes
1 answer

Kernel density estimation in Python for over 4d data

I am trying to use SciPy's gaussian_kde function to estimate the density of multivariate data. In my code below, if the number of dimensions is over 4d, the following error may occur(about 50%). If the number is under 3d, the error does not occur in…
hiro_fff
  • 31
  • 1
3
votes
3 answers

integrating the square of probability density?

Suppose I have set.seed(2020) # make the results reproducible a <- rnorm(100, 0, 1) My probability density is estimated through kernel density estimator (gaussian) in R using the R built in function density. The question is how to integrate the…
Z B
  • 131
  • 8
3
votes
2 answers

Estimating density from interval [start, stop] data in R

Description The motivation for this question is from clinical/epidemiological research, wherein studies often enroll patients and then follow them for variable lengths of time. The distribution of age at study entry is often of interest and is…
user1231088
  • 337
  • 3
  • 8
3
votes
2 answers

Kernel Density Estimation in Computer Graphics

Evidently there is this high quality KDE algorithm that is used in the computer graphics industry, but everyone I've asked refuse to tell me what it is. I've implemented http://en.wikipedia.org/wiki/Kernel_density_estimation , but noise is still a…
Arlen
  • 6,641
  • 4
  • 29
  • 61
3
votes
1 answer

Gaussian KDE of n-dimensional data : leading minor of the array is not positive definite

I have two subsets of n-dimensional data A and B, and I would like to know, for each sample in B the density of samples from A around it. Example datasets with 5 samples in 3 dimensions A = np.array([[-2.44528668, -0.09326276, -1.06527892], …
usernumber
  • 1,958
  • 1
  • 21
  • 58
3
votes
0 answers

Density Estimation on Single Point

I am trying to plot the densities by using non-parametric kernel estimation method. For this purpose 'm using asymmetrical kernels like Weibull, Gamma, Inverse Gaussian, etc. i have successfully plotted the densities as given in their articles. My…
Angel
  • 184
  • 1
  • 14