Nothing
pmle.binom <-
function(x,size,m0=1,lambda=0,inival=NULL,len=10,niter=50,tol=1e-6,rformat=FALSE)
#This function compute the PMLE of parameters under a binomial mixture
#x: data, can be either a vector or a matrix with the 1st column being the observed values
# and the 2nd column being the corresponding frequencies.
#size: number of trials.
#m0: order of finite mixture model.
#inival: initial values for the EM-algorithm
#lambda: size of penalty function of mixing proportions.
#len: number of initial values chosen for the EM-algorithm.
#niter: least number of iterations for all initial values in the EM-algorithm.
#tol: tolerance value for the convergence of the EM-algorithm.
#rformat format for output, rformat=T means the format of output is determined by R software.
# rformat=F means the format of output is determined by our default setting. When the output is
# larger than 0.001, it is determined by round(output,3); When the output is less than 0.001,
# it is determined by signif(output,3).
{
if (is.data.frame(x))
{
if (ncol(x)==2)
x=as.matrix(x)
if (ncol(x)==1 | ncol(x)>2)
x=x[,1]
}
if(is.vector(x))
{
y=as.matrix(table(x))
count=as.numeric(rownames(y))
freq=y[,1]
x=cbind(count,freq)
}
out=phi0.binom(x,size,m0,lambda,inival,len,niter,tol)
alpha=out$alpha
theta=out$theta
loglik=out$loglik
ploglik=out$ploglik
if (rformat==F)
{
alpha=rousignif(alpha)
theta=rousignif(theta)
loglik=rousignif(loglik)
ploglik=rousignif(ploglik)
}
if (lambda==0 | m0==1)
list('MLE of mixing proportions:'=alpha,
'MLE of component parameters:'=theta,
'log-likelihood:'=loglik)
else
list('PMLE of mixing proportions:'=alpha,
'PMLE of component parameters:'=theta,
'log-likelihood:'=loglik,
'Penalized log-likelihood:'=ploglik)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.