Learn R Programming

bda (version 1.1.1-7)

histospline: Fit smoothed KDE to binned data.

Description

Fit smoothed KDE to binned data via an iterative algorithm.

Usage

histospline(x,f,gridsize=512L,na.rm=TRUE,just="center",binned=FALSE, scale=1.0)

Arguments

x
vector of raw data or distinct center information of binned data.
f
A vector of frequencies. Can not be missing if 'binned=TRUE'.
gridsize
The size of grid where the density will be evaluated.
na.rm
Default "TRUE". Automatically remove missing values. Otherwise, stop and warn.
just
Character showing how data are binned. "center", "left" or "right".
binned
Logic value. Default value: 'FALSE'.
scale
Numeric. Default=1.0.

See Also

bfmm.

Examples

Run this code
p = c(.4,.6)
mu = c(34.5,40)
s=c(1.5,1.3)
x = rmixnorm(300,p,mu,s)
y = round(x,0)
x0 = seq(min(x),max(x),length=100)
plot(dmixnorm(x0,p,mu,s)~x0,type='l')
lines(density(x), col=3,lty=3)
lines(density(y), col=4,lty=4)
out = histospline(y)
lines(out,col=2,lty=2)

Run the code above in your browser using DataLab