Estimation method of mixture complexity as well as component weights and parameters based on estimating the determinant of the Hankel matrix of the moments of the mixing distribution and comparing it to determinant values generated by a parametric bootstrap.
paramHankel(obj, j.max = 10, B = 1000, ql = 0.025, qu = 0.975,
control = c(trace = 0), …)paramHankel.scaled(obj, j.max = 10, B = 100, ql = 0.025, qu = 0.975,
control = c(trace = 0), …)
# S3 method for paramEst
plot(x, mixture = TRUE, components = TRUE, ylim = NULL, cex.main = 0.9, ...)
# S3 method for paramEst
print(x, ...)
object of class datMix
.
integer stating the maximal number of components to be considered.
integer specifying the number of bootstrap replicates.
numeric between
numeric between
control list of optimization parameters, see solnp
.
paramHankel()
and paramHankel.scaled()
:further arguments passed to the boot
function.
plot.hankDet()
:further arguments passed to the hist
function plotting the data.
print.hankDet()
:further arguments passed to the printCoefmat
function.
object of class paramEst
.
logical flag, indicating whether the estimated mixture density should be plotted, set to TRUE
by default.
logical flag, indicating whether the individual mixture components should be plotted, set to TRUE
by default.
range of y values to use; if not specified (or containing NA
), the function tries to construct reasonable default values.
magnification to be used for main titles relative to the current setting of cex
, see par
.
Object of class paramEst
with the following attributes:
data based on which the complexity is estimated.
character string giving the abbreviated name of the component distribution, such that the function ddist
evaluates its density/mass and rdist
generates random variates.
integer specifying the number of parameters identifying the component distribution, i.e. if ndistparams
string vector specifying the names of the formal arguments identifying the distribution dist
and used in ddist
and rdist
, e.g. for a gaussian mixture (dist = norm
) amounts to mean
and sd
, as these are the formal arguments used by dnorm
and rnorm
.
logicalflag, indicating whether the underlying mixture distribution is discrete.
attribute MLE.function
of obj
.
Say the complexity estimate is equal to some pars
is a numeric vector of size
numeric vector of function values gone through during optimization at iteration
indicates whether the solver has converged (0) or not (1 or 2) at iteration
Define paramHankel
procedure initially assumes that the mixture only contains one component, setting B
parametric bootstrap samples of size B
determinants of the corresponding nonparamHankel
). The null hypothesis ql
and qu
, empirical quantiles of the bootstrapped determinants. Otherwise, paramHankel.scaled
functions similarly to paramHankel
with the exception that the bootstrapped determinants are scaled by the empirical standard deviation of the bootstrap sample. To scale the original determinant, B
nonparametric bootstrap samples of size MLE.function
attribute of the datMix
object obj
for MLE.function = NULL
) the solver solnp
is used to calculate the minimum of the negative log-likelihood. The initial values supplied to the solver are calculated as follows: the data is clustered into clara
and the data corresponding to each group is supplied to MLE.function
(if supplied to the datMix
object, otherwise numerical optimization is used). The size of the groups is taken as initial component weights and the MLE's are taken as initial component parameter estimates.
nonparamHankel
for estimation of the mixture complexity based on the Hankel matrix without parameter estimation, solnp
for the solver, datMix
for creation of the datMix
object.
# NOT RUN {
## create 'Mix' object
poisMix <- Mix("pois", discrete = TRUE, w = c(0.45, 0.45, 0.1), lambda = c(1, 5, 10))
## create random data based on 'Mix' object (gives back 'rMix' object)
set.seed(1)
poisRMix <- rMix(1000, obj = poisMix)
## create 'datMix' object for estimation
# generate list of parameter bounds
poisList <- list("lambda" = c(0, Inf))
# generate MLE function
MLE.pois <- function(dat){
mean(dat)
}
# generate function needed for estimating the j^th moment of the
# mixing distribution via Hankel.method "explicit"
explicit.pois <- function(dat, j){
res <- 1
for (i in 0:(j-1)){
res <- res*(dat-i)
}
return(mean(res))
}
# generating 'datMix' object
pois.dM <- RtoDat(poisRMix, theta.bound.list = poisList, MLE.function = MLE.pois,
Hankel.method = "explicit", Hankel.function = explicit.pois)
## complexity and parameter estimation
# }
# NOT RUN {
set.seed(1)
res <- paramHankel(pois.dM)
plot(res)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab