gam object produced by gam() and produces various useful
summaries from it.summary.gam(object, dispersion=NULL, freq=TRUE, ...)print.summary.gam(x,digits = max(3, getOption("digits") - 3),
signif.stars = getOption("show.signif.stars"),...)
gam object as produced by gam().summary.gam object produced by summary.gam().NULL to use estimate or
default (e.g. 1 for Poisson).summary.gam produces a list of summary information for a fitted gam object.p.coeff's divided by their standard errors.freq=TRUE), divided
by scale parameter.freq=TRUE).print.summary.gam tries to print various bits of summary information useful for term selection in a pretty way.
If freq=FALSE then the Bayesian parameter covariance matrix,
object$Vp, is used to calculate test statistics for terms, and the
degrees of freedom for reference distributions is taken as the estimated
degrees of freedom for the term concerned. This is not easy to justify
theoretically, and the resulting `Bayesian p-values' are difficult to
interpret and often have much worse frequentist performance than the default p-values.
Wood, S.N. (2000) Modelling and Smoothing Parameter Estimation with Multiple Quadratic Penalties. J.R.Statist.Soc.B 62(2):413-428
Wood, S.N. (2003) Thin plate regression splines. J.R.Statist.Soc.B 65(1):95-114
Wood, S.N. (2004a) Stable and efficient multiple smoothing parameter estimation for generalized additive models. J. Amer. Statist. Ass. 99:673-686
Wood, S.N. (2004b) On confidence intervals for GAMs based on penalized regression splines. Technical Report 04-12 Department of Statistics, University of Glasgow.
gam, predict.gam,
gam.check, anova.gamlibrary(mgcv)
set.seed(0)
n<-200
sig2<-4
x0 <- runif(n, 0, 1)
x1 <- runif(n, 0, 1)
x2 <- runif(n, 0, 1)
x3 <- runif(n, 0, 1)
pi <- asin(1) * 2
y <- 2 * sin(pi * 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
e <- rnorm(n, 0, sqrt(abs(sig2)))
y <- y + e
b<-gam(y~s(x0)+s(x1)+s(x2)+s(x3))
plot(b,pages=1)
summary(b)
# now check the p-values by using a pure regression spline.....
b.d<-round(b$edf)+1
b.d<-pmax(b.d,3) # can't have basis dimension less than this!
bc<-gam(y~s(x0,k=b.d[1],fx=TRUE)+s(x1,k=b.d[2],fx=TRUE)+
s(x2,k=b.d[3],fx=TRUE)+s(x3,k=b.d[4],fx=TRUE))
plot(bc,pages=1)
summary(bc)
# p-value check - increase k to make this useful!
n<-200;p<-0;k<-20
for (i in 1:k)
{ b<-gam(y~s(x,z),data=data.frame(y=rnorm(n),x=runif(n),z=runif(n)))
p[i]<-summary(b)$s.p[1]
}
plot(((1:k)-0.5)/k,sort(p))Run the code above in your browser using DataLab