AddOnSearch: Search the optimal model region from a close-to-optimum model

Description Usage Arguments Value Examples

View source: R/AddOnSearch.R

Description

Given a close-to-optimum model, this function continuously searches the neighbour models to find the global optimum, through a complete search

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
AddOnSearch(merge.code, varia.list, model, transition.method,
  IncludeOrigin = FALSE)

## S3 method for class 'glm'
AddOnSearch(merge.code, varia.list, model, transition.method,
  IncludeOrigin = FALSE)

## S3 method for class 'rxGlm'
AddOnSearch(merge.code, varia.list, model,
  transition.method, IncludeOrigin = FALSE)

Arguments

merge.code

the given close-to-optimum graycode, list(code1, code2)

varia.list

a list of variables, c(.., .., ..)

model

the full model

transition.method

Transition method to change one graycode to its neighbouring graycode, choose from "ChangeOne", "GroupSplit". The default is "ChangeOne".

IncludeOrigin

Logical; When choose neighbouring graycode, should the input graycode be included or not.

Value

the optimal partitions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data("sweden")
m1 <- glm(Claims ~ Kilometres+Zone+Bonus+Make, offset = log(Insured),
          data = sweden, family = "poisson")

code1 <- c(1,2,2,3,3)
code2 <- c(1,2,3,4,5,2,6,7,8)
assign("addon.bic.trace", NULL, envir = environment(FCBMA))
assign("addon.code.trace", NULL, envir = environment(FCBMA))
AddOnSearch(merge.code = list(code1,code2),
            varia.list = c("Kilometres", "Make"),
            model = m1,
            transition.method = "ChangeOne")
get("addon.bic.trace", envir = environment(FCBMA))
get("addon.code.trace", envir = environment(FCBMA))

assign("addon.bic.trace", NULL, envir = environment(FCBMA))
assign("addon.code.trace", NULL, envir = environment(FCBMA))
AddOnSearch(merge.code = list(c(1,2,2,2,3)),
            varia.list = c("Kilometres"),
            model = m1,
            transition.method = "ChangeOne")
get("addon.bic.trace", envir = environment(FCBMA))
get("addon.code.trace", envir = environment(FCBMA))

senhu/FCBMA documentation built on Aug. 6, 2019, 4:56 p.m.