Description Usage Arguments Value Note Examples
This function use FC-BMA method to refit linear or generalized linear models, method chosen from complete exhaustive search, Simulated Annealing (SA), Generic Algorithm (GA).
1 2 3 4 5 6 | FCBMA(model, varia.list, method = "complete",
transition.method = "ChangeOne", IncludeOrigin = FALSE,
AddOnSearch = FALSE, group = NULL, apart = NULL,
control.SA = list(init.Temp = 10000, stop.Temp = 1e-05, coolingRate =
0.7, Mtrial = 20), control.GA = list(popnSize = 20, CrossOverRate =
0.8, MutationRate = 0.1, elitism = 0.1, MaxGen = 200), verbose = TRUE)
|
model |
The model used for factor collapsing. |
varia.list |
Vector of variables to be collapsed. |
method |
Search method to use, choose from |
transition.method |
Transition method to change one graycode to its neighbouring graycode, choose from |
IncludeOrigin |
Logical; When choose neighbouring graycode, should the input graycode be included or not. |
AddOnSearch |
Logical; used when |
group |
A (list of) vector indicating which elements must be grouped together, the default is |
apart |
A (list of) vector indicating which elements must not be grouped together, the default is |
control.SA |
A list of control parameters for SA.
|
control.GA |
A list of control parameters for GA.
|
verbose |
Logical argument controlling whether progress will be printed while the search runs. Default is |
A list with the elements
The best value of BIC.
The best partitions for all stated variables.
All the searched BIC values.
All the searched (combinations of) partitions, in graycode.
All the searched (combinations of) partitions
All the BMA weights of searched partitions.
A summary table of best few BICs, partitions, BMA weights.
Accepted BIC values along SA search; only when method="SA"
.
Accepted (combinations of) partitions along SA search; only when method="SA"
.
Trace of best BIC values along GA search; only when method="GA"
.
The best BIC value found through the add-on greedy search, if AddOnSearch=TRUE
.
The best (combination of) partition found through the add-on greedy search, if AddOnSearch=TRUE
.
The best BIC values found in each iteration through the add-on greedy search, if AddOnSearch=TRUE
.
The best (combination of) partitions found in each iteration through the add-on greedy search, if AddOnSearch=TRUE
.
This version of stochastic search changes on the simulated annealing part. It changed the stochastic search method at each iteration, only one variable is picked and change to one of its neighbours the probability of being picked is based on the number of levels You also have the option of which method to select a neighbour of a graycode
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | data("sweden")
m1 <- glm(Claims ~ Kilometres+Zone+Bonus+Make, offset = log(Insured),
data = sweden, family = "poisson")
summary(m1)
# complete search
m2 <- FCBMA(model = m1,
varia.list = c("Kilometres"),
method = "complete",
verbose = FALSE)
# SA search
m3 <- FCBMA(model = m1,
varia.list = c("Kilometres","Make"),
method = "SA",
transition.method = "ChangeOne",
AddOnSearch = TRUE,
control.SA = list(init.Temp = 1000,
coolingRate = 0.6,
stop.Temp = 1e-5,
Mtrial = 20),
verbose = TRUE)
m3$best.state
m3$best.bic
# GA search
m4 <- FCBMA(model=m1,
varia.list = c("Kilometres", "Make"),
method = "GA",
transition.method = "ChangeOne",
AddOnSearch= TRUE,
control.GA = list(popnSize=20,
CrossOverRate=0.8,
MutationRate=0.1,
elitism=0.1,
MaxGen=100),
verbose = TRUE)
m4$best.state
m4$best.bic
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.