anova.gam                package:mgcv                R Documentation

_H_y_p_o_t_h_e_s_i_s _t_e_s_t_s _r_e_l_a_t_e_d _t_o  _G_A_M _f_i_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Performs hypothesis tests relating to one or more fitted 'gam'
     objects. For a single fitted 'gam' object, Wald tests of the
     significance of each parametric and smooth term are performed.
     Otherwise the fitted models are compared using an analysis of
     deviance table. The tests are usually approximate, unless the
     models are un-penalized.

_U_s_a_g_e:

     anova.gam(object, ..., dispersion = NULL, test = NULL)
     print.anova.gam(x,...)

_A_r_g_u_m_e_n_t_s:

object,...: fitted model objects of class 'gam' as produced by 'gam()'.

       x: an 'anova.gam' object produced by a single model call to
          'anova.gam()'.

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"'. 

_D_e_t_a_i_l_s:

     If more than one fitted model is provided than 'anova.glm' is
     used. If only one model is provided then the significance of each
     model term is assessed using Wald tests: see 'summary.gam' for
     details of the actual computations. In the latter case
     'print.anova.gam' is used as the printing method.

_V_a_l_u_e:

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

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

     'print.anova.gam' simply produces tabulated output.

_W_A_R_N_I_N_G:

     Unless the models have no penalized terms then these methods are
     only approximate.

_A_u_t_h_o_r(_s):

     Simon N. Wood simon@stats.gla.ac.uk

_R_e_f_e_r_e_n_c_e_s:

     For details of the calculation of the covariance matrix used for
     the Wald tests see:

     Wood (2004) On confidence intervals for GAMs based on penalized
     regression splines. Technical report of the Statistics department,
     University of Glasgow, UK.

_S_e_e _A_l_s_o:

     'gam', 'predict.gam', 'gam.check', 'summary.gam'

_E_x_a_m_p_l_e_s:

     library(mgcv)
     set.seed(0)
     n<-200
     sig<-2
     x0 <- rep(1:4,50)
     x1 <- runif(n, 0, 1)
     x2 <- runif(n, 0, 1)
     x3 <- runif(n, 0, 1)
     y <- 2 * x0
     y <- y + exp(2 * x1) - 3.75887
     y <- y + 0.2 * x2^11 * (10 * (1 - x2))^6 + 10 * (10 * x2)^3 * (1 - x2)^10 - 1.396
     e <- rnorm(n, 0, sig)
     y <- y + e
     x0<-as.factor(x0)
     b<-gam(y~x0+s(x1)+s(x2)+s(x3))
     anova(b)
     b1<-gam(y~x0+s(x1)+s(x2))
     anova(b,b1,test="F")

