pendensity(form, base = "bspline", no.base = NULL, max.iter = 20,
lambda0 = 50000, q = 3, plot.bsp = FALSE, sort = TRUE, with.border = NULL, m = q, data=parent.frame())
#first simple example
set.seed(27)
y <- rnorm(100)
test <- pendensity(y~1)
#plotting the estimated density
plot(test)
#expand the support at the boundary
test2 <- pendensity(y~1,with.border=1)
plot(test2)
#################
#second simple example
#with covariate
x <- rep(c(0,1),200)
y <- rnorm(400,x*0.2,1)
test <- pendensity(y~as.factor(x))
plot(test)
#################
#density-example of the stock exchange Allianz in 2006
data(Allianz)
form<-'%d.%m.%y'
time.Allianz <- strptime(Allianz[,1],form)
#looking for all dates in 2006
data.Allianz <- Allianz[which(time.Allianz$year==106),2]
#building differences of first order
d.Allianz <- diff(data.Allianz)
#estimating the density
density.Allianz <- pendensity(d.Allianz~1, lambda0=90000)
plot(density.Allianz)
Run the code above in your browser using DataLab