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
0
votes
1 answer

Calculate Bias of Parzen WIndows analytically

I'm still having some trouble understanding what Bias and Variance for a specific estimator actually are. I'm working with the definition of Bias as it is found on Wikipedia: If we define kernel-density-estimates as But how can I apply this to…
Potaito
  • 1,181
  • 2
  • 10
  • 32
0
votes
0 answers

An efficient way to build bivariate density model from large data set?

I am currently trying to build a bivariate density model with a large data set. (matrix size - 400000+ rows 2 columns, there are a lot of repeats in the matrix) Sample Data X Y 531203.5 182832.1 525208.1 179391.9 532985.8…
user3773503
  • 161
  • 2
  • 5
  • 12
0
votes
2 answers

Tools to use for conditional density estimation in Python

I have a large data set that contains 3 attributes per row: A,B,C Column A: can take the values 1, 2, and 0. Column B and C: can take any values. I'd like to perform density estimation using histograms for P(A = 2 | B,C) and plot the results using…
Oliver Hoffman
  • 540
  • 1
  • 9
  • 22
0
votes
1 answer

Different results when generating random samples from kernel density

library(ks) x<-rnorm(1000) hist(x, col="red") y <- rkde(kde(x), n=1000) hist(y, col="green") y <- rkde(density(x), n=1000) hist(y, col="blue") The last histogram is way wrong. I've used density before and I've found that it was accurate for far…
jpcgandre
  • 1,487
  • 5
  • 31
  • 55
0
votes
1 answer

Graphing two cumulative distributions in Stata

I'm trying this code (just below), Stata seems to read it -- it does not show any errors --, but it does not generate any variables. Here it is: cumul price if dummy==1, gen(cprice1) cumul price if dummy==0, gen (cprice2) line cprice1 cprice2…
John Doe
  • 212
  • 1
  • 9
  • 28
0
votes
0 answers

combining density plots in ggplot2

I am trying to improve a figure containing multiple density plots. I generate the figure like so: library(ggplot2) m <- matrix(data=cbind(rnorm(50, 0, 1), rnorm(50, 0, 1.2), rnorm(50, 0, 1.4), rnorm(50, 0, 1.6)), nrow=50, ncol=4) ms <-…
egor
  • 37
  • 7
0
votes
1 answer

Finding the function of the most likely distribution when using sm.density.compare

I am using the "sm" package for studying distributions in my datasets. For those curious I am looking at recruitment practices as a function of age and trying to identify if the age distribution change for groups change due to attributes such as…
Sigvard
  • 85
  • 1
  • 6
0
votes
2 answers

How to extract values from a 3D kernel density plot built in R using 'ks' and 'rgl'

I've been using the 'ks' package along with the 'rgl' package to produce 3D kernel density estimates and 3D plots of these. This first part has worked out fine (brief example below). What I can't figure out is if it's possible to extract the values…
dxj
  • 513
  • 4
  • 6
0
votes
1 answer

Saving a plot in 'R' in 'eps' or 'pdf' format via 'rgl.postscript' (why color is changed?)

I am trying to run this code in "R" in order to plot a density function kernel smoothing and then save the plot as an "eps" file: library(ks) library(rgl) kern <- read.table(file.choose(), sep=",") hat <- kde(kern) plot(hat, drawpoints=TRUE, xlab =…
Ali
  • 1
  • 4
0
votes
1 answer

ggplot2 density plots - how can I get it to smooth to baseline?

I am trying to plot a density with the following function. However It doesn't achieve the look I'm going for... I was wondering if there was a way to make the left and right edges of the plot smooth down to the baseline (so that it no longer has a…
Jeff
  • 1
0
votes
1 answer

Set different bandwidths in ggplot2 facet_grid plotting

Suppose I have a data set called "data", and is generated through: library(reshape2) # Reshape data, needed in command "melt" library(ggplot2) # apply ggplot density <-rep (0.05, each=800) tau <-rep (0.05, each=800) # define two different…
Chen
  • 111
  • 1
  • 17
0
votes
2 answers

Probability Density Functions in R for predicting next value of incidents

I need to do Probability Density Prediction of the following data in R: year = c(1971, 1984, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013) incidents = c(1, 1, 1, 1, 3, 1, 6, 6, 9, 11, 21, 37, 38, 275,…
0
votes
0 answers

Performing Kernel Density Estimations in MATLAB

I have been using MATLAB to perform Kernel Density Estimations (KDE) on UTM data (X and Y coordinates). I ran into a problem that I do not seem to be understanding. I perform the KDEs with a sample of 45 points. Everything works fine and I produce…
squishy
  • 344
  • 3
  • 12
0
votes
1 answer

LSCV.density object myWin not found

I'm trying to perform the LSCV.density function (which replaced the CV.sm function in the prior versions) as part of bivariate kernal density estimation in the sparr package. own <- readOGR(".", "caseControlOWIN2") myWin <- owin(poly=list( x =…
0
votes
1 answer

Rotated x labels in R

I have a data in R like the following: bag_id location_type event_ts 1 155 transfer 2012-01-02 15:57:54 2 155 sorter 2012-01-02 17:06:05 3 305 arrival 2012-01-01 07:20:16 4 692 arrival 2012-03-29…
Shima
  • 117
  • 1
  • 10