Description Usage Arguments Value Author(s) Examples
This function performs the Expectation-Maximization Algorithm to estimate
a vector of class proportions for a single feature in a data set wih an 
unknown set of class proportions. Called by featureMixtureProportion.
1  | 
x | 
 A vector of observed feature values for specified feature. Defaults to NULL.  | 
densities | 
 List of k density function; one per class. Flexible length, which must equal k.  | 
p | 
 Vector of class starting proportion estimates. Default is .2 for 5 classes.  | 
maxiter | 
 Maximum number of iterations of the EM algorithm allowed. Default is 2000.  | 
conv | 
 Convergence criteria for change in likelihood function. Change between  | 
A list containing the following components:
p = vector of 5 estimated mixing proportions for feature.
iter = number of iterations before algorithm converged or was stopped.
allp = (iter x 5) data frame containing all phat iterated estimates.
logl = Vector of log-likelihood values, with one log-lik value for each iteration.
Jennifer Starling
1 2 3 4 5 6 7 8 9 10 11 12 13  | ## Define ctrl object.
em <- emCalcMix(f_sample,densities,p=rep(.2,5),maxiter=1000,conv=.00001)
##Sample density function:
f_class1 = df[df$class=="eb",f_name]
    	kd1  = density(f_class1)
    	dens1 = function(x)
	{
		min_den <- quantile(kd1$y,.05)
		de <- approx(kd1$x,kd1$y,x)$y
		de[is.na(de)] <- min_den
		return(de)
	}
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.