gam.exact.RdThis function is a "wrapper" for a Gam object, and produces exact standard errors for each linear term in the gam call (except for the intercept).
gam.exact(Gam.obj)A list (of class Gamex) containing a table of coefficients and a variance covariance matrix for the linear terms in the formula of the gam call.
Only standard errors for the linear terms are produced. There is a print method for the Gamex class.
Issues in Semiparametric Regression: A Case Study of Time Series Models in Air Pollution and Mortality, Dominici F., McDermott A., Hastie T.J., JASA, December 2004, 99(468), 938-948. See https://hastie.su.domains/Papers/dominiciR2.pdf
set.seed(31)
n <- 200
x <- rnorm(n)
y <- rnorm(n)
a <- rep(1:10,length=n)
b <- rnorm(n)
z <- 1.4 + 2.1*a + 1.2*b + 0.2*sin(x/(3*max(x))) + 0.3*cos(y/(5*max(y))) + 0.5 * rnorm(n)
dat <- data.frame(x,y,a,b,z,testit=b*2)
### Model 1: Basic
Gam.o <- gam(z ~ a + b + s(x,3) + s(y,5), data=dat)
coefficients(summary.glm(Gam.o))
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 1.7967163 0.07798136 23.0403307 8.797961e-57
#> a 2.0844117 0.01256893 165.8384102 1.227261e-206
#> b 1.2093572 0.03677775 32.8828469 4.026009e-80
#> s(x, 3) 0.1089636 0.03788166 2.8764200 4.484318e-03
#> s(y, 5) -0.0121808 0.03549202 -0.3431982 7.318308e-01
gam.exact(Gam.o)
#> Estimate Std. Error t value Pr(>|t|) A-exact SE
#> (Intercept) 1.7967163 0.07798136 23.0403307 8.797961e-57 NA
#> a 2.0844117 0.01256893 165.8384102 1.227261e-206 0.01270896
#> b 1.2093572 0.03677775 32.8828469 4.026009e-80 0.03722745
#> s(x, 3) 0.1089636 0.03788166 2.8764200 4.484318e-03 NA
#> s(y, 5) -0.0121808 0.03549202 -0.3431982 7.318308e-01 NA
#> A-exact Z A-exact P
#> (Intercept) NA NA
#> a 164.01126 0
#> b 32.48563 0
#> s(x, 3) NA NA
#> s(y, 5) NA NA
### Model 2: Poisson
Gam.o <- gam(round(abs(z)) ~ a + b + s(x,3) + s(y,5), data=dat,family=poisson)
coefficients(summary.glm(Gam.o))
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 1.583040747 0.052682592 30.0486496 2.273825e-198
#> a 0.162666468 0.007226385 22.5100747 3.307134e-112
#> b 0.093692414 0.020212699 4.6353243 3.563784e-06
#> s(x, 3) 0.009475473 0.020873875 0.4539394 6.498725e-01
#> s(y, 5) -0.008357320 0.019953492 -0.4188399 6.753331e-01
gam.exact(Gam.o)
#> Estimate Std. Error z value Pr(>|z|) A-exact SE
#> (Intercept) 1.583040747 0.052682592 30.0486496 2.273825e-198 NA
#> a 0.162666468 0.007226385 22.5100747 3.307134e-112 0.007497044
#> b 0.093692414 0.020212699 4.6353243 3.563784e-06 0.021547155
#> s(x, 3) 0.009475473 0.020873875 0.4539394 6.498725e-01 NA
#> s(y, 5) -0.008357320 0.019953492 -0.4188399 6.753331e-01 NA
#> A-exact Z A-exact P
#> (Intercept) NA NA
#> a 21.697415 0.000000e+00
#> b 4.348252 1.372271e-05
#> s(x, 3) NA NA
#> s(y, 5) NA NA