plotCurveEstimate: Plot function value estimates

Description Usage Arguments Value Author(s) Examples

Description

Plot function value estimates

Usage

1
2
3
4
5
6
7
8
  plotCurveEstimate(covName, samples, modelData,
    nGrid = 200L, plevel = 0.95, slevel = plevel,
    partialResids = TRUE, hpd = TRUE,
    estimate = c("mean", "median"), plot = TRUE, ...,
    ylim = NULL, lty = c(1, 2, 2, 2, 2),
    col = c("black", "blue", "blue", "green", "green"),
    xlab = covName,
    ylab = paste("f(", covName, ")", sep = ""))

Arguments

covName

string with the name of the covariate

samples

the samples object (either from getSamples or the samples element from glmGetSamples)

modelData

the corresponding model data object

nGrid

number of abscissa values for the grid (default: 200)

plevel

credible level for the pointwise credible intervals (default: 0.95, and NULL suppresses it)

slevel

credible level for simultaneous credible band (defaults to plevel, and NULL suppresses it)

partialResids

add partial residuals to the plot? (default, is only possible for normal models)

hpd

use HPD intervals / bands? (default) Otherwise equi-tailed intervals / bands are computed and plotted.

plot

produce a plot? (default: yes) Otherwise you could use the returned information to produce the plot yourself

estimate

type of the estimated curve

ylim

y axis limits (has a sensible default to include all points in the plot)

lty

line type for (1) mean curve and (2, 3) credible interval bounds (default: c(1, 2, 2, 2, 2))

col

line color(s) (default: black, blue, blue, green, green)

xlab

x axis label (default: covName)

ylab

y axis label (default: f(covName) )

...

... additional plotting parameters

Value

A list with the elements x.grid and lineData, containing the x axis grid and the different y values for plotting, respectively.

Author(s)

Daniel Sabanes Bove daniel.sabanesbove@ifspm.uzh.ch

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
## get some data
attach(longley)

## get model data
md <- modelData(y=Employed,
                X=cbind(GNP, Armed.Forces),
                gPrior="hyper-g")

## get posterior samples for a specific model configuration
samples <- getSamples(config=c(2, 1),
                      nSamples=1000L,
                      modelData=md)
str(samples)
summary(samples$t)

## and plot resulting curve estimates:
par(mfrow=c(1, 2))

plotCurveEstimate(covName="GNP",
                  samples=samples,
                  modelData=md)

plotCurveEstimate(covName="Armed.Forces",
                  samples=samples,
                  modelData=md)

plotCurveEstimate(covName="Armed.Forces",
                  samples=samples,
                  modelData=md,
                  hpd=FALSE,
                  estimate="median")

hypergsplines documentation built on May 2, 2019, 6:14 p.m.