gm.boot.coco {gmvalid}R Documentation

Graphical model validation using the bootstrap (CoCo).

Description

Validates a discrete undirected graphical model using the bootstrap. To achieve that the CoCo package is used. Relative frequencies of the bootstrapped models, cliques or edges are counted.

Usage

gm.boot.coco(N, data, strategy = c("backwards", "forwards", "eh"),
            calculations = c("subgraph", "diff", "edge", "clique"),
            model = FALSE, ...)

Arguments

N Number of bootstrap replications.
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 default strategy is "backwards". Selections may be abbreviated.
calculations String vector specifying the analysis methods. "subgraph", "clique" and "edge" show the frequency of occurence in all selected models of the bootstrap samples, while "diff" counts the differences in the bootstrap replications compared to the edges selected from the original data set. The frequency of the selected models of all bootstrap samples are always calculated. By default all calculations are done. 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.
... Additional options to be given to the selection procedures. See backward (forward) or eh.

Details

This function uses a nonparametric bootstrap.
For your information about the advancements of the bootstrap, some run numbers will be displayed.

Value

A list containing:

"bootstrapped models" Relative frequency vector of selected models with model formulas as categories.
"bootstrapped subgraphs" Relative frequencies vector of subgraphs that equals cliques or parts of a clique. Returned if calculation "subgraph" is selected.
"bootstrapped cliques" Relative frequency vector of selected cliques. Returned if calculation "clique" is selected.
"bootstrapped edges" Matrix with relative frequencies of the edges. Returned if calculation "edge" is selected.
"original model" Character string giving the selected model using the original unsampled data. Returned if calculation "diff" is selected.
"differences from original data set" List with frequencies of more, less and different edges. Sorted by occurence. Returned if calculation "diff" is selected.
"variable names" Matrix that assigns a letter to each variable that is used in the model formulas.

Note

CoCo may crash R occasionally on a bad day. 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.
Running this function may take a while. A bootstrap with data of size 10.000 times 8 and 1.000 replications may take the computer about 2 minutes.

Author(s)

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

References

Efron B, Tibshirani RJ (1993) An Introduction to the Bootstrap. Chapman & Hall

Badsberg JH (2001) A guide to CoCo. Journal of Statistical Software, 6(4).

See Also

gm.boot.mim

Examples

  ### should provide good results because of simulated data
  gm <- gm.modelsim(2000,"ABC,CDE")
  gm.boot.coco(50,gm,recursive=TRUE)
  
  ### on real data sets a forward bootstrap seems to have better results
  data(wynder)
  gm.boot.coco(100,wynder,strategy="f",calculations=c("s","e"),decomposable.mode=TRUE)
  
  ### with a given model
  data(wam)
  gm.boot.coco(10,wam,model="ab,bcde,cdef")

[Package gmvalid version 1.0 Index]