Learn R Programming

mixdist (version 0.5-5)

testconstr: Check Constraints

Description

Check if constraints on parameters are valid. See the reference for details.

Usage

testconstr(mixdat, mixpar, dist, constr)

Arguments

mixdat

a data frame containing grouped data, whose first column should be right boundaries of grouping intervals, whose second column should consist of the frequencies indicating numbers of observations falling into each interval. If conditional data are available, this data frame should have \(k\) + 2 columns, where \(k\) is the number of components, whose element in row \(j\) and column \(i\) + 2 is the number of observations from the jth interval belonging to the ith component.

mixpar

a data frame containing the values for parameters of component distributions, which are, in order, the proportions, means, and standard deviations.

dist

the distribution of components, it can be one of "norm", "lnorm", "gamma", "weibull", "binom", "nbinom" and "pois".

constr

a list of constraints on parameters of component distributions. See function mixconstr.

Value

If the constraints are valid, this function will give a logical value TRUE. If not, it will give an error message to illustrate the reason.

References

Macdonald, P.D.M. and Green, P.E.J. (1988) User's Guide to Program MIX: An Interactive Program for Fitting Mixtures of Distributions. ICHTHUS DATA SYSTEMS.

See Also

mixgroup for grouping data, mixparam for organizing the parameter values, mixconstr for constructing constraints.

Examples

Run this code
# NOT RUN {
testconstr(pike65, pikepar, "lnorm", constr = mixconstr(consigma = "CCV"))
testconstr(bindat, binpar, "binom", constr = mixconstr())
testconstr(bindat, binpar, "binom", constr = mixconstr(consigma = "BINOM"))
testconstr(bindat, binpar, "pois", constr = mixconstr(conmu = "MEQ", consigma = "POIS"))
# }

Run the code above in your browser using DataLab