stochSearch: Stochastic search for models with high posterior probability

Description Usage Arguments Value Author(s) Examples

Description

Stochastic search for models with high posterior probability

Usage

1
2
3
4
5
6
  stochSearch(modelData,
    modelPrior = c("flat", "exponential", "independent", "dependent", "dep.linear"),
    startModel = rep(0, modelData$nCovs),
    chainlength = 100000L, nCache = chainlength,
    nModels = as.integer(max(nCache/100, 1)),
    computation = getComputation())

Arguments

modelData

the data necessary for model estimation, which is the result from modelData or glmModelData

modelPrior

either “flat” (default), “exponential”, “independent”, “dependent”, or “dep.linear”, see getLogModelPrior for details.

startModel

model configuration where the MCMC chain starts. Defaults to the null model. Checked for coherency with modelData.

chainlength

length of the model sampling chain (default: 100,000)

nCache

maximum number of best models to be cached at the same time during the model sampling (by default equal to chainlength)

nModels

how many best models should be saved? (default: 1% of the total number of nCache). Must not be larger than nCache.

computation

computation options produced by getComputation, only matters for generalised response models.

Value

a list with the data frame “models” comprising the model configurations, log marginal likelihoods / priors / posteriors and hits in the MCMC run, the inclusion probabilities matrix “inclusionProbs”, the number of total visited models “numVisited” and the log normalization constant “logNormConst”.

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
44
45
46
47
48
49
50
51
## get some data
attach(longley)

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

## do a stochastic search over the model space
res <- stochSearch(md)
res

## now the same, but with cubic splines:

## get large model data
md <- modelData(y=Employed,
                X=
                cbind(GNP,
                      Armed.Forces,
                      Population,
                      Year),
                splineType="cubic")

## do a stochastic search over the model space,
## and choose a special start model
res <- stochSearch(md,
                   startModel=c(2, 2, 2, 2))
res

## and now for generalised response:

## get the model data
md <- glmModelData(y=as.numeric(Employed > 64),
                   X=
                   cbind(GNP,
                         Armed.Forces,
                         Population,
                         Year),
                   family=binomial)

## do a stochastic search over the model space,
## also with a special start model
res <- stochSearch(md,
                   startModel=c(0, 1, 2, 1),
                   chainlength=1000L,
                   computation=
                   getComputation(higherOrderCorrection=FALSE))
res

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