gm.coco {gmvalid} | R Documentation |
Selects one or more graphical models (depending on strategy) using the CoCo package. Different types of model selection are available. A base model can be optionally defined.
gm.coco(data, strategy = c("backwards", "forwards", "eh", "combined"), model = FALSE, eh.strategy = c("smallest", "alternating", "rough"), criterion = c("lr","aic","bic"),tests=FALSE, ...)
data |
Data frame or array. Variables need to be discrete and should have names. |
strategy |
Type of model selection. "backwards" eliminates not significant edges, starting from the saturated model as default
(backward ).
"forwards" adds significant edges, starting from the main effects model (forward ). The "eh" ("Edwards-Havranek")
model search rejects complete models in every step and finishes with one or more accepted models (eh ).
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" or "forwards".
For "eh" a character string specifies the base model for the statistical tests.
Since "eh" searches for models between a defined minimal and a maximal model, a string vector of length 2 is another option.
In this case a minimal and a maximal model is to be given.
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 .
|
eh.strategy |
See the strategy option of eh .
|
criterion |
Defines the strategy for edge selection: Likelihood-Ratio (default), AIC or BIC. Selection may be abbreviated. |
tests |
If TRUE, all accepted and rejected models are tested against each other. |
... |
Additional options for the selection procedure. See backward (forward) or eh . |
A list containing:
"accepted" |
String vector of the accepted model(s). |
"rejected" |
String vector of the rejected model(s). |
"base" |
Character string of base model the selection strategy starts with. |
"strategy" |
Character string indicating what type of selection strategy was performed. |
"tests" |
Matrix containing the test results of the accepted vs. the rejected models (available if at least one selected model is submodel of another one). Otherwise the accepted and rejected models are tested against the saturated model. |
"variable names" |
Matrix that assigns a letter to each variable used in the model formulae. |
CoCo may crash R occasionally on a bad day. We tried to prevent all crash causes for discrete data.
The R version of CoCo can only handle one CoCoObject.
You may run "endCoCo()" if you use CoCo also outside this package or the function aborts.
Criterion
equalling "bic" will work from CoCo version 0.1.7.5 on.
The EH-strategy is very time consuming. This depends on the number of variables, since the total number of possible models doubles with each additional variable.
Ronja Foraita, Fabian Sobotka
Bremen Institute for Prevention Research and Social Medicine
(BIPS) http://www.bips.uni-bremen.de
Badsberg JH (2001) A guide to CoCo. Journal of Statistical Software, 6(4).
data(wam) gm.coco(wam) ### giving many options to the strategy gm.coco(wam,criterion="b",recursive=TRUE,follow=TRUE,decomposable.mode=TRUE, coherent=TRUE) ### giving base gm.coco(wam,strategy="e",model=c("ab,cd","ae,be")) gm.coco(wam,strategy="f",model="abc,cd,de,f")