Learn R Programming

delt (version 0.8.2)

eval.stage.gauss: Returns a 1D Gaussian mixture density estimate

Description

Estimates a 1D density with a mixture of Gaussians. The mixture is found by minimizing the L2 empirical risk in a stagewise manner.

Usage

eval.stage.gauss(dendat, M, mugrid, siggrid = 1, sigeka = TRUE, src = "c", sampstart=FALSE, boost=FALSE, N=60)

Arguments

dendat
n-vector of 1D observations
M
integer >= 1; the number of mixture components in the estimate
mugrid
a vector of real numbers; the range for the means of mixture components
siggrid
a vector of real numbers; the range of possible standard deviations in the mixture components
sigeka
TRUE or FALSE; if TRUE, then the standard deviation of the first mixture component is equal to 1, otherwise the standard deviation of the first mixture component is found by minimization
src
"R" or "c"; if "R", then the R-code is used, otherwise the c-code is used
sampstart
internal
boost
internal
N
postive integer; the number of evaluation points

Value

A piecewise constant function with the additional components:
muut
vector of real numbers; the means of the mixture components
sigit
vector of positive real numbers; the standard deviations of the mixture components
curmix
a probability vector; the weights of the mixture components

References

Jussi Klemela (2005). Density Estimation with Stagewise Optimization of the Empirical Risk

See Also

eval.stage

Examples

Run this code
library(denpro)
dendat<-sim.data(n=100,type="1d2modal",seed=1) 

mugrid<-seq(-1,5,0.3)    # grid of mu-values
siggrid<-seq(0.2,2,0.2)  # grid of sigma-values
M<-17                     # number of mixture components
pcf<-eval.stage.gauss(dendat,M,mugrid,siggrid)

dp<-draw.pcf(pcf)
plot(dp$x,dp$y,type="l")

# draw the estimate with the help of package "denpro"
#N<-100
#pcf2<-pcf.func("mixt",N,sig=pcf$sigit,M=pcf$muut,p=pcf$curmix)  
#pnum<-100
#dm<-draw.pcf(pcf2,pnum=pnum) 
#plot(dm$x,dm$y,type="l")

Run the code above in your browser using DataLab