Learn R Programming

aster (version 0.7-4)

anova.aster: Analysis of Deviance for Aster Model Fits

Description

Compute an analysis of deviance table for two or more aster model fits.

Usage

## S3 method for class 'aster':
anova(object, \dots)

Arguments

object, ...
objects of class "aster", typically the result of a call to aster, or a list of objects of class "aster" for the "asterlist" method.

Value

  • An object of class "anova" inheriting from class "data.frame".

Warning

The comparison between two or more models by anova or anova.asterlist will only be valid if they are (1) fitted to the same dataset, (2) models are nested, (3) models are of the same type (all conditional or all unconditional), (4) have the same dependence graph and exponential families. None of this is currently checked.

Details

Constructs a table having a row for the degrees of freedom and deviance for each model. For all but the first model, the change in degrees of freedom and deviance is also given, as is the corresponding asymptotic P value.

See Also

aster, anova.

Examples

Run this code
### see package vignette for explanation ###
library(aster)
data(echinacea)
vars <- c("ld02", "ld03", "ld04", "fl02", "fl03", "fl04",
    "hdct02", "hdct03", "hdct04")
redata <- reshape(echinacea, varying = list(vars), direction = "long",
    timevar = "varb", times = as.factor(vars), v.names = "resp")
redata <- data.frame(redata, root = 1)
pred <- c(0, 1, 2, 1, 2, 3, 4, 5, 6)
fam <- c(1, 1, 1, 1, 1, 1, 3, 3, 3)
hdct <- grep("hdct", as.character(redata$varb))
hdct <- is.element(seq(along = redata$varb), hdct)
redata <- data.frame(redata, hdct = as.integer(hdct))
aout3 <- aster(resp ~ varb + nsloc + ewloc + pop * hdct,
    pred, fam, varb, id, root, data = redata)
aout4 <- aster(resp ~ varb + nsloc + ewloc + pop * hdct - pop,
    pred, fam, varb, id, root, data = redata)
anova(aout4, aout3)

Run the code above in your browser using DataLab