BsProb {BsMD} | R Documentation |

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

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

`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 |

`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) |

`ng` |
integer <=20. Number of different variance inflation factors ( |

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

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.

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 |

`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 ( |

`INDG2` |
integer. If 1, the variance inflation factor |

`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 |

`sigtop` |
vector. Vector of sigma-squared of the top |

`nftop` |
integer. Number of factors in each of the |

`jtop` |
matrix. Matrix of the number of factors and their labels
of the top |

`del` |
numeric. Interval width of the |

`sprob` |
vector. Vector of posterior probabilities. If |

`pgam` |
vector. Vector of values of the unscaled posterior density of |

`prob` |
matrix. Matrix of marginal factor posterior probabilities for each of
the different values of |

`ind` |
integer. Indicator variable. |

The function is a wrapper to call the FORTRAN subroutine ‘bm’,
modification of Daniel Meyer's original program, ‘mbcqp5.f’, for the
application of Bayesian design and analysis of fractional factorial experiments,
part of the mdopt bundle, available at *StatLib*.

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

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.

`print.BsProb`

, `print.BsProb`

, `summary.BsProb`

.

```
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)
```

[Package *BsMD* version 2023.920 Index]