Learn R Programming

scam (version 1.2-17)

anova.scam: Approximate hypothesis tests related to SCAM fits

Description

Performs hypothesis tests relating to one or more fitted scam objects. The function is a clone of anova.gam of the mgcv package.

The documentation below is similar to that of object anova.gam.

Usage

# S3 method for scam
anova(object, ..., dispersion = NULL, test = NULL,
                    freq = FALSE,p.type=0)
# S3 method for anova.scam
print(x, digits = max(3, getOption("digits") - 3),...)

Value

In the multi-model case anova.scam produces output identical to anova.glm, which it in fact uses.

In the single model case an object of class anova.scam is produced, which is in fact an object returned from summary.scam.

print.anova.scam simply produces tabulated output.

Arguments

object,...

fitted model objects of class scam as produced by scam().

x

an anova.scam object produced by a single model call to anova.scam().

dispersion

a value for the dispersion parameter: not normally used.

test

what sort of test to perform for a multi-model call. One of "Chisq", "F" or "Cp".

freq

whether to use frequentist or Bayesian approximations for parametric term p-values. See summary.gam for details.

p.type

selects exact test statistic to use for single smooth term p-values. See summary.scam for details.

digits

number of digits to use when printing output.

Author

Simon N. Wood simon.wood@r-project.org

WARNING

If models 'a' and 'b' differ only in terms with no un-penalized components then p values from anova(a,b) are unreliable, and usually much too low.

Default P-values will usually be wrong for parametric terms penalized using `paraPen': use freq=TRUE to obtain better p-values when the penalties are full rank and represent conventional random effects.

For a single model, interpretation is similar to drop1, not anova.lm.

Details

see anova.gam for details.

References

Scheipl, F., Greven, S. and Kuchenhoff, H. (2008) Size and power of tests for a zero random effect variance or polynomial regression in additive and linear mixed models. Comp. Statist. Data Anal. 52, 3283-3299

Wood, S.N. (2013a) On p-values for smooth components of an extended generalized additive model. Biometrika 100:221-228

Wood, S.N. (2013b) A simple test for random effects in regression models. Biometrika 100:1005-1010

See Also

scam, predict.scam, scam.check, summary.scam, anova.gam

Examples

Run this code
library(scam)
set.seed(0)
fac <- rep(1:4,20)
x1 <- runif(80)*5
x2 <- runif(80,-1,2)
x3 <- runif(80, 0, 1)
y <- fac+log(x1)/5
y <- y + exp(-1.3*x2) +rnorm(80)*0.1
fac <- factor(fac)
b <- scam(y ~ fac+s(x1,bs="mpi")+s(x2,bs="mpd")+s(x3))

b1 <- scam(y ~ fac+s(x1,bs="mpi")+s(x2,bs="mpd"))
anova(b,b1,test="F")

## b2 <- scam(y ~ fac +s(x1)+s(x2)+te(x1,x2))

Run the code above in your browser using DataLab