Learn R Programming

rpm (version 0.7-3)

anova.rpm: ANOVA for rpm Fits

Description

Compute an analysis of variance table for one or more rpm fits.

Usage

# S3 method for rpm
anova(object, ...)

anova_rpmlist(object, ...)

Value

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

Arguments

object, ...

objects of class rpm, usually, a result of a call to rpm.

Warning

The comparison between two or more models will only be valid if they are fitted to the same dataset. This may be a problem if there are missing values.

Details

Specifying a single object gives a sequential analysis of variance table for that fit. That is, the reductions in the residual sum of squares as each term of the formula is added in turn are given in the rows of a table, plus the residual sum of squares.

The table will contain F statistics (and P values) comparing the mean square for the row to the residual mean square.

If more than one object is specified, the table has a row for the residual degrees of freedom and sum of squares for each model. For all but the first model, the change in degrees of freedom and sum of squares is also given. (This only make statistical sense if the models are nested.) It is conventional to list the models from smallest to largest, but this is up to the user.

Optionally the table can include test statistics. Normally the F statistic is most appropriate, which compares the mean square for a row to the residual sum of squares for the largest model considered. If scale is specified chi-squared tests can be used. Mallows' \(C_p\) statistic is the residual sum of squares plus twice the estimate of \(\sigma^2\) times the residual degrees of freedom.

If any of the objects do not have estimated log-likelihoods, produces an error, unless eval.loglik=TRUE.

See Also

The model fitting function rpm, anova, logLik.rpm for adding the log-likelihood to an existing rpm object.

Examples

Run this code
library(rpm)
data(fauxmatching)
# \donttest{
fit <- rpm(~match("edu") + WtoM_diff("edu",3),
          Xdata=fauxmatching$Xdata, Zdata=fauxmatching$Zdata,
          X_w="X_w", Z_w="Z_w",
          pair_w="pair_w", pair_id="pair_id", Xid="pid", Zid="pid",
          sampled="sampled",sampling_design="stock-flow")
anova(fit)
# }

Run the code above in your browser using DataLab