[R] KDE routines for data that is aggregated

David L Carlson dcarlson at tamu.edu
Tue Sep 9 19:37:12 CEST 2014

If the x and y values are regularly spaced, you could use contour() or persp() to plot the densities. If they are not, you can use density(), loess(), gam(), kriging another function to estimate a smooth surface for the values and then estimate the values over a regular grid and then plot with contour, etc.

David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Saptarshi Guha
Sent: Monday, September 8, 2014 6:57 PM
To: R-help at r-project.org
Subject: [R] KDE routines for data that is aggregated

Couldn't think of a better subject line. Rather than a matrix like


I have a matrix like

and so on. Also, sum(n) is roughly few hundred million. The number of rows
is <1MM

Are they routines to fit a 2d kde estimate to data provided in this form?
I can sample from the data according to weights given by 'n' but i am
curious if there is something that can use all the data when given a
structure of this form.


	[[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list