gm.mim {gmvalid}R Documentation

Graphical model selection (MIM)

Description

Selects one or more graphical models (depending on strategy) using the program MIM. Different types of model selection are available. A base model can be optionally defined.

Usage

gm.mim(data, strategy = c("backwards", "forwards", "eh", "combined"),
        model = FALSE, chain = FALSE, options = "", tests = FALSE)

Arguments

data Data frame or a table (array). Variables should have names. data has to be discrete.
strategy Type of model selection. "backwards" searches for not significant edges to delete, starting from the saturated model as default. "forwards" adds significant edges, starting from the main effects model. The "Edwards-Havranek" model search rejects complete models in every step and finishes with one or more accepted models. The "combined" strategy is a 3 step procedure: gm.screening, "backwards" and then "forwards". The default strategy is "backwards". Selections may be abbreviated.
model Character string specifying a start model for "backwards" and "forwards" selection procedure. For the "eh" procedure a minimal and a maximal model has to be assigned in one string connected with a " - " (see Example). The model formulae has to start with the first lowercase letters of the alphabet, e.g. "abc,cde". Variable names cannot be given. For "combined" the model cannot be given, a start model will be specified by gm.screening.
chain Character string to specify the block structure of directed graphical models. The syntax is "vs1|vs2|vs3" where vs1,vs2,vs3 are sets of variables and the variables in vs1 are prior to those in vs2 etc. The formula has to be given with the first lowercase letters of the alphabet, e.g. "a|bc|d". Variable names cannot be given. For more information search the MIM help for "block overview". Does not work with "combined" selection strategy.
options Character string specifying further options for the search strategy. Possible options can be found in the MIM help when searching for "stepwise" (backwards, forwards) or "startsearch" (eh). See details.
tests If true all accepted and rejected models are tested against the saturated model and p-values to all edges are returned.

Details

MIM options for stepwise procedures (backwards, forwards):
"A" - uses the AIC as selection criterion
"B" - uses the BIC as selection criterion
"J" - joggles between backward and forward
"N" - non coherent mode
"U" - unrestricted, allows for non-decomposable models;

MIM options for the eh modelsearch:
(positive number) - maximum number of models fitted
white space
(letters) - "U" for upward search, "D" for downward, default is alternating.

Value

A list containing:

"accepted" String vector of the accepted model(s).
"rejected" String vector of the rejected model(s).
"base" Character string with the base model the selection started with. NA for "eh".
"strategy" Character string indicating what type of selection strategy was performed.
"tests against saturated" Matrix giving the test results of the accepted and the rejected models against the saturated model. Only returned if tests is TRUE.
"p values" Upper-tri matrix with p-values of those edges in the accepted models. NA if edge is misseing. Only returned if tests is TRUE.
"variable names" Matrix that assigns a letter to each variable that is used in the model formulas.

Note

The function requires the MIM program. Make sure that it is running before using the function. The package mimR will only work properly if your R working directory path does not contain hyphens ("-"). For mimR requirements we refer to the package's help page mimR and its homepage http://gbi.agrsci.dk/~shd/public/mimR/index.html. mimR needs the Rgraphviz package. Therefore you will have to add "Bioconductor" to your R repositories.

The time the EH-strategy needs depends on the number of variables. The total number of possible models doubles with each additional variable. Also different data sets of the same size may take a lot different amount of time. We recommend the EH strategy up to 8 variables.

Author(s)

Ronja Foraita, Fabian Sobotka
Bremen Institute for Prevention Research and Social Medicine
(BIPS) http://www.bips.uni-bremen.de

References

Edwards D (2000) An Introduction to Graphical Modelling. Second Edition, Springer Verlag.

See Also

gm.coco

Examples

  ### Examples work!
## Not run: 
  data(wam)
  gm.mim(wam)
  ### giving strategy
  gm.mim(wam,strategy="e")
  
  ### giving minimal and maximal model
  gm.mim(wam,strategy="e",model="a,bc,de,f - abcd,cdef")
  ### giving block structure
  gm.mim(wam,strategy="f",model="a,b,c|abc,de|abcd,ef",chain="abc|de|f",options="BNU")
  
## End(Not run)

[Package gmvalid version 1.1 Index]