This function creates a binned data set from the raw data
Usage
bin(x, brks)
Value
The function bin returns a matrix with three columns, representing the value of the left bin, the value of the right bin and the number of observations in x that falls in each bin.
Arguments
x
a numeric vector of raw data
brks
a numeric vector in increasing order, representing the bin values within each of which
we want to calculate the frequency of the data
Details
Given a numeric vector, the function bin creates a binned data set with bin values provided
by brks. Fitting mixture models with a large data set may be slow, especially when
we want to fit non-normal mixture models. Binning the data with a relatively
small bin width speeds up the computation of EM algorithm while at the same time keeps the
precision of the estimation result.