gam.style: Modified generalized additive model plots for interpreting...

Description Usage Arguments Value References See Also Examples

View source: R/gam.style.R

Description

Generalized additive model (GAM)-style effects plots provide a graphical means of interpreting relationships between covariates and conditional quantiles predicted by a QRNN. From Plate et al. (2000): The effect of the ith input variable at a particular input point Delta.i.x is the change in f resulting from changing X1 to x1 from b1 (the baseline value [...]) while keeping the other inputs constant. The effects are plotted as short line segments, centered at (x.i, Delta.i.x), where the slope of the segment is given by the partial derivative. Variables that strongly influence the function value have a large total vertical range of effects. Functions without interactions appear as possibly broken straight lines (linear functions) or curves (nonlinear functions). Interactions show up as vertical spread at a particular horizontal location, that is, a vertical scattering of segments. Interactions are present when the effect of a variable depends on the values of other variables.

Usage

1
2
3
4
gam.style(x, parms, column, baseline=mean(x[,column]),
         epsilon=1e-5, seg.len=0.02, seg.cols="black",
         plot=TRUE, return.results=FALSE, trim=0,
         ...)

Arguments

x

matrix with number of rows equal to the number of samples and number of columns equal to the number of covariate variables.

parms

list returned by qrnn.fit.

column

column of x for which effects plots should be returned.

baseline

value of x[,column] to be used as the baseline for calculation of covariate effects; defaults to mean(x[,column]).

epsilon

step-size used in the finite difference calculation of the partial derivatives.

seg.len

length of effects line segments expressed as a fraction of the range of x[,column].

seg.cols

colors of effects line segments.

plot

if TRUE (the default) then an effects plots for the given model is produced.

return.results

if TRUE then values of effects and partial derivatives are returned.

trim

if plot=TRUE and parms is for a model with n.ensemble > 1, value of trim passed to censored.mean.

...

further arguments to be passed to plot.

Value

A list with elements:

effects

a matrix of covariate effects.

partials

a matrix of covariate partial derivatives.

References

Cannon, A.J. and I.G. McKendry, 2002. A graphical sensitivity analysis for interpreting statistical climate models: Application to Indian monsoon rainfall prediction by artificial neural networks and multiple linear regression models. International Journal of Climatology, 22:1687-1708.

Plate, T., J. Bert, J. Grace, and P. Band, 2000. Visualizing the function computed by a feedforward neural network. Neural Computation, 12(6): 1337-1354.

See Also

qrnn.fit, qrnn.predict

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## YVR precipitation data with seasonal cycle and NCEP/NCAR Reanalysis
## covariates
data(YVRprecip)

y <- YVRprecip$precip
x <- cbind(sin(2*pi*seq_along(y)/365.25),
           cos(2*pi*seq_along(y)/365.25),
           YVRprecip$ncep)

## Fit QRNN, additive QRNN (QADD), and quantile regression (QREG)
## models for the conditional 75th percentile
set.seed(1)
train <- c(TRUE, rep(FALSE, 49))
w.qrnn <- qrnn.fit(x=x[train,], y=y[train,,drop=FALSE],
                   n.hidden=2, tau=0.75, iter.max=500,
                   n.trials=1, lower=0, penalty=0.01)
w.qadd <- qrnn.fit(x=x[train,], y=y[train,,drop=FALSE],
                   n.hidden=ncol(x), tau=0.75, iter.max=250,
                   n.trials=1, lower=0, additive=TRUE)
w.qreg <- qrnn.fit(x=x[train,], y=y[train,,drop=FALSE],
                   tau=0.75, iter.max=100, n.trials=1,
                   lower=0, Th=linear, Th.prime=linear.prime)

## GAM-style plots for slp, sh700, and z500
for (column in 3:5) {
    gam.style(x[train,], parms=w.qrnn, column=column,
              main="QRNN")
    gam.style(x[train,], parms=w.qadd, column=column,
              main="QADD")
    gam.style(x[train,], parms=w.qreg, column=column,
              main="QREG")
}

qrnn documentation built on June 29, 2018, 5:04 p.m.