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 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
(backward ).
"forwards" adds significant edges, starting from the main effects model (forward ). The "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" and "forwards" selection procedure.
For "eh" a character string would specify the base model for 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 |
Sets the basis for edge selection in the strategy: 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 to be given to the selection procedures. 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 giving the base model the selection started 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 of the models 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 formulas. |
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.
Changing the option eh.strategy
does not seem to have an effect on the model selection,
neither does it seem to make a difference between criterion
equaling "aic" and "bic".
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")