kde  R Documentation 
Creates one or more kernel density estimates using a combination of the Botev (2010) bandwidth selector and the Abramson (1982) adaptive kernel bandwidth modifier.
kde(x, ...)
## Default S3 method:
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'other'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'UPb'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
type = 4,
cutoff.76 = 1100,
cutoff.disc = discfilter(),
common.Pb = 0,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'detritals'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = FALSE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
ncol = NA,
samebandwidth = TRUE,
normalise = TRUE,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'PbPb'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
common.Pb = 2,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'ArAr'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
i2i = FALSE,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'KCa'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
i2i = FALSE,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'ThPb'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
i2i = FALSE,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'ThU'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [ka]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
Th0i = 0,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'ReOs'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
i2i = TRUE,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'SmNd'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
i2i = TRUE,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'RbSr'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
i2i = TRUE,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'LuHf'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
i2i = TRUE,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'UThHe'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
## S3 method for class 'fissiontracks'
kde(
x,
from = NA,
to = NA,
bw = NA,
adaptive = TRUE,
log = FALSE,
n = 512,
plot = TRUE,
rug = TRUE,
xlab = "age [Ma]",
ylab = "",
kde.col = rgb(1, 0, 1, 0.6),
hist.col = rgb(0, 1, 0, 0.2),
show.hist = TRUE,
bty = "n",
binwidth = NA,
hide = NULL,
nmodes = 0,
sigdig = 2,
...
)
x 
a vector of numbers OR an object of class 
... 
optional arguments to be passed on to 
from 
minimum age of the time axis. If 
to 
maximum age of the time axis. If 
bw 
the bandwidth of the KDE. If 
adaptive 
logical flag controlling if the adaptive KDE modifier of Abramson (1982) is used 
log 
transform the ages to a log scale if 
n 
horizontal resolution (i.e., the number of segments) of the density estimate. 
plot 
show the KDE as a plot 
rug 
add a rug plot? 
xlab 
the xaxis label 
ylab 
the yaxis label 
kde.col 
the fill colour of the KDE specified as a four
element vector of 
hist.col 
the fill colour of the histogram specified as a
four element vector of 
show.hist 
logical flag indicating whether a histogram should be added to the KDE 
bty 
change to 
binwidth 
scalar width of the histogram bins, in Myr if

hide 
vector with indices of aliquots that should be removed from the plot. 
nmodes 
label the 
sigdig 
the number of significant digits to which the modes
should be labelled. Only used if 
type 
scalar indicating whether to plot the

cutoff.76 
the age (in Ma) below which the

cutoff.disc 
discordance cutoff filter. This is an object of
class 
common.Pb 
common lead correction:

ncol 
scalar value indicating the number of columns over which the KDEs should be divided. 
samebandwidth 
logical flag indicating whether the same
bandwidth should be used for all samples. If

normalise 
logical flag indicating whether or not the KDEs should all integrate to the same value. 
i2i 
‘isochron to intercept’: calculates the initial (aka
‘inherited’, ‘excess’, or ‘common’)

Th0i 
initial

Given a set of n
age estimates \{t_1, t_2, ..., t_n\}
,
histograms and KDEs are probability density estimators that display
age distributions by smoothing. Histograms do this by grouping the
data into a number of regularly spaced bins. Alternatively, kernel
density estimates (KDEs; Vermeesch, 2012) smooth data by applying a
(Gaussian) kernel:
KDE(t) = \sum_{i=1}^{n}N(t\mu=t_i,\sigma=h[t])/n
where N(t\mu,\sigma)
is the probability of observing a value
t
under a Normal distribution with mean \mu
and
standard deviation \sigma
. h[t]
is the smoothing
parameter or ‘bandwidth’ of the kernel density estimate, which may
or may not depend on the age t
. If h[t]
depends on
t
, then KDE(t)
is known as an ‘adaptive’ KDE. The
default bandwidth used by IsoplotR
is calculated using the
algorithm of Botev et al. (2010) and modulated by the adaptive
smoothing approach of Abramson (1982). The rationale behind
adaptive kernel density estimation is to use a narrower bandwidth
near the peaks of the sampling distribution (where the ordered
dates are closely spaced in time), and a wider bandwidth in the
distribution's sparsely sampled troughs. Thus, the resolution of
the density estimate is optimised according to data availability.
If x
has class UPb
, PbPb
, ArAr
,
KCa
, ReOs
, SmNd
, RbSr
,
UThHe
, fissiontracks
or ThU
, returns an
object of class KDE
, i.e. a list containing the
following items:
horizontal plot coordinates
vertical plot coordinates
the base bandwidth of the density estimate
the data values from the input to
the kde
function
copied from the input
a twocolumn matrix with the x
and y
values of the nmodes
most prominent modes. Only returned
if nmodes
is a positive integer or 'all'
.
or, if x
has class =detritals
, an object of class
KDEs
, i.e. a list containing the following items:
a named list with objects of class KDE
the beginning of the common time scale
the end of the common time scale
the maximum probability density of all the KDEs
the xaxis label to be used by plot.KDEs(...)
Abramson, I.S., 1982. On bandwidth variation in kernel estimatesa square root law. The annals of Statistics, pp.12171223.
Botev, Z. I., J. F. Grotowski, and D. P. Kroese. "Kernel density estimation via diffusion." The Annals of Statistics 38.5 (2010): 29162957.
Vermeesch, P., 2012. On the visualisation of detrital age distributions. Chemical Geology, 312, pp.190194.
radialplot
, cad
kde(examples$UPb)
dev.new()
kde(examples$FT1,log=TRUE)
dev.new()
kde(examples$DZ,from=1,to=3000,kernel="epanechnikov")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.