getFitSamples: Extract fit samples on linear predictor scale from posterior...

Description Usage Arguments Value Author(s) Examples

Description

Extract fit samples on linear predictor scale from posterior coefficients samples

Usage

1
  getFitSamples(X, samples, modelData)

Arguments

X

the numeric matrix with new covariate values on the original scale, with the same column layout as originally provided to modelData or glmModelData.

samples

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

modelData

the corresponding model data object

Value

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

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

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

## and then get fit samples at the original X:
res <- getFitSamples(X=X,
                     samples=samples,
                     modelData=md)
str(res)

## this must also work for BMA samples:
tab <- exhaustive(modelData=md)$models
samples <- getBmaSamples(config=tab,
                         logPostProbs=tab$logMargLik,
                         nSamples=1000L,
                         modelData=md)
str(samples)
res <- getFitSamples(X=X,
                     samples=samples,
                     modelData=md)

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