Learn R Programming

BsMD (version 2023.920)

BsProb: Posterior Probabilities from Bayesian Screening Experiments

Description

Marginal factor posterior probabilities and model posterior probabilities from designed screening experiments are calculated according to Box and Meyer's Bayesian procedure.

Usage

BsProb(X, y, blk, mFac, mInt = 2, p = 0.25, g = 2, ng = 1, nMod = 10)

Value

A list with all output parameters of the FORTRAN subroutine bm. The names of the list components are such that they match the original FORTRAN

code. Small letters used for capturing program's output.

X

matrix. The design matrix.

Y

vector. The response vector.

N

integer. The number of runs.

COLS

integer. The number of design factors.

BLKS

integer. The number of blocking factors accommodated in the first columns of matrix X.

MXFAC

integer. Maximum number of factors considered in the models.

MXINT

integer. Maximum interaction order considered in the models.

PI

numeric. Prior probability assigned to the active factors.

INDGAM

integer. If 0, the same variance inflation factor (GAMMA) is used for main and interactions effects. If INDGAM ==1, then NGAM different values of GAMMA were used.

INDG2

integer. If 1, the variance inflation factor GAM2 was used for the interaction effects.

NGAM

integer. Number of different VIFs used for computations.

GAMMA

vector. Vector of variance inflation factors of length 1 or 2.

NTOP

integer. Number of models with the highest posterior probability

.

mdcnt

integer. Total number of models evaluated.

ptop

vector. Vector of probabilities of the top ntop models.

sigtop

vector. Vector of sigma-squared of the top ntop models.

nftop

integer. Number of factors in each of the ntop models.

jtop

matrix. Matrix of the number of factors and their labels of the top ntop models.

del

numeric. Interval width of the GAMMA partition.

sprob

vector. Vector of posterior probabilities. If ng>1 the probabilities are weighted averaged over GAMMA.

pgam

vector. Vector of values of the unscaled posterior density of GAMMA.

prob

matrix. Matrix of marginal factor posterior probabilities for each of the different values of GAMMA.

ind

integer. Indicator variable. ind is 1 if the bm subroutine exited properly. Any other number correspond to the format label number in the FORTRAN subroutine script.

Arguments

X

Matrix. The design matrix.

y

vector. The response vector.

blk

integer. Number of blocking factors (>=0). These factors are accommodated in the first columns of matrix X. There are ncol(X)-blk design factors.

mFac

integer. Maximum number of factors included in the models.

mInt

integer <= 3. Maximum order of interactions considered in the models.

p

numeric. Prior probability assigned to active factors.

g

vector. Variance inflation factor(s) \(\gamma\)associated to active and interaction factors.

ng

integer <=20. Number of different variance inflation factors (g) used in calculations.

nMod

integer <=100. Number of models to keep with the highest posterior probability.

Author

R. Daniel Meyer. Adapted for R by Ernesto Barrios.

Details

Factor and model posterior probabilities are computed by Box and Meyer's Bayesian procedure. The design factors are accommodated in the matrix X after blk columns of the blocking factors. So, ncol(X)-blk design factors are considered. If g, the variance inflation factor (VIF) \(\gamma\), is a vector of length 1, the same VIF is used for factor main effects and interactions. If the length of g is 2 and ng is 1, g[1] is used for factor main effects and g[2] for the interaction effects. If ng greater than 1, then ng values of VIFs between g[1] and g[2] are used for calculations with the same \(gamma\) value for main effects and interactions. The function calls the FORTRAN subroutine bm and captures summary results. The complete output of the FORTRAN code is save in the BsPrint.out file in the working directory. The output is a list of class BsProb for which print, plot and summary methods are available.

References

Box, G. E. P and R. D. Meyer (1986). "An Analysis for Unreplicated Fractional Factorials". Technometrics. Vol. 28. No. 1. pp. 11--18.

Box, G. E. P and R. D. Meyer (1993). "Finding the Active Factors in Fractionated Screening Experiments". Journal of Quality Technology. Vol. 25. No. 2. pp. 94--105.

See Also

print.BsProb, print.BsProb, summary.BsProb.

Examples

Run this code
library(BsMD)
data(BM86.data,package="BsMD")
X <- as.matrix(BM86.data[,1:15])
y <- BM86.data["y1"]
# Using prior probability of p = 0.20, and k = 10 (gamma = 2.49)
drillAdvance.BsProb <- BsProb(X = X, y = y, blk = 0, mFac = 15, mInt = 1,
            p = 0.20, g = 2.49, ng = 1, nMod = 10)
plot(drillAdvance.BsProb)
summary(drillAdvance.BsProb)

# Using prior probability of p = 0.20, and a 5 <= k <= 15 (1.22 <= gamma <= 3.74)
drillAdvance.BsProbG <- BsProb(X = X, y = y, blk = 0, mFac = 15, mInt = 1,
            p = 0.25, g = c(1.22, 3.74), ng = 3, nMod = 10)
plot(drillAdvance.BsProbG, code = FALSE, prt = TRUE)

Run the code above in your browser using DataLab