Learn R Programming

bda (version 3.2.0-3)

bfmm: To fit a finite mixture model to binned data.

Description

To fit a finite mixture model to binned data.

Usage

bfmm(x,m=2,mu,type='gaussian',method='nelder',range.x, ...)

Arguments

x
Raw data, or a data frame prepared manually, or an R object of class='bdata'. In density and print functions, x is a fitted object of class mm.
m
Number of mixture components. Default: 2.
mu
The centers of the mixture components. If mu is provided, m will be ignored and m=length(mu).
type
Type of mixture components. It cab be "normal/gaussian", "beta","gamma","weibull".
method
Method to find numerical solutions. Default: 'nelder'. Option: 'newton'.
range.x
vector containing the minimum and maximum values of x at which to compute the estimate. The default is the minimum and maximum data values, extended by the bin width.
...
Controls

Value

  • In the output of bfmm, the binned data will be returned as out$data; the number of components is stored in out$m; the type of mixing components is stored in out$type; and the AIC/AICc/BIC are stored in out$llk; and the parameters (including the mixing coefficients) are stored in out$para.

    The density can be computed by using function density.

Details

The mixture components can be of any well known distribution families defined in R, or defined manually.

If x is raw data, one can also specify scale and rounding method.

References

Wang, B. and Wertelecki, W. (2012) Density Estimation for Data With Rounding Errors. Computational Statistics and Data Analysis, (in press), doi: 10.1016/j.csda.2012.02.016.

Examples

Run this code
mu = 34.5; s = 1.5
y = rnorm(100,mu,s) #raw data
x = round(y) #rounded data


out1 = bfmm(x, m=1, type='normal')

Run the code above in your browser using DataLab