gam.exact: A method for gam producing asymptotically exact standard...

Description Usage Arguments Details Value Author(s) References Examples

Description

This 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).

Usage

1
gam.exact(Gam.obj)

Arguments

Gam.obj

a Gam object

Details

Only standard errors for the linear terms are produced. There is a print method for the Gamex class.

Value

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.

Author(s)

Aidan McDermott, Department of Biostatistics, Johns Hopkins University. Modified by Trevor Hastie for R

References

[1] 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 http://web.stanford.edu/~hastie/Papers/dominiciR2.pdf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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))
gam.exact(Gam.o)
### 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))
gam.exact(Gam.o)

Example output

Loading required package: splines
Loading required package: foreach
Loaded gam 1.16

              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
              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
                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
                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

gam documentation built on July 8, 2020, 7:24 p.m.

Related to gam.exact in gam...