Learn R Programming

bda (version 10.1.9)

fit.mixnorm: Fit a Normal Mixture Model to binned data

Description

Fit a finite normal mixture model for pre-binned data

Usage

fit.mixnorm(x,k,mu,s,p, x.range,lognormal=FALSE)

Arguments

x

Ungrouped or grouped data

k

number of components

mu,s,p

Initial parameters of the Normal components.

x.range

The range of x.

lognormal

An indicator shows whether or not to fit a normal mixture for log-normal data.

Details

If the data are top-headed (or truncated), nl, nu will used to store the frequencies of the lower and uper bins. If the data are not truncated, the two variables will be used to return the predicted frequencies in these two bins instead.

References

AS 254, ...

Examples

Run this code
# NOT RUN {
 y <- c(10, 21, 56,79,114,122,110,85,85,61,47,49,47,44,31,20,11,4,4)
 x <- 14.5 + c(0:length(y))
 x.hist <- binning(counts=y, breaks=x)
 mu <- c(20.0, 26.0)
 p <- c(0.5, 0.5)
 sig <- c(2.0, 2.8)
 out <- fit.mixnorm(x.hist,mu=mu, p=p, s=sig)

# }

Run the code above in your browser using DataLab