Description Details Author(s) References Examples
The package 'pendensity' offers routines for estimating penalized unconditional and conditional (on factor groups) densities. For details see the description of the function pendensity.
Package: | pendensity |
Type: | Package |
Version: | 0.2.12 |
Date: | 2019-04-07 |
License: GPL (>= 2) LazyLoad: | yes |
The packages contributes the function 'pendensity()' for estimating densities using penalized splines techniques.
Christian Schellhase <christian.schellhase@gmx.net>
Density Estimation with a Penalized Mixture Approach, Schellhase C. and Kauermann G. (2012), Computational Statistics 27 (4), p. 757-777.
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 27 28 29 30 31 32 33 34 35 36 | y <- rnorm(100)
test <- pendensity(y~1)
plot(test)
#################
#second simple example
#with covariate
x <- rep(c(0,1),200)
y <- rnorm(400,x*0.2,1)
test <- pendensity(y~as.factor(x),lambda0=2e+07)
plot(test)
#################
#calculate the value at some (maybe not observed) value yi=c(0,1) of the estimated density
plot(test,val=c(0,1))
#################
#density-example of the stock exchange Allianz in 2006
data(Allianz)
time.Allianz <- strptime(Allianz[,1],form="%d.%m.%y")
#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, choosing a special start value for lambda
density.Allianz <- pendensity(d.Allianz~1,lambda0=90000)
plot(density.Allianz)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.