Learn R Programming

bfp (version 0.0-48)

getDesignMatrix: Extract the design matrix of a multiple FP model.

Description

Extract the (centered) design matrix of the first element (== model) of a BayesMfp object. This is an internal function not intended to be used publicly.

Usage

getDesignMatrix(x, fixedColumns=TRUE, center=TRUE)

Value

The design matrix with an attribute shifts containing the used shifts for the optional centering of the non-intercept columns. (If

center is FALSE, the shifts vector will contain only zeroes.)

Arguments

x

a valid BayesMfp-Object of length 1 (otherwise only first element is recognized)

fixedColumns

return the fixed columns (intercept) inside the matrix (default) or not?

center

shall the non-intercept columns be centered? (default)

Author

Daniel Saban\'es Bov\'e

See Also

getFpTransforms

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 (x2, max = 4) + uc (x1 + x3), nModels = 200, method="exhaustive")

## get the design matrix of the fifth best model
a <- bfp:::getDesignMatrix(test[5])
attr(a, "shifts")

## and once again but without centering
b <- bfp:::getDesignMatrix(test[5], center=FALSE)
stopifnot(all(attr(b, "shifts") == 0))

Run the code above in your browser using DataLab