findModel {bfp}R Documentation

Find a specific fractional polynomial model in a BayesMfp object

Description

Returns the index of the wished model if it is present in the model list, and otherwise returns NA.

Usage

findModel(model, BayesMfpObject)

Arguments

model

the specific model: a list with entries powers and ucTerms

BayesMfpObject

an object of class BayesMfp

Details

See BayesMfp for the description of a model.

Value

Index of model in BayesMfpObject if it is present in the model list, otherwise NA.

Note

The searched model must have exactly the same construction as the models in BayesMfpObject. See the example below for the recommended use.

Examples

## construct a BayesMfp object
set.seed(92)

x1 <- rnorm (15)
x2 <- rbinom (n=15, size=20, prob=0.6)
x3 <- rexp (15)
y <- rt (15, df=2)

test <- BayesMfp (y ~ bfp (x2, max = 4) + uc (x1 + x3), nModels=2000, method="exhaustive")

## copy one model 
myModel <- test[[1]]

## and modify it!
myModel$powers[["x2"]] <- c (1, 2)
stopifnot(identical(findModel (myModel, test),
                    31L))

[Package bfp version 0.0-48 Index]