Learn R Programming

bfp (version 0.0-48)

findModel: 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)

Value

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

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.

Examples

Run this code
## 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))

Run the code above in your browser using DataLab