Learn R Programming

mixdist (version 0.5-5)

anova.mix: ANOVA Tables for Mixture Model Objects

Description

Compute analysis of variance tables for one or two mixture model objects.

Usage

# S3 method for mix
anova(object, mixobj2, …)

Arguments

object

an object of class "mix", usually, a result of a call to the mixture model fitting function mix.

mixobj2

an object of the same type to be compared with object, which contains the results of fitting another model with more or fewer parameters fitted.

additional objects of the same type.

Value

An object of class "anova" inheriting from class "data.frame". When given a single argument this function produces a table which tests whether the model is significant. The table contains the residual degrees of freedom, Chi-square statistic and P value. If the class of the argument is not "mix", this function returns NULL. When given two objects, it tests the models against one another and lists them in the order of number of parameters fitted. For the model with fewer parameters fitted, the change in degrees of freedom is given. This only make statistical sense if the models are nested. If one of arguments does not belong to the class "mix", the function will give the anova table for the other argument; if both of them do not, it returns NULL.

Warning

The comparison between two models will only be valid if they are fitted to the same dataset. And the two models should be nested.

See Also

The model fitting function mix, the generic function anova.

Examples

Run this code
# NOT RUN {
data(pike65) # load the grouped data `pike65'
data(pikepar) # load the initial values of parameters for the data `pike65'
fitpike3 <- mix(pike65, pikepar, "lnorm", mixconstr(conmu = "MFX", 
                fixmu = c(FALSE, FALSE, FALSE, FALSE, TRUE), consigma = "CCV"), emstep = 3)
anova(fitpike3)
fitpike4 <- mix(pike65, pikepar, "lnorm", mixconstr(consigma = "CCV"), emsteps = 3)
anova(fitpike4)
anova(fitpike3, fitpike4)
anova(fitpike4, fitpike3)
# }

Run the code above in your browser using DataLab