Learn R Programming

bfp (version 0.0-48)

posteriors: Extract posterior model probability estimates from BayesMfp objects

Description

Extract posterior model probability estimates (either normalized estimates or sampling frequencies) from BayesMfp objects.

Usage

posteriors(BayesMfpObject, ind = 1)

Value

The vector of probability estimates.

Arguments

BayesMfpObject

a valid BayesMfp object, containing the models the probabilites of which one wants to estimate

ind

ind = 1 means normalized posteriors, ind = 2 means sampling frequencies

Author

Daniel Saban\'es Bov\'e

Examples

Run this code
## construct a BayesMfp object
set.seed(19)
x1 <- rnorm (n=15)
x2 <- rbinom (n=15, size=20, prob=0.5) 
x3 <- rexp (n=15)
y <- rt (n=15, df=2)

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

## this works:
posteriors(test)


## only if we do model sampling there are model frequencies:
test2 <- BayesMfp (y ~ bfp (x1, max = 2) + bfp (x2, max = 2) + uc (x3), nModels = 100,
         method="sampling")
posteriors(test2, ind=2)

Run the code above in your browser using DataLab