postOptimize: Post-optimizing a good model

Description Usage Arguments Value Author(s) Examples

Description

After finding a good model, do an "optim" of the marginal likelihood with respect the smoothing parameters of the continuous variables, as a form of postprocessing.

Usage

1
2
  postOptimize(modelData, modelConfig,
    computation = getComputation())

Arguments

modelData

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

modelConfig

the model configuration

computation

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

Value

the optimized model configuration, which is non-integer for included continuous variables

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

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

## get a list of all possible models with this data
res <- exhaustive(md)$models

## now optimize the best model (best wrt to marg lik)
bestConfig <- res[which.max(res$logMargLik), 1:2]
bestConfig

optimConfig <- postOptimize(modelData=md,
                            modelConfig=bestConfig)
optimConfig


## now for binary response:

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

## and do the exhaustive search
res <- exhaustive(md,
                  computation=getComputation(higherOrderCorrection=FALSE))$models

## now optimize the best model (best wrt to marg lik)
bestConfig <- res[which.max(res$logMargLik), 1:2]
bestConfig

## todo!
## optimConfig <- postOptimize(modelData=md,
##                             modelConfig=bestConfig,
##                             computation=getComputation(higherOrderCorrection=FALSE))
## optimConfig

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