sharp1d: Data Sharpening for Density Estimation

Description Usage Arguments Value Author(s) References Examples

Description

Application of Choi and Hall's (1999) data sharpening method for univariate data, for use prior to density estimation.

Usage

1
sharp1d(x, h, v = 1)

Arguments

x

the x coordinates of the data

h

the bandwidth for sharpening in the direction of the x axis

v

a positive integer representing the number of iterations to perform

Value

Returns a vector containing the sharpened points x.sharp.

Author(s)

Douglas G. Woolford, W. John Braun

References

Choi, E. and Hall, P. (1999) Data sharpening as a prelude to density estimation. Biometrika 86, 941-947.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Example 1:
y <- c(rnorm(50,-1,1),rnorm(50,2,2), rnorm(100,0,.5))
data.sharp1 <- sharp1d(y,5,1)
data.sharp2 <- sharp1d(y,5,2)
# original data:
plot(density(y, bw=5))
# sharpened data after 1 iterations:
lines(density(data.sharp1, bw=5), col=2)
# sharpened data after 2 iterations:
lines(density(data.sharp2, bw=5), col=4)

x <- rt(100, df=3)
h <- dpik(x)

# Example 2:
curve(dt(x, df=3), from=-4, to=4)
lines(bkde(x, bandwidth=h), col=2, lty=2)

x.sharp <- sharp1d(x, h, 1)
lines(bkde(x.sharp, bandwidth=h), col=3, lty=3)

x.sharp2 <- sharp1d(x, h, 2)
lines(bkde(x.sharp2, bandwidth=h), col=4, lty=4)

x.sharp3 <- sharp1d(x, h, 3)
lines(bkde(x.sharp3, bandwidth=h), col=5, lty=5)

Example output

Loading required package: scatterplot3d
Loading required package: KernSmooth
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009

CHsharp documentation built on May 1, 2019, 6:48 p.m.

Related to sharp1d in CHsharp...