plot.BS {DELTD}R Documentation

Density Plot by Birnbaum-Saunders kernel

Description

Plot Kernel density by using Birnbaum-Saunders Kernel.

Usage

## S3 method for class 'BS'
plot(x, ...)

Arguments

x

An object of class "BS"

...

Not presently used in this implementation

Value

Nothing

Author(s)

Javaria Ahmad Khan, Atif Akbar.

References

Jin, X.; Kawczak, J. 2003. Birnbaum-Saunders & Lognormal kernel estimators for modeling durations in high frequency financial data. Annals of Economics and Finance 4, 103-124.

See Also

For further kernels see plot.Beta, plot.Erlang, plot.Gamma and plot.LogN. For estimated values BS and for MSE mse.

Examples

alpha = 10
theta = 15 / 60
y <- rgamma(n = 10000, shape = alpha, scale = theta)
h <- 1.5
xx <- seq(min(y) + 0.05, max(y), length = 200)
den <- BS(x = xx, y = y, k = 200, h = h)
plot(den, type = "l")

##other details can also be added
y <- rgamma(n = 10000, shape = alpha, scale = theta)
h <- 0.79 * IQR(y) * length(y) ^ (-1/5)  #Normal Scale Rule Bandwidth
gr <- BS(x = xx, y = y, k = 200, h = h)
plot(gr, type = "s", ylab = "Density Function", lty = 1, xlab = "Time")

## To add true density along with estimated
d1 <- density(y, bw = h)
lines(d1, type = "p", col = "red")
legend("topright", c("Real Density", "Density by Birnbaum-Saunders Kernel"),
col=c("red", "black"), lty = c(1,2))

[Package DELTD version 2.6.8 Index]