getFunctionSamples: Extract function values samples from posterior coefficients...

Description Usage Arguments Value Author(s) Examples

Description

Extract function values samples from posterior coefficients samples

Usage

1
  getFunctionSamples(x, covName, samples, modelData)

Arguments

x

the vector of abscissa values (on the original scale!)

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

Value

the function values samples as a matrix.

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
32
33
34
35
36
37
38
39
40
41
42
43
## get some data
attach(longley)

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

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

## and then get function samples:
res <- getFunctionSamples(x=
                          seq(from=min(GNP),
                              to=max(GNP),
                              length=100L),
                          covName="GNP",
                          samples=samples,
                          modelData=md)
str(res)


## get model data with cubic splines
md <- modelData(y=Employed,
                X=cbind(GNP, Armed.Forces),
                nKnots=10L,
                splineType="cubic")

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

## and then get function samples:
res <- getFunctionSamples(x=
                          seq(from=min(GNP),
                              to=max(GNP),
                              length=100L),
                          covName="GNP",
                          samples=samples,
                          modelData=md)
str(res)

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