178
The CoCo Package October 15, 2007 Contains CoCoGraph CoCoObjects CoCoCore CoCoOldData CoCoRaw CoCo CoCoCg Version 0.1.7.3 Date 14.10.2007 Title Graphical modelling by CoCo Author Jens Henrik Badsberg <[email protected]> Maintainer Jens Henrik Badsberg <[email protected]> Depends R (>= 2.0.0), dynamicGraph (>= 0.2.0) License Copyright (C) by Jens Henrik Badsberg, non-profit use and redistribution permitted (see COPYING for details) URL http://www.badsberg.eu Address Andreas Bjorns Gade 21, 2. tv, 1428 Kobenhavn K, Denmark

The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

The CoCo PackageOctober 15, 2007

Contains CoCoGraph CoCoObjects CoCoCore CoCoOldData CoCoRaw CoCo CoCoCg

Version 0.1.7.3

Date 14.10.2007

Title Graphical modelling by CoCo

Author Jens Henrik Badsberg <[email protected]>

Maintainer Jens Henrik Badsberg <[email protected]>

Depends R (>= 2.0.0), dynamicGraph (>= 0.2.0)

License Copyright (C) by Jens Henrik Badsberg, non-profit use and redistribution permitted (seeCOPYING for details)

URL http://www.badsberg.eu

Address Andreas Bjorns Gade 21, 2. tv, 1428 Kobenhavn K, Denmark

Page 2: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Contents

Package ‘CoCoGraph’ 1CoCoGraph-internal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1CoCoTestClass-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Package ‘CoCoObjects’ 3CoCoClass-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3CoCoIdClass-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4CoCoModelClass-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5CoCoObjects-internal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6clearCoCoObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6currentCoCo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7makeModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8recover.coco.model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Package ‘CoCoCore’ 11CoCoCore-internal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11call.coco . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11call.coco.chars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13call.coco.simple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14coco.enter.all . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15coco.init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16coco.load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18coco.simple.model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19coco.start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20is.gc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22is.number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23make.coco . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24make.model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25my.assign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26my.not.a.number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27ok.coco . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

Package ‘CoCoOldData’ 29CoCoOldData-internal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29cutpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29read.data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30read.q.table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

i

Page 3: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

ii CONTENTS

redefine.factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32reject.cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33set.data.file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34set.output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35skip.missing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35source.coco . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

Package ‘CoCoRaw’ 39CoCoRaw-internal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39backward . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39cleanData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43disposeOfEh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43disposeOfModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45disposeOfQtable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46editModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47eh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49ehExtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50ehFindDual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52ehFit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53ehForceAccept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54ehForceAddDualToClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55ehForceFix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56ehSetBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57ehSetMainEffects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58emOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59endCoCo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60enterDataFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61enterList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62enterModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63enterNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66enterQtable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67enterTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68excludeMissing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70exportCoCo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71extractData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73isSubmodel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74makeCurrent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76numberVariates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79optionsCoCo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81partialAssociations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85propertyModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88propertySet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90randomTableReplacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92returnDeviance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93returnEdges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94returnExpression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97returnFix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101returnJunctionTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102returnModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

Page 4: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

CONTENTS iii

returnModelNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107returnModelVariates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108returnNcells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109returnSets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111returnTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116returnTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118returnVariableDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120returnVertexOrder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122setOrdinal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127setUseVariables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128showDeviance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129showFormula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131showModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132showOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135showTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136showTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140showTests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142showVertexOrder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143sinkCoCo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145summaryTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

Package ‘CoCo’ 149Byssinosis38 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149CoCo-internal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150CoCo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150Dawid79 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151Fever . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152Fuchs82 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153Hochberg77 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154Reinis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155Scrotal94 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156UterineCervix411 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157makeCoCo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Package ‘CoCoCg’ 159CoCoCg-internal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159CoCoCg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159Rats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160fev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161makeCoCoCg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

Index 165

Page 5: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

iv CONTENTS

Page 6: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Package ‘CoCoGraph’

Namespace CoCoGraph

Title Graphs for CoCo objects

Description Interface between dynamicGraph and CoCo (objects)

Depends R (>= 2.0.0), CoCoObjects, dynamicGraph (>= 0.2.0), CoCo, MASS

LazyLoad False

CoCoGraph-internal Internal CoCoGraph objects

Description

Internal CoCoGraph objects.

Details

These are not to be called by the user. The functions for CoCo are found in the package "CoCoRaw"(and "CoCoObjects"). Datasets are found in the package "CoCo" and "CoCoCg".

Note

For help on dg, modifyModel, and testEdge use help(dg, package = "dynamicGraph"),help(modifyModel, package = "dynamicGraph"), and help(testEdge, package= "dynamicGraph").

1

Page 7: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

2 CoCoTestClass-class

CoCoTestClass-classClass "CoCoTestClass"

Description

Objects from the Class

Objects can be created by calls of the form new("CoCoTestClass", ...).

Slots

deviance: Object of class "numeric"

df: Object of class "numeric"

p: Object of class "numeric"

Methods

label signature(object = "CoCoTestClass"): The label of the test for edges.

width signature(object = "CoCoTestClass"): The width of the test for edges.

setSlots signature(object = "CoCoTestClass"): ...

initialize signature(object = "CoCoTestClass"): ...

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

makeCoCo.

Page 8: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Package ‘CoCoObjects’

Namespace CoCoObjects

Title Objects for CoCo

Description Objects for the interface from R and Splus to CoCo.

Depends R (>= 2.0.0), methods

LazyLoad False

CoCoClass-class Class "CoCoClass"

Description

The functions for the CoCo objects are found in the package "CoCoRaw". Datasets are found in thepackage "CoCo" and "CoCoCg".

Objects from the Class

Objects can be created by calls of the form new("CoCoClass", ...). Objects from tha classis returned by makeCoCo and makeCoCoCg.

Slots

.parameters: Object of class "list" with the parameters for creating the CoCo object, thearguemnts of coco.init.

.invalid: Object of class "list" with the not recoverable values of the object, the argumentsof set.data.file, set.observations.file, set.specification.file, read.data,read.specification, read.names, read.factors, reject.cases, select.cases,or.reject.cases, or.select.cases, redefine.factor, cutpoints, skip.missing,read.observations, read.table.coco, read.list, read.q.list, read.q.table,cleanData, and randomTableReplacement (if setslot is TRUE).

.specification: Object of class "list" with the values of the specification of the object,the arguments of enterNames and importCoCo if setslot is TRUE.

.medio: Object of class "list" with the values of the medio of the object, the arguments ofsetUseVariables if setslot is TRUE.

3

Page 9: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

4 CoCoIdClass-class

.observations: Object of class "list" with the values of the observations of the object, thearguments of enterTable, enterList, enterDataFrame, and enterTwoList ifsetslot is TRUE.

.structure: Object of class "list" with the values of the structure of the object, the argu-ments of setOrdinal, ExcludeMissing, emOn, enterQtable and enterQlist ifsetslot is TRUE.

.reference: Object of class "numeric" with the reference of the object: a pointer to thememory.

.key: Object of class "character" with the key of the object.

.id.env: Object of class "character", with an other identification of the object.

.type: Object of class "numeric" with the type, 1 for CoCo objects, 2 for CoCoCg objects, ofthe object.

.title: Object of class "character" with the title of the object.

Extends

Class "CoCoIdClass", directly.

Methods

No methods defined with class "CoCoClass" in the signature.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

CoCoIdClass-class, CoCoModelClass-class, coco.init, or GraphLatticeProto-class.

CoCoIdClass-class Class "CoCoIdClass"

Description

The functions for the CoCo objects are found in the package "CoCoRaw". Datasets are found in thepackage "CoCo" and "CoCoCg".

Objects from the Class

Objects can be created by calls of the form new("CoCoIdClass", ...).

Page 10: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

CoCoModelClass-class 5

Slots

.reference: Object of class "numeric", see CoCoClass-class.

.id.env: Object of class "character", see CoCoClass-class.

.key: Object of class "character", see CoCoClass-class.

.type: Object of class "numeric", see CoCoClass-class.

.title: Object of class "character", see CoCoClass-class.

Methods

No methods defined with class "CoCoIdClass" in the signature.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

CoCoClass-class, CoCoModelClass-class, coco.init, or GraphLatticeProto-class.

CoCoModelClass-classClass "CoCoModelClass"

Description

The functions for the CoCo objects are found in the package "CoCoRaw". Datasets are found in thepackage "CoCo" and "CoCoCg".

Objects from the Class

Objects can be created by calls of the form new("CoCoModelClass", ...). Objects fromtha class is returned by makeModel.

Slots

.model: Object of class "character" with the generating class(es) of the model.

.model.number: Object of class "numeric" with the model number of the model.

.reference: Object of class "numeric", see CoCoClass-class.

.id.env: Object of class "character", see CoCoClass-class.

.key: Object of class "character", see CoCoClass-class.

.type: Object of class "numeric", see CoCoClass-class.

.title: Object of class "character", see CoCoClass-class.

Page 11: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

6 clearCoCoObjects

Extends

Class "CoCoIdClass", directly.

Methods

No methods defined with class "CoCoModelClass" in the signature.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

CoCoClass-class, CoCoIdClass-class, coco.init, or GraphLatticeProto-class.

CoCoObjects-internalInternal CoCoObjects objects

Description

Internal CoCoObjects objects.

Details

These are not to be called by the user. The functions for the CoCo objects are found in the package"CoCoRaw". Datasets are found in the package "CoCo" and "CoCoCg".

clearCoCoObjects Clear CoCo object

Description

Clear CoCo objects.

Usage

clearCoCoObjects(coco.object = NULL, silent = FALSE, pos = .GlobalEnv,printWarnings = FALSE)

Page 12: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

currentCoCo 7

Arguments

coco.object See endCoCo.

pos The envirinment of the CoCo object.

silent Logical.printWarnings

Logical.

Author(s)

Jens Henrik Badsberg

currentCoCo Make CoCo object to default CoCo object

Description

Mark a CoCo object as .current.coco, default CoCo object for the CoCo functions.

Usage

currentCoCo(object = .current.coco)

makeCurrentCoCo(object.number)

Arguments

object See endCoCo.object.number

Numeric, the number of the CoCo object.

Details

The a-te row of .coco.identifications is assigned to .current.coco in .GlobalEnvby makeCurrentCoCo.

A CoCo, a CoCoCg, and a model CoCo model object is accepted as the argument object tocurrentCoCo.

Value

TRUE

Author(s)

Jens Henrik Badsberg

Page 13: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

8 makeModel

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

currentCoCo.

Examples

library(CoCo);data(Reinis);CoCoReinisObject <- makeCoCo();enterTable(Reinis, object = CoCoReinisObject);fullReinisModel <- makeModel(enterModel("*", object = CoCoReinisObject));

library(CoCoCg);data(Rats);CoCoRatsObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoRatsObject);fullRatsModel <- makeModel(enterModel("*", object = CoCoRatsObject));

showModel();showModel(fullReinisModel);makeCurrentCoCo(1);showModel();

endCoCo(object = CoCoReinisObject);

makeCurrentCoCo(2);endCoCo(object = CoCoRatsObject);

makeModel Make a CoCo model object

Description

Make a CoCo model object.

Usage

makeModel(model = FALSE, title = "", push.pop = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See returnModel.

title A charater string with the title of the object.

Page 14: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

recover.coco.model 9

push.pop Logical, if push.pop is TRUE, the model argument is numeric and the objectargument is a CoCoCg object then model pointers are restored by less calls ofCoCoCg. See also returnModelNumber and makeCurrent.

data See exportCoCo.object See exportCoCo.... Additional arguments to generate the CoCo object from the data argument.

See propertyModel.

Value

Object of class CoCoModelClass-class.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

makeCoCo.

recover.coco.model Recover a CoCo model object

Description

Recover a CoCo model object.

Usage

recover.coco.model(coco.model.object, key = .return.key(coco.model.object),model = .return.model.of.object(coco.model.object),level = 90000, pos = .GlobalEnv,new.id = NULL, new.no = NULL)

Argumentscoco.model.object

Object of class CoCoModelClass-class.key The key of the object.model The model of the object.level Numeric for depth of call.pos .GlobalEnv.new.id Numeric, the new ideintification of the CoCo object.new.no Numeric, the new model number.

Page 15: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

10 recover.coco.model

Author(s)

Jens Henrik Badsberg

See Also

makeCoCo.

Page 16: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Package ‘CoCoCore’

Namespace CoCoCore

Title Lower level API to CoCo (should not be called by user)

Description The shared library of CoCo, with the interface function “call.coco” for calling CoCo, andsome lower level extensions.

Depends R (>= 2.0.0)

CoCoCore-internal Internal CoCoCore objects

Description

Internal CoCoCore objects. This package contains the shared library of CoCo, with the interfacefunction "call.coco" for calling CoCo from R and Splus, some extensions and specializations to thisfunction and some auxiliary functions of the interface to CoCo.

Details

The functions of this package are not to be called directly by the user. Please use the functions of thepackage "CoCoRaw" (and "CoCoObjects" and "CoCoGraph"). Datasets are found in the package"CoCo" and "CoCoCg".

call.coco Call CoCo

Description

Internal CoCoCore functions: The single interface function to CoCo.

11

Page 17: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

12 call.coco

Usage

call.coco(code, sub.code = 0,arg.char = "", arg.long = NULL, arg.double = NULL,object = .current.coco, char.ok = FALSE, type = NULL)

call.coco.message(code, sub.code = 0,arg.char = "", arg.long = NULL, arg.double = NULL,object = .current.coco)

Arguments

code Numeric, between 1 and 255.

sub.code Numeric.

arg.char A character string. The argument arg.char should be long enough for re-turned values.

arg.long A vector of integers. The argument arg.long should be long enough forreturned values.

arg.double A vector of reals. The argument arg.double should be long enough for re-turned values.

object See endCoCo.

char.ok Logical, if char.ok then R should be able to call CoCo with strings.

type Integer, type is 1 for CoCo objects, 2 for CoCoCg objects.

Details

These functions are not to be called by the user.

Note

call.coco is called in call.coco.chars, call.coco.longs, call.coco.message,call.coco.reals, call.coco.simple, coco.enter.all, coco.init, coco.replace.all,coco.resume, coco.simple.command, coco.string.double, coco.string.model,endCoCo, cutpoints, .enter.double.list, .plotCoCo, .set.switch, editModel,enterNames, enterQlist, enterQtable, enterTwoLists, isSubmodel, propertyModel,propertySet, returnDeviance, returnEdges, returnNcells, returnTable, returnTest,showTable, and summaryTable.

call.coco.message is called in cutpoints, or.reject.cases, or.select.cases,redefine.factor, reject.cases, select.cases, .enter.n.interactions, andenterModel.

Author(s)

Jens Henrik Badsberg

Page 18: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

call.coco.chars 13

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

coco.init.

call.coco.chars Call Coco with only code, subcode, and one argument

Description

Internal CoCoCore functions: Call Coco with only code, subcode, and one argument.

Usage

coco.enter.string(code, argument = FALSE, sub.code = FALSE, length = 128,no.warnings = NULL, object = .current.coco)

call.coco.chars(code, argument = FALSE, sub.code = FALSE, length = 128,no.warnings = NULL, object = .current.coco)

call.coco.longs(code, argument = FALSE, length = 0, sub.code = FALSE,no.warnings = NULL, object = .current.coco)

call.coco.reals(code, argument = FALSE, length = 0, sub.code = FALSE,no.warnings = NULL, object = .current.coco)

Arguments

code Numeric, between 1 and 255.

argument The argument a charater string, a vector of integers or a vector of reals.

length Numeric, the length of the argument.

sub.code Numeric.

no.warnings Logical, if no.warnings is TRUE then no warnings are given from ok.coco.

object See endCoCo.

Details

These functions are not to be called by the user.

Page 19: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

14 call.coco.simple

Note

coco.enter.string calls call.coco.chars and returns same result.

coco.enter.string is called in .return.name.list.string, coco.string.double,coco.string.model, read.q.list, read.q.table, .eh.enter.base.model, .fix.edges,disposeOfQtable, ehFit, ehForceAccept, ehForceFix, ehForceReject, ehSetBase,ehSetMainEffects, enterModel, partialAssociations, returnModel, returnModelVariates,returnSets, showTable.

call.coco.chars, is called in coco.enter.string, set.data.file, set.observations.file,set.output, set.specification.file, source.coco, excludeMissing, exportCoCo,importCoCo, optionsCoCo, setOrdinal, setUseVariables, showTable, sinkCoCo.

call.coco.longs, is called in .return.factor.type.list, .return.level.list,.return.missing.list, .set.em.initial, .set.em.max.iterations, .set.ips.max.iterations,.set.list.of.number.of.tables, .set.number.of.tables, .set.page.formats,.set.paging.length, .set.print.formats, .set.seed.coco, .set.table.formats,.set.test.formats, enterList, enterTable, makeBase, makeCurrent, numberVariates,optionsCoCo, returnModelNumber, returnModelVariates.

call.coco.reals is called in .set.acceptance, .set.rejection, .set.components,.set.separators, .set.asymptotic, .set.em.epsilon, .set.exact.epsilon,.set.ips.epsilon, .set.power.lambda, .set.ic, optionsCoCo.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

call.coco.

call.coco.simple Call Coco with only code and subcode

Description

Internal CoCoCore function: Call Coco with only code and subcode.

Usage

call.coco.simple(code, sub.code = FALSE, object = .current.coco)

coco.simple.command(code, sub.code = FALSE, object = .current.coco)

Page 20: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

coco.enter.all 15

Arguments

code Numeric, between 1 and 255.

sub.code Numeric.

object See endCoCo.

Details

This function is not to be called by the user.

Note

call.coco.simple is called in .set.test, .set.datastructure, optionsCoCo.

coco.simple.command is called in .visit.interval, .visit.model, .visit.models,coco.simple.double, coco.simple.model, read.data, read.factors, read.list,read.names, read.observations, read.specification, read.table.coco, skip.missing,backward, cleanData, .base, .clean.up, .current, .omit.test, disposeOfEh,ehExtract, ehFindDual, ehFit, ehForceAddDualToClass, eh, ehSetBase, emOn,excludeMissing, forward, randomTableReplacement, setUseVariables, showOptions,showTests.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

call.coco.

coco.enter.all Call CoCo with all arguemnts

Description

Internal CoCoCore functions: Call Coco with all arguments.

Usage

coco.enter.all(code, string, long, double,sub.code = FALSE, object = .current.coco)

coco.replace.all(code, string = "", long = NULL, double = NULL,sub.code = FALSE, object = .current.coco)

Page 21: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

16 coco.init

Arguments

code Numeric, between 1 and 255.

sub.code Numeric.

string A charater string. The argument arg.char should be long enough for returnedvalues.

long A vector of integers. The argument arg.long should be long enough forreturned values.

double A vector of reals. The argument arg.double should be long enough for re-turned values.

object See endCoCo.

Details

These functions are not to be called by the user.

Note

coco.enter.all is called in .return.complex, optionsCoCo, returnVertexOrder.

coco.replace.all is called in optionsCoCo, returnSets, returnTable.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

call.coco.

coco.init Init a CoCo object.

Description

Internal CoCoCore function: Malloc the internal space for the CoCo object.

Usage

coco.init(n = 131072, p = 65536, q = 1024,r = 65536, s = 65536, ss = 65536, t = 65536,init = TRUE, title = NULL, type = 1, silent = FALSE,location = c(700, 550), manager = TRUE, sh.lib.name = NULL)

Page 22: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

coco.init 17

Arguments

n Integer, sets the size of the N-array: The array for observed table and marginaltables in pure discrete models.

p Integer, sets the size of the P-array: Estimated marginal tables in pure discretemodels.

q Integer, sets the size of the Q-array: For Q-tables.

r Integer, sets the size of the R-array: For observed canonical parameters (g, h andK) in CoCoCg objects.

s Integer, sets the size of the S-array: For observed moment parameters (meansand covariances) in CoCoCg objects.

ss Integer, sets the size of the Ss-array: For observed moment parameters (meansand square sums) in CoCoCg objects.

t Integer, sets the size of the T-array: For estimated canonical parameters (g, hand K) and temporary space in CoCoCg objects.

init Logical, init should be TRUE, else CoCo is "started", and CoCo commandsare expected from standard input.

title A character string for the title of the CoCo object.

type 1 for CoCo objects and 2 for CoCoCg objects.

silent Logical: if silent is TRUE then CoCo is more silent.

location Numeric: location is currently not used in R.

manager Logical: manager is currently not used in R.

sh.lib.name See coco.load.

Details

This function is no longer to be called by the user.

Value

NULL

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

coco.load.

Page 23: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

18 coco.load

coco.load Load CoCo

Description

Internal CoCoCore function: Load the dynamic linked or shared library with CoCo, and assignnecessary variables in .GlobalEnv.

Usage

coco.load(sh.lib.name = NULL)

Arguments

sh.lib.name The name of the library.

Details

This function is not to be called by the user.

Value

See dyn.load. Some teen variables starting with dot, ".", are assigned in .GlobalEnv.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

coco.init.

Page 24: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

coco.simple.model 19

coco.simple.model Call CoCo with setting of models

Description

Internal CoCoCore functions:

Usage

coco.simple.model(code, sub.code = FALSE, model = FALSE,type = "unconditioned", data = NULL,object = .object.of.model(model, data = data, ...), ...)

coco.simple.double(code, sub.code = FALSE,model.1 = "current", model.2 = "base",type = "unconditioned", data = NULL,object = .object.of.models(model.1, model.2,

data = data, ...), ...)

coco.string.model(code, argument = FALSE, sub.code = FALSE, model = FALSE,make.model = FALSE,push.pop = FALSE, type = "unconditioned", data = NULL,object = .object.of.model(model, data = data, ...), ...)

coco.string.double(code, argument = FALSE, sub.code = FALSE,model.1 = "current", model.2 = "base",eliminate = TRUE,make.model = FALSE, return.test = FALSE,push.pop = FALSE, type = "unconditioned", data = NULL,object = .object.of.models(model.1, model.2,

data = data, ...), ...)

Arguments

code Numeric, between 1 and 255.

sub.code Numeric.

argument A charater string, argument.

model See returnModel.

model.1 See isSubmodel.

model.2 See isSubmodel.

eliminate Logical, eliminate is TRUE then "last" is set to "current", else "last"is set to "base" before computing test when return.test is TRUE.

make.model Logical, if make.model is TRUE then a model object of the model resultingof the action is returned. See editmodel.

Page 25: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

20 coco.start

return.test Logical, if return.test is TRUE then a character string with the modelresulting of the action is returned. See editmodel.

push.pop Logical, if push.pop is TRUE, both model arguments are numeric and theobject argument is a CoCoCg object then model pointers are restored by lesscalls of CoCoCg. See also returnModelNumber and makeCurrent.

type A charater string. The argument type should be "unconditioned", "ok","long.true", "double", or "long.and.double".

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

These functions are not to be called by the user.

Note

coco.simple.model is called in .dispose.of.fitted.values, editModel, showFormula,showVertexOrder.

coco.simple.double is called in .show.log.lik, showDeviance, showTest.

coco.string.model is called in editModel, showTable.

coco.string.double is called in .decompose.models, editModel, showTest.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

call.coco.

coco.start Enter a CoCo object

Description

CoCo is started within R, and CoCo commands are then expected from standard input.

coco.resume will enter an existing CoCo object.

Page 26: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

coco.start 21

Usage

coco.start(n = 131072, p = 65536, q = 1024,r = 65536, s = 65536, ss = 65536, t = 65536)

coco.resume(object = .current.coco)

Arguments

n See coco.init.

p See coco.init.

q See coco.init.

r See coco.init.

s See coco.init.

ss See coco.init.

t See coco.init.

object See endCoCo.

Details

These functions are to be called with care.

Value

NULL

ToDo

This will crash both CoCo and R under Windows.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

coco.init.

Page 27: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

22 is.gc

is.gc Generating classes

Description

Internal CoCoCore function: Test for objects of type ’"character"’, but not one of the for CoCoreserved text strings.

Usage

is.gc(model = "*")

Arguments

model A character string. See also returnModel.

Details

This function is not to be called by the user.

Value

Logical

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

is.character.

Examples

is.gc("ab,bc.")is.gc("[[ab][bc]]")is.gc("[[ab]] / [[axy]] / [[axy]]")is.gc("current")is.gc(1)

Page 28: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

is.number 23

is.number Test for a number

Description

Internal CoCoCore function: Returns TRUE if its argument is of type real or type integer and not isa missing value indicator, and FALSE otherwise.

Usage

is.number(x)

Arguments

x object to be tested.

Details

This function is not to be called by the user.

Value

Logical

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

is.numeric, is.complex, and is.na.

Page 29: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

24 make.coco

make.coco Make a CoCo object

Description

Make a CoCo object.

Usage

make.coco(n = 65536, p = 65536, q = 1024,r = 65536, s = 65536, ss = 65536, t = 65536,uniq.title = FALSE, title = FALSE, type = 1,location = c(700, 550), manager = TRUE,silent = FALSE, sh.lib.name = NULL, ...)

make.cococg(n = 65536, p = 65536, q = 1024,r = 65536, s = 65536, ss = 65536, t = 65536,uniq.title = FALSE, title = FALSE,location = c(700, 550), manager = TRUE,silent = FALSE, sh.lib.name = NULL)

Arguments

n See coco.init.

p See coco.init.

q See coco.init.

r See coco.init.

s See coco.init.

ss See coco.init.

t See coco.init.

uniq.title Logical, if uniq.title is TRUE then it is assumed that the title can beused as a unique key of the CoCo object.

title See coco.init.

type See coco.init.

location See coco.init.

manager See coco.init.

silent See coco.init.

sh.lib.name See coco.load.

... Additional arguments.

Details

The distributed source code is only able to handle one concurrent CoCo object. Use endCoCo.

Page 30: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

make.model 25

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

coco.init.

make.model Make a CoCo model object

Description

Make a CoCo model object.

Usage

make.model(model = "*", title = "", push.pop = FALSE, object = .current.coco)

Arguments

model See returnModel.

title A charater string. If title is not set the the generating class of the model isused.

push.pop See editModel.

object See exportCoCo.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel.

Page 31: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

26 my.assign

my.assign Assign a value to a name

Description

Internal CoCoCore function: Assign a value to a name in an environment.

Usage

my.assign(x, value, frame)

Arguments

x A character string with the name of the variable to assign to.

value The value to assign x.

frame Numeric, the argument frame is zero for .GlobalEnv.

Details

This function is not to be called by the user.

Value

See assign.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

assign and coco.init.

Page 32: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

my.not.a.number 27

my.not.a.number The invalid number for CoCo objects

Description

Internal CoCoCore function: The double send at init in coco.init to CoCo objects to be returnedas the invalid number.

Usage

my.not.a.number()

Details

This function is not to be called by the user.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

coco.init.

ok.coco Test if the call to CoCo succeeded

Description

Internal CoCoCore function: Reports the warning message and returns FALSE, if the call to CoCois not succeeded, else return TRUE.

Usage

ok.coco(result, no.warnings = NULL)ok.coco.start(result)

Arguments

result Describe a here

no.warnings Describe no.warnings here

Page 33: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

28 ok.coco

Details

This function is not to be called by the user.

Value

Logical

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

coco.init.

Page 34: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Package ‘CoCoOldData’

Namespace CoCoOldData

Title Interface to old data files for CoCo

Description Interface functions for old data files for CoCo.

Depends R (>= 2.0.0)

CoCoOldData-internalInternal CoCoOldData objects

Description

Internal CoCoOldData and imported objects.

Details

These are not to be called by the user.

Please use the functions of the package "CoCoRaw" (and "CoCoObjects" and "CoCoGraph").Datasets are found in the package "CoCo" and "CoCoCg".

cutpoints Reduce number of possible values for discrete variable

Description

Define cutpoints to transform a continuous variable into a discrete variable in CoCo. The discretevariable must prior to the use of this function be declared with the number of levels as the cutpointswill result in.

Usage

cutpoints(name, cutpoints, object = .current.coco)

29

Page 35: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

30 read.data

Arguments

name A character string with the name of the variable.

cutpoints A vector of reals with the cutpoints.

object See exportCoCo.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

read.data and enterNames.

read.data Read data from files or standard input

Description

Read data from files or standard input.

Usage

read.data(setslot = TRUE, object = .current.coco)

read.specification(setslot = TRUE, object = .current.coco)

read.names(setslot = TRUE, object = .current.coco)

read.factors(setslot = TRUE, object = .current.coco)

read.observations(setslot = TRUE, object = .current.coco)

read.list(silent = FALSE, setslot = TRUE, object = .current.coco)

read.table.coco(silent = FALSE, setslot = TRUE, object = .current.coco)

Page 36: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

read.q.table 31

Arguments

silent Logical, if silent then CoCo is more silent.

setslot See enterNames.

object See exportCoCo.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

set.data.file and enterNames.

read.q.table Read Q tables, structural zeros, from file

Description

Read Q table.

Usage

read.q.table(set, setslot = TRUE, object = .current.coco)

read.q.list(set, setslot = TRUE, object = .current.coco)

Arguments

set A character string with the names of the set of variables.

setslot See enterNames.

object See exportCoCo.

Value

TRUE

Page 37: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

32 redefine.factor

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterNames.

redefine.factor Change the number of declared levels for a discrete variable

Description

Redefine the number of levels for a variable.

Usage

redefine.factor(name, levels, missing.levels = 0, object = .current.coco)

Arguments

name A character string with the name of the variable.

levels A integer with the new number of levels.missing.levels

A integer with the new number of missing.levels.

object See exportCoCo.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

read.data and enterNames.

Page 38: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

reject.cases 33

reject.cases Declare a subset of the cases to be read

Description

Declare a subset of the cases to be read.

Usage

reject.cases(set, cell, object = .current.coco)

select.cases(set, cell, object = .current.coco)

or.reject.cases(set, cell, object = .current.coco)

or.select.cases(set, cell, object = .current.coco)

Arguments

set A character string with the names of the variables.

cell A numeric vector with the levels of the variables.

object See exportCoCo.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

read.data and enterNames.

Page 39: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

34 set.data.file

set.data.file Declare files to read data from

Description

Assign data files.

Usage

set.data.file(file.name, object = .current.coco)

set.specification.file(file.name, object = .current.coco)

set.observations.file(file.name, object = .current.coco)

Arguments

file.name A character string with the file.name.

object See exportCoCo.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

read.data and enterNames.

Page 40: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

set.output 35

set.output Set CoCo output file

Description

Write standard output from CoCo on file.

Usage

set.output(file.name, object = .current.coco)

Arguments

file.name A character string with the file.name.

object See exportCoCo.

Value

TRUE

Note

This command is fragile: Redirects the standard output, and causes R to crash under Windows.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

skip.missing Declare that cases with missing values are skipped during reading

Description

Set CoCo to skip cases with any of the entered variables with missing values. The function has tobe used between entering the specification and entering the observations.

Usage

skip.missing(object = .current.coco)

Page 41: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

36 source.coco

Arguments

object See exportCoCo.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

read.data, enterNames, enterList, enterTable, and excludeMissing.

source.coco Read CoCo commands from file

Description

Read coco commands.

Usage

source.coco(file.name, object = .current.coco)

Arguments

file.name A character string with the file.name of the file to read from.

object See exportCoCo.

Value

TRUE

Note

This command is fragile: Redirects the standard input, and causes R to crash under Windows.

Author(s)

Jens Henrik Badsberg

Page 42: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

source.coco 37

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterNames.

Page 43: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

38 source.coco

Page 44: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Package ‘CoCoRaw’

Namespace CoCoRaw

Title The user interface to CoCo from R and Splus

Description Interface to CoCo from R and Splus.

Depends R (>= 2.0.0)

CoCoRaw-internal Internal CoCoRaw objects

Description

Internal CoCoRaw and imported objects.

Details

Some of these are not to be called by the user.

backward Stepwise model selection by backward elimination and forward selec-tion of edges or interaction terms

Description

This function perform (depth first) search for a single model with all edges or interaction termssignificant (backward), or all terms not in the model not significant (forward). The function canalso be used to compute tests for all terms in the model or all terms not in the model.

39

Page 45: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

40 backward

Usage

backward(sorted = FALSE, reversed = FALSE, only = FALSE, short = FALSE,p.accepted = FALSE, p.rejected = FALSE, decomposable.mode = NULL,coherent = FALSE, headlong = FALSE, recursive = FALSE,follow = FALSE,least.significant = TRUE,components = NULL, p.components = FALSE,separators = FALSE, p.separators = FALSE,edges = TRUE, model = FALSE, fix.edges = NULL,return.tests = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

forward(sorted = FALSE, reversed = FALSE, only = FALSE, short = FALSE,p.accepted = FALSE, p.rejected = FALSE, decomposable.mode = NULL,coherent = FALSE, headlong = FALSE, recursive = FALSE,all.significant = TRUE,components = NULL, p.components = FALSE,separators = FALSE, p.separators = FALSE,edges = TRUE, model = FALSE, fix.edges = NULL,return.tests = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

sorted Logical, if sorted is TRUE then a list of tests is printed sorted according tothe selected p-value (statistic, if IC is selected). For backward the p-values areordered in increasing order (IC decreasing), and for forward the p-values areordered in decreasing order (IC increasing). The least significant edge is thenlast for backward, and the most significant edge is then last for forward.

reversed Logical, if reversed is TRUE then the sorted list is printed in reverse order.

only Logical, if only is TRUE then only the sorted list is printed.

short Logical, if short is TRUE then only a short report is printed: The test of theedge removed (entered) at each cycle.If short is TRUE and dump (optionsCoCo) also is TRUE then for eachcompleted set of backward (e.i. each removal of an edge or interaction terms),the dump file is rewinded, and a report of rejected, accepted, eligible terms andthe model resulting of the step is printed on the file. In the following step of thebackward elimination each tested term and the selected test statistic for the testof the term is printed on the dump file. Similar for forward.

p.accepted Numeric, edges and interaction terms with tests with p-value (or minus the ICvalue) greater than p.accepted are accepted for removal in backward.If coherent is TRUE for forward then terms with p-value (or minus the ICvalue) greater than p.accepted are not eligible for entering in sub sequentialcycles of the forward selection.

p.rejected Numeric, and interaction terms with tests with p-value (or minus the IC value)smaller than p.rejected are rejected, and thus entered into the model inforward (according to all.significant).

Page 46: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

backward 41

If coherent is TRUE for backward then terms with p-value (or minus the ICvalue) smaller than p.rejected are not eligible for removal in sub sequentialcycles of the backward elimination.

decomposable.modeLogical, if decomposable.mode is TRUE then only decomposable modelsare visited.

coherent Logical, if coherent then the principle of coherence is applied: Once an edgein backward (forward) is rejected (accepted) it is no more tested for removal(entering).

headlong Logical, if headlong is TRUE then in each cycle, e.i. visiting of the edgesor interaction terms of the model, terms are only visited until a term is found toremove or enter. In backward edges are visited until an edge with a p-value (orminus the IC value) greater than p.accepted is found, and in forward edgesare visited until an edge with a p-value (or minus the IC value) smaller thanp.rejected is found.

recursive Logical, if recursive is TRUE then cycles of visiting edges or interactionterms are repeated until no more edges are removed in backward and until nomore edges are added in forward.

follow Logical, if follow is TRUE then tests in backward are performed against themodel selected in the previous cycle, else tests are performed against the BASEmodel. The option is not available for forward.

least.significantLogical, if least.significant is TRUE then the least significant edge isremoved in backward, else all non significant edges are removed. The option isnot available for forward.

all.significantLogical, if all.significant is TRUE then all significant edges are enteredin forward, else only the most significant edge is entered. The option is notavailable for backward.

components Logical, if components is TRUE, then common decompositions of the twomodels of each tests are found. If any p-value (or minus the IC value) of thetests on the resulting components is less than p.components then the test isrejected.

p.components Numeric, edges with a p-value (or minus the IC value) less than the valuep.components for any component is rejected, if components is TRUE.

separators Logical, if separators is TRUE, then for each edge all separators of thetwo vertices of the edge is found, and the edge is rejected, if for any of theseseparators the two variables not are conditional independent, determined byp.separators.

p.separators Numeric, edges with a p-value (or minus the IC value) less than the valuep.separators for any separator is rejected, if separators is TRUE.

edges Logical, if edges is TRUE, then in each cycle edges of the model are visited,else the maximal interaction terms are visited.

model See returnModel.

Page 47: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

42 backward

fix.edges A character string with a generating class. Edges in fix.edges are not eli-gible for removal in backward, and are not eligible for entering in forward. iffix.edges is NULL, default, the fixing of the previous backward or forwardis retained. Use fix.edges = "" to clear fixing of edges.

return.tests Logical, if return.tests is TRUE then the test values are returned in amatrix. (recursive should be FALSE.)

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Note

Note also the options of the sections "tests" (optionsCoCo).

p.accepted, p.rejected, p.components, p.separatorswhen set to a value not FALSEwill set these options for the CoCo object. If the arguments are not given to backward and forwardthe the values of the CoCo objects will be used.

The arguments decomposable.mode and separators when different from NULL sets re-spectively the options decomposable.mode and partitioning.

Note that to use BIC both IC and BIC has to be set to TRUE, since IC controls whether to usep-values or IC-values, and BIC controls which IC-value to use.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

editModel and eh.

Page 48: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

cleanData 43

cleanData Remove cases from cells set to zero by structurally

Description

Remove the cases in cells that are defined to be zero by structure.

Usage

cleanData(data = NULL, object = .object.of.thing(data = data, ...), ...)

Arguments

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterQtable and enterQlist.

disposeOfEh Dispose of the model classes of the EH procedure

Description

Dispose of model classes of the EH procedure.

Usage

disposeOfEh(code = "all", data = NULL,object = .object.of.thing(data = data, ...), ...)

Page 49: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

44 disposeOfEh

Arguments

code A character string. The argument code should be "all" (all four classes),"duals" (the two duals), "a.dual" (the a-dual), "r.dual" (the r-dual),"classes" (accepted and rejected models), "accepted" (accepted mod-els), or "rejected" (rejected models).

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

eh.

Examples

library(CoCo);data(Reinis);

CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);eh(strategy= "smallest", object = CoCoObject);disposeOfEh(object = CoCoObject);eh(strategy= "alternating", object = CoCoObject);disposeOfEh(object = CoCoObject);eh(strategy= "rough", object = CoCoObject);disposeOfEh(object = CoCoObject);endCoCo(object = CoCoObject);

Page 50: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

disposeOfModel 45

disposeOfModel Dispose of models

Description

Dispose of models of the model list in the CoCo object.

Usage

disposeOfModel(model = FALSE, a = FALSE, b = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See showModel.

a See showModel.

b See showModel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel.

Page 51: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

46 disposeOfQtable

disposeOfQtable Dispose of Q-tables and Q-lists (structurally zero cells)

Description

Dispose of a Q-table or a Q-list.

Usage

disposeOfQtable(set, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

set A character string identifying the Q-table or Q-list to dispose of by the set ofnames of the variables of the table.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterQlist and enterQtable.

Page 52: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

editModel 47

editModel Edit model

Description

Edit or transform models.

Usage

editModel(action = NULL, modification = NULL, model = FALSE,result.form = "maximal-interaction-terms", omit.test = TRUE,make.model = FALSE, return.test = FALSE, push.pop = FALSE,edges = TRUE, dispose = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

action A character string. The argument action should be "marginal.model","collaps.model", "generate.decomposable", "generate.graphical","generate.skeleton", "generate.moral", "dual.to.normal","nor- mal.to.dual", "drop.factor", "drop.edges", "add.edges","drop.- interactions", "add.interactions", "reduce.generator","remove.- generator", "remove.total.interaction", "meet.of.models",(or "intersection"), "join.of.models", (or "union"), "difference.of.-models", or "decompose.models". See the section "Details" below.

modification A character string or a model as model. The argument modificationshould be a set, generating class, or a model.

model Numeric, model object, text string, or logical. A numeric should give a validmodel number in the object, see makeCurrent about the model list. Theargument can also be a CoCo model object, see makeModel about creatingmodel objects. A text string can give the model as a generating class (or gener-ating classes in MIM-form for mixed models), see enterModel for the nota-tion of models. The text strings "base", "current", or "last" refers tothe three models. The default value "current" for the CURRENT model canalso be given as the logical FALSE.

result.form A character string. Currently only "maximal-interaction-terms" isimplemented for result.form.

omit.test Logical, if omit.test is TRUE then the resulting model is not tested againstthe argument model.

make.model Logical, if make.model is TRUE then a model object of the model resultingof the action is returned.

return.test Logical, if return.test is TRUE then a character string with the modelresulting of the action is returned.

push.pop Logical, if push.pop is TRUE, the model argument is numeric and the objectargument is a CoCoCg object then model pointers are restored by less calls ofCoCoCg. See also returnModelNumber and makeCurrent.

Page 53: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

48 editModel

edges A logical for difference between models. If edges is TRUE then the edges notin both models are returned.

dispose Logical, if dispose is TRUE then the model resulting of the action is in theCoCo object, and a character string with the model is returned.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

Marginal model :

Collaps model :

Generate decomposable :

Generate graphical :

Generate skeleton :

Generate moral :

Dual to normal :

Normal to dual :

Drop factor :

Drop edges :

Add edges :

Drop interactions :

Add interactions :

Reduce generator :

Remove generator :

Remove total interaction :

Meet of models : (or "intersection")

Join of models : (or "union")

Difference of models :

Decompose models :

Value

The logical TRUE, a charaterstring with a generating class of a model, a model object, or a vectorof numerics (as returnTest) for a test.

Author(s)

Jens Henrik Badsberg

Page 54: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

eh 49

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel.

eh The Edwards and Havranek model search procedure

Description

After using the "Fast Procedure for Model Search", the EH-procedure, by Edwards and Havranek(1985, 1985) any model can be labeled as accepted or as rejected. By the principles of weakacceptance, weak rejection, and coherence, the search space of all hierarchical graphical, or decom-posable models is divided into two sets of models: The class of minimal acceptable models, and theclass of maximal rejected models.

Usage

eh(strategy = c("smallest", "alternating", "rough")[1],sub.class = c("decomposable", "graphical", "hierarchical")[2],p.accepted = FALSE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

strategy A character string. The argument strategy should be "smallest", "alternating",or "rough". See the section "Details" below.

sub.class A character string. The argument sub.class should be "decomposable","graphical", or "hierarchical". See the section "Details" below.

p.accepted Numeric, models with p-value greater than p.accepted are accepted, elsethey are rejected.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

Smallest : At each cycle, select the dual with fewest models to fit.

Alternating : Switch between fitting the a-dual and the r-dual.

Rough : Give a rough estimate of the number of models in each dual, and fit the dual with the smallestrough size.

Page 55: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

50 ehExtract

Decomposable : Restrict the search space to decomposable models.

Graphical : Restrict the search space to graphical models.

Hierarchical : Set the the search space to hierarchical models.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H. (2001): A guide to CoCo, JSS ( http://www.jstatsoft.org/v06/i04/ ).

Badsberg, J.H. (1996): Xlisp+CoCo, Aalborg University.

Edwards, D. and Havranek, T. (1985). A fast procedure for model search in multidimensionalcontingency tables. Biometrika 72: 339-351.

Edwards, D. and Havranek, T. (1987). A fast model selection procedure for large families of models.J. Amer. Stat. Assoc. 82: 205-231.

See Also

forward, backward, and disposeOfEh.

Examples

library(CoCo);data(Reinis);

CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);eh(sub.class = "decomposable", object = CoCoObject);eh(sub.class = "graphical", object = CoCoObject);eh(sub.class = "hierarchical", object = CoCoObject);endCoCo(object = CoCoObject);

ehExtract Extract models from the EH-procedure

Description

Copy in the CoCo object models from the classes of the EH procedure to the model list.

Usage

ehExtract(class, sub.class = FALSE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Page 56: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

ehExtract 51

Arguments

class A character string. The argument class should be "a.dual" (the a-dual),"r.dual" (the r-dual), "accepted" (accepted models), or "rejected"(rejected models).

sub.class A character string. See eh.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

makeCurrent, ehForceAccept and ehForceReject.

Examples

library(CoCo);data(Byssinosis38);

CoCoObject <- makeCoCo();enterTable(Byssinosis38, object = CoCoObject);eh(object = CoCoObject);showModel("all", object = CoCoObject);disposeOfModel("all", object = CoCoObject);ehExtract(class = "accepted", object = CoCoObject);showModel("all", object = CoCoObject);disposeOfModel("all", object = CoCoObject);ehExtract(class = "rejected", object = CoCoObject);showModel("all", object = CoCoObject);disposeOfModel("all", object = CoCoObject);ehExtract(class = "a.dual", object = CoCoObject);showModel("all", object = CoCoObject);disposeOfModel("all", object = CoCoObject);ehExtract(class = "r.dual", object = CoCoObject);showModel("all", object = CoCoObject);disposeOfModel("all", object = CoCoObject);ehExtract(class = "a.dual", sub.class = "hierarchical", object = CoCoObject);

Page 57: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

52 ehFindDual

showModel("all", object = CoCoObject);disposeOfModel("all", object = CoCoObject);ehExtract(class = "r.dual", sub.class = "hierarchical", object = CoCoObject);showModel("all", object = CoCoObject);endCoCo(object = CoCoObject);

ehFindDual Find duals in the EH procedure

Description

Find the a-dual, the r-dual, or both duals in the EH procedure without fitting the models.

Usage

ehFindDual(dual = "both", sub.class = FALSE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

dual A character string. The argument dual should be "both" (find both the twoduals), "a.dual" (find the a-dual), or "r.dual" (find the r-dual).

sub.class A character string. See eh.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

eh and ehForceAddDualToClass.

Page 58: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

ehFit 53

ehFit Fit and classify models in the EH procedure

Description

Fit and classify models in the EH procedure. The models to fit can be models from the current dualsof the EH procedure or models from the model list of the CoCo object. Only a single "step" of theEH-procedure is performed.

Usage

ehFit(model = FALSE, a = FALSE, b = FALSE, dual = NULL,sub.class = FALSE, p.accepted = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See showModel.a See showModel.b See showModel.dual A character string. The argument dual should be "both" (fit both the two

duals), "smallest.dual" (fit the smallest dual), "largest.dual" (fitthe largest), "a.dual" (fit the a-dual), or "r.dual" (fit the r-dual).

sub.class A character string. See eh.p.accepted A numeric. See eh.data See exportCoCo.object See exportCoCo.... Additional arguments to generate the CoCo object from the data argument.

See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

eh, showModel, ehForceAccept, and ehForceReject.

Page 59: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

54 ehForceAccept

ehForceAccept Force models into the classes of the EH procedure

Description

Models are forced into a model class of the EH-procedure regardless of whether the models areaccepted or rejected.

Usage

ehForceAccept(model, a = FALSE, b = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

ehForceReject(model, a = FALSE, b = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See showModel.

a See showModel.

b See showModel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

eh, showModel, and ehFit.

Page 60: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

ehForceAddDualToClass 55

ehForceAddDualToClassForce a dual into a class of models of the EH procedure

Description

Force a dual of the EH procedure into a class without fitting and classifying the models.

Usage

ehForceAddDualToClass(dual = "a.dual", class = "accepted",sub.class = FALSE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

dual A character string. The argument dual should be "a.dual" (add the a-dual),or "r.dual" (add the r-dual).

class A character string. The argument class should be "accepted" (add thedual to class of accepted models), or "rejected" (add the dual to class ofrejected models).

sub.class A character string. See eh.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

eh and ehFindDual.

Page 61: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

56 ehForceFix

ehForceFix Fix edges or terms of the models in the EH procedure

Description

Force terms into or out of models in the EH procedure. By ehForceFix(gc, fix = "in",...) edges (or generators) are forced into all the models in the EH-procedure. By ehForceFix(gc,fix = "out", ...) all terms containing a generator in the generating class gc are excludedfrom all models considered in the EH-procedure.

Usage

ehForceFix(gc = "what", fix = "out", add.fix = FALSE, redo.fix = FALSE,data = NULL, object = .object.of.thing(data = data, ...), ...)

Arguments

gc A character string. The argument gc is a generating class.

fix A character string. The argument fix should be "out" ( ... ), or "in" ( ... ).

add.fix Logical. ehForceFix(gc, fix = "out", ...) will clear the fixingset by previous use of ehForceFix(gc, fix = "out", ...), if add.fixis FALSE. If add.fix is TRUE then the terms are added to the fixing. Similarfor ehForceFix(gc, fix = "in", ...).

redo.fix Logical, if redo.fix is TRUE then the fixing is repeated. ehForceFix(gc,fix = "out", redo.fix = TRUE, ...) will redo the combinationof the last ehForceFix(gc, fix = "out", ...) and following ehForceFix(gc,fix = "out", add.fix = TRUE, ...). Fixing set by ehForceFix(gc,fix = "in", ...) is then modified according to the fixing out. Similar forehForceFix(gc, fix = "in", redo.fix = TRUE, ...).

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

Terms set by ehForceFix(gc, fix = "out", ...) is the dual representation of the maxi-mal models considered, see pp. 340 Edwards & Havranek (1985). To exclude edges in the graphicalsearch only generators with cardinality 2 (edges) should be given to ehForceFix(gc, fix ="out", ...).

Value

TRUE

Page 62: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

ehSetBase 57

Note

Using the function ehForceFix will only set up fixing for future models visited be eh. Thus ifthe EH-procedure already has been used the duals and the model classes should be disposed of bedisposeOfEh.

ehForceFix(gc, fix = "out", ...) and ehForceFix(gc, fix = "in", ...)will interact:

Terms set by ehForceFix(gc, fix = "in", ...) are remove from the terms set byehForceFix(gc, fix = "out", ...): Terms set by ehForceFix(gc, fix = "in",...) are added to the generating class achieved by transforming ehForceFix(gc, fix ="out", ...) from the dual representation to the normal representation, and the resulting gener-ating class is transformed back to the dual representation.

Term set by ehForceFix(gc, fix = "out", ...) are remove from the terms set byehForceFix(gc, fix = "in", ...): The terms set by ehForceFix(gc, fix = "in",...) is restricted to the generating class achieved by transforming ehForceFix(gc, fix ="out", ...) from the dual representation to the normal representation.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

eh and returnFix.

ehSetBase The base model of the EH procedure

Description

Set the base model of the EH procedure. Tests of models in the EH procedure are performed againstthe saturated model, or the model entered by ehSetBase.

Usage

ehSetBase(model = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Page 63: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

58 ehSetMainEffects

Arguments

model See returnModel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Note

The base model of the EH procedure effects fixing in the EH procedure, ehForceFix. Termsnot in the base model of the EH procedure are set to be fixed out for the EH procedure, e.i., thefixing out is set to the dual representation of the model set by ehSetBase. Since there is nodistinction between fixing out due to ehForceFix(gc, fix = "out", ...) and due toehSetBase, and since a larger EH base model would give less fixing out in the EH procedure,previous fixing out in the EH procedure is canceled by ehSetBase. Use ehForceFix(fix ="out", redo = TRUE, ...) to redo the fixing out in the EH procedure.

Only terms in the base model of the EH procedure can be fixed into the EH procedure. Thus termsset by ehForceFix(gc, fix = "in", ...) might be reduced by ehSetBase.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

eh.

ehSetMainEffects Set the main effects of the models in the EH procedure

Description

Set which variables to admit in the models in the EH procedure.

Usage

ehSetMainEffects(set = "what", data = NULL,object = .object.of.thing(data = data, ...), ...)

Page 64: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

emOn 59

Arguments

set A character string with the names of the variables.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE, or a character string if the effects are returned.

Note

CoCo will work more efficiently, if setUseVariables is used to restrict the EH procedure to asubset of the variables, than if ehSetMainEffects, ehSetBase or ehForceFix is used.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

eh.

emOn Handling of latent variables and missing values by the EM algorithm

Description

Turn on or off the use of the EM algorithm for estimating values for missing values.

Usage

emOn(hit = FALSE, setslot = TRUE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Page 65: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

60 endCoCo

Arguments

hit A character string. hit should be "on", "off", or "what".

setslot See enterNames.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

excludeMissing.

endCoCo End a CoCo object

Description

End a CoCo object and remove the temporary files of the CoCo object.

Usage

endCoCo(object = .current.coco, silent = FALSE)

quitCoCo(..., object = .current.coco)

Arguments

... Additional arguments to quit.

object See exportCoCo.

silent Logical, if TRUE then CoCo is more silent.

Page 66: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

enterDataFrame 61

Note

The distributed source code is only able to handle one concurrent CoCo object. Use endCoCo.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

coco.init.

enterDataFrame Enter a data.frame into a CoCo object

Description

Enter a data frame into a CoCo object with declaring the variables.

Usage

enterDataFrame(data.frame, to.factor = NULL, missing.values = c("."),setslot = TRUE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

data.frame A object of class "data.frame". The argument data.frame is with con-tinuous and discrete variables as respectively numerics and factors. The namesof the variables are extracted from the column names of the data.frame.

to.factor A numeric vector. Numeric columns of data.frame with indices in the argu-ment to.factor are converted into factors.

missing.valuesA vector or list of values to be considered as missing values. If the argumentmissing.values is not a list then values in missing.values are con-sidered as missing values for all the discrete variables, that is the factors. Ifmissing.values is a list, then it should have length equal to the numberof columns of the data.frame, and values of the i-the variable are considered asmissing if they are among the values of the i-te element of missing.values.

setslot See enterNames.data See exportCoCo.object See exportCoCo.... Additional arguments to generate the CoCo object from the data argument.

See propertyModel.

Page 67: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

62 enterList

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001.

See Also

enterNames.

Examples

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);

endCoCo(object = CoCoObject);

enterList Enter a list of cases into a CoCo object

Description

Enter a list of cases into a CoCo object.

Usage

enterList(discrete, continuous = NULL, accumulated = FALSE, setslot = TRUE,data = NULL, object = .object.of.thing(data = data, ...), ...)

enterTwoLists(discrete, continuous, accumulated = FALSE, setslot = TRUE,data = NULL, object = .object.of.thing(data = data, ...), ...)

Arguments

discrete A vector (for enterList) or matrix (for enterTwoList) of numerics forthe discrete variables. For enterList the cases should be given one byone in the vector. If your.data is a data.frame or a matrix with casesrow by row you will have to give discrete = c(t(your.data)). ForenterTwoList the data should be given in a data.frame or a matrixwith cases row by row.

Page 68: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

enterModel 63

continuous A vector or matrix of numerics for the continuous variables. Similar todiscrete.

accumulated Logical, if accumulated is TRUE then the first integer, count, in discretefor each "case" should be the count for that case. For enterList the lengthof discrete thus have to be number of cases times number of variables plusone, For enterTwoList the number of columns of discrete is number ofvariables plus one.

setslot See enterNames.

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterNames.

enterModel Enter a model

Description

Read a model into the CoCo object.

Usage

enterModel(model = "*", order = NULL, set = "*", homogeneous = FALSE,data = NULL, object = .object.of.thing(data = data, ...), ...)

Page 69: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

64 enterModel

Arguments

model A character string with a generating class of the model, or the 3 generatingclasses for respectively the discrete, linear and quadratic part of a mixed model.A mixed model can also be given as a single generating class corresponding tothe cliques of the 2-section graph of the model.

order Numeric, if order is set then the model with only and all order interactionsamong variables in the argument set is entered.

set A character string with a set of variables.

homogeneous Logical, if homogeneous is TRUE then a homogeneous model is read of thesingle generating class for a mixed model.

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

makeModel, editModel, makeCurrent, propertyModel, and showModel.

Examples

library(CoCo);data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);

enterModel(".", object = CoCoObject);showModel("last", object = CoCoObject);

enterModel(order = 1, set = "*", object = CoCoObject);showModel("last", object = CoCoObject);

enterModel(order = 2, set = "*", object = CoCoObject);showModel("last", object = CoCoObject);

Page 70: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

enterModel 65

enterModel(order = 4, set = "*", object = CoCoObject);showModel("last", object = CoCoObject);

enterModel("*", object = CoCoObject);showModel("last", object = CoCoObject);

#enterModel("[[BD][BF][G][AD][AEF]]", object = CoCoObject);enterModel("[[BC][CE][F][AC][ADE]]", object = CoCoObject);showModel("last", object = CoCoObject);

#enterModel("BD,BF,G,AD,AEF.;", object = CoCoObject);enterModel("BC,CE,F,AC,ADE.;", object = CoCoObject);showModel("last", object = CoCoObject);

endCoCo(object = CoCoObject);

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);

enterModel(".", object = CoCoObject);showModel("last", object = CoCoObject);

enterModel(order = 1, set = "*", object = CoCoObject);showModel("last", object = CoCoObject);

enterModel(order = 2, set = "*", object = CoCoObject);showModel("last", object = CoCoObject);

enterModel("*", object = CoCoObject);showModel("last", object = CoCoObject);

enterModel("*", homogeneous = TRUE, object = CoCoObject);showModel("last", object = CoCoObject);

enterModel("[[ab]] / [[aby][abx]] / [[x^][abxy][y^]]", object = CoCoObject);showModel("last", object = CoCoObject);

endCoCo(object = CoCoObject);

library(CoCo);data(Byssinosis38);CoCoObject <- makeCoCo();enterTable(Byssinosis38, object = CoCoObject);

enterModel("*", object = CoCoObject);enterModel("[[:byssinosis:dust:race:sex:smoking:employment]]", object = CoCoObject);

enterModel(paste(c("[[:byssinosis:dust:employment]","[:dust:race:sex:employment]","[:sex:smoking:employment]]"), collapse = ""),object = CoCoObject);

Page 71: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

66 enterNames

endCoCo(object = CoCoObject);

enterNames Enter a specification of variables into the CoCo object

Description

Enter a specification of variables. After specifying the variables by the function the observationsshould be entered by enterList or enterTable.

Usage

enterNames(names = c("a", "b", "c"), levels = c(2, 2, 2),missing = NULL, setslot = TRUE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

names A vector of character strings with the names of the variables. If any of thenames of the variables has more than one character then all the names shouldhave colon, ":", as the first character.

levels A vector of integers. The number of levels, excluding missing levels, foreach of the discrete variable. For continuous variables the number of levelsshould be zero, 0.

missing A vector of integers. The number of missing levels for each variable.

setslot Logical, if setslot is TRUE then the entered values are added to the CoCoobject, such that the object can be recovered after ending the CoCo objectby, e.g. endCoCo, or after terminating the R session and restarting R.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Note

Between enterNames and enterList or enterTable a subset of the variables can be se-lected by setUseVariables.

Author(s)

Jens Henrik Badsberg

Page 72: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

enterQtable 67

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

setUseVariables, excludeMissing, enterList, and enterTable.

enterQtable Enter initial values for the IPS algorithm and declare cells to be zeroby structure

Description

Enter a Q-table or Q-list: Initial values for the IPS-algorithm and the cells of a table to be zero bystructure.

Usage

enterQtable(set, table, setslot = TRUE, data = NULL,object = .object.of.thing(data = data, ...), ...)

enterQlist(set, list, setslot = TRUE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

set A character string giving the set of variables of the table.

table A vector of integers, one for each cells of the table formed by the cross clas-sification of the variables of set.

list A vector of integers, a list of cells of the table formed by the cross classifica-tion of the variables of set.

setslot See enterNames.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

Cells equal to zero are by structure zero. enterQlist will enter these cells.

Value

TRUE

Page 73: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

68 enterTable

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

disposeOfQtable.

Examples

library(CoCo);

without <- makeCoCo(title = "Without structural zero");optionsCoCo(digits.table = 6, decimals.table.probabilities = 2,

decimals.table.expected = 1, decimals.table.residual = 1);enterNames("smv", rep(2, 3));n <- c(11, 2209, 0, 111, 48, 239, 72, 2074);enterTable(n);A.1 <- make.model("*");A.2 <- make.model("mv,vs");showTest();endCoCo();

with <- makeCoCo(title = "With structural zero");optionsCoCo(digits.table = 6, decimals.table.probabilities = 2,

decimals.table.expected = 1, decimals.table.residual = 1);enterNames("smv", rep(2, 3));n <- c(11, 2209, -1, 111, 48, 239, 72, 2074);enterTable(n);returnTable("zero");B.1 <- make.model("*");B.2 <- make.model("mv,vs");showTest();endCoCo();

enterTable Enter a table of counts of the tables formed by cross classifying dis-crete variables

Description

Enter a table of counts of the tables formed by cross classifying discrete variables. If the input is avector of the counts the table has to be declared by enterNames before the use of this function.An array of counts with dimnames can be entered by enterTable without first specifyingthe variables in the CoCo object.

Page 74: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

enterTable 69

Usage

enterTable(counts, silent = TRUE, setslot = TRUE, missing = NULL,data = NULL, object = .object.of.thing(data = data, ...), ...)

Arguments

counts Some integers, either a vector or a object of class "array". If counts is avector then the variables should be defined in the CoCo object by enterNames.If counts is of class "array" then the names and number of levels for thevariables are extracted from the argument counts.

silent Logical, is silent CoCo will be more quiet about the cases read.

missing A numeric vector of length equal to the number of variables. If counts isof class "array" and missing is not "NULL" then missing will definemissing levels as enterNames.

setslot See enterNames.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterNames.

Examples

library(CoCo);data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);

endCoCo(object = CoCoObject);

library(CoCo);data(Byssinosis38);

Page 75: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

70 excludeMissing

CoCoObject <- makeCoCo();enterTable(Byssinosis38, object = CoCoObject);

endCoCo(object = CoCoObject);

excludeMissing Handling of missing values by excluding cases

Description

The function controls whether cases with missing values are excluded or if for discrete variables thelevels marked as missing just are additional levels.

Usage

excludeMissing(hit = "flop", set = ";", setslot = TRUE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

hit A character string. hit should be "what", "on", "off", "flop" (forswitching between "on" and "off"), or "in".

set A character string with the set set of variables when hit is set to "in".

setslot See enterNames.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

emOn.

Page 76: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

exportCoCo 71

exportCoCo Write and read the CoCo data and the models to a binary file

Description

Export and import a binary file with the CoCo data and the models.

Usage

exportCoCo(file.name, data = NULL,object = .object.of.thing(data = data, ...), ...)

importCoCo(file.name, setslot = TRUE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

file.name A character string naming the file to write to.

setslot Logical, if setslot is TRUE then the entered value of file.name is addedto the CoCo object, such that the object can be recovered after endingthe CoCo object by, e.g. endCoCo, or after terminating the R session andrestarting R.

data An optional argument with the "data", only used if the argument object is notgiven. If the class of data is "table" or "array", then the table is enteredinto a pure discrete CoCo object. If the class of data is "data.frame" (or"matrix"), then the data frame is entered into a CoCoCg object. Columnsof class "factor" will for data of class "data.frame" be considered asdiscrete variables, and columns of class "numeric" will be considered as con-tinuous variables. Columns of class "numeric" can be converted to discretevariables by the argument to.factor, see enterDataFrame.

object The CoCo object with the data and models to use. If neither object or datais given, then the object .current.coco of .GlobalEnv is used as defaultobject, see makeCurrentCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

Options, the values of optionsCoCo is not exported, as neither is the setting of setUseVariables,excludeMissing, and emOn. enterQtable and enterQlist are exported.

Value

A character string with the file name file.name.

Page 77: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

72 exportCoCo

Note

exportCoCo and importCoCo is intended to facilitate using the same data in R+CoCo, Xlisp+CoCoand standalone CoCo by only entering the data into one of the programs. Once the data has beenentered into CoCo in one of the three systems, the data can be exported, and then imported to astandalone CoCo or CoCo loaded under the other system. This will work with the same versionnumber of CoCo, and probably also between different platforms (Unix, Linux, Windows, etc.). Infuture versions of CoCo the format of the binary file might change, and thus the binary files fromexportCoCo should not be used for storing data.

Author(s)

Jens Henrik Badsberg

See Also

importCoCo.

Examples

library(MASS)data(anorexia)library(CoCoCg);

# Without "data" require ending the CoCo object:

# exportCoCo("Anorexia.xpt", data = anorexia);# endCoCo();

# With CoCo object:

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);

exportCoCo("Rats.xpt", object = CoCoObject);

endCoCo(object = CoCoObject);

# Import the first example:

Anorexia <- makeCoCo();importCoCo("Anorexia.xpt", object = Anorexia);showOptions("specification");endCoCo(object = Anorexia);

# Import the second example:

Rats <- makeCoCoCg();importCoCo("Rats.xpt", object = Rats);

Page 78: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

extractData 73

showOptions("specification");endCoCo(object = Rats);

extractData Extract the data from a CoCo Object

Description

Extract the data from a CoCo Object.

Usage

extractData(full = FALSE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

full Logical, if full is TRUE then all the varaibles are extracted, that is as withoutsetUseVariables.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

exportCoCo.

Page 79: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

74 isSubmodel

isSubmodel Is the CURRENT model a sub model of the BASE model ?

Description

Return TRUE if the model of the first argument model is a sub model of model of the secondargument.

Usage

isSubmodel(model.1 = "current", model.2 = "base", data = NULL,object = .object.of.models(model.1, model.2,

data = data, ...), ...)

Arguments

model.1 Numeric, model object, text string, or logical. A numeric should give a validmodel number in the object, see makeCurrent about the model list. Theargument can also be a CoCo model object, see makeModel about creatingmodel objects. A text string can give the model as a generating class (or gener-ating classes in MIM-form for mixed models), see enterModel for the nota-tion of models. The text strings "base", "current", or "last" refers tothe three models. The default value "current" for the CURRENT model canalso be given as the logical FALSE.

model.2 As the argument model.1. The default value "base" can here also be givenas the logical FALSE.

data See exportCoCo.object See exportCoCo.... Additional arguments to generate the CoCo object from the data argument.

See propertyModel.

Details

Tests if the generating class (classes for mixed models) for the first model is a sub class of thegenerating class of the second model. The causal structures of the two models should be the same.

Value

Logical, TRUE if the first argument is a sub model of the second argument.

The value NULL is returned (after warnings) if the two models is not available.

Note

NULL can be used for FALSE.

If CURRENT (BASE) is not available the pointer in the CoCo object will after the call be as speci-fied by the model.1 (model.2) argument.

Model arguments should not be "previous" or "next".

Page 80: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

isSubmodel 75

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel, makeModel, showModel, returnTest, propertyModel, makeCurrent,returnModel, and returnModelNumber.

Examples

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

# Generate some models, here by "backward":backward(recursive = TRUE, headlong = TRUE, coherent = TRUE, follow = TRUE,

object = CoCoObject);

# Show the model list:showModel("all", object = CoCoObject);

.set.switch(26921, "on");

.set.switch(26931, "on");

.set.switch(11081, "on");

.set.switch(11071, "on");

.set.switch(11061, "on");

.set.switch(6301, "on");

isSubmodel(object = CoCoObject); # TRUEisSubmodel(1, 4, object = CoCoObject); # FALSEisSubmodel(4, 1, object = CoCoObject); # TRUE

homogeneModel <- makeModel(enterModel("[[ab]] / [[aby][abx]] / [[x^][abxy][y^]]",object = CoCoObject));

# Numbers:

n6 <- returnModelNumber(homogeneModel, object = CoCoObject);

isSubmodel(object = CoCoObject); # TRUEisSubmodel(1, n6, object = CoCoObject); # FALSEisSubmodel(n6, 1, object = CoCoObject); # TRUE

# Text string with tags:

isSubmodel("base", "current", object = CoCoObject); # FALSE

Page 81: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

76 makeCurrent

isSubmodel("current", "base", object = CoCoObject); # TRUEisSubmodel("last", "base", object = CoCoObject); # TRUE

# Objects:

isSubmodel(fullModel, homogeneModel, object = CoCoObject); # FALSEisSubmodel(homogeneModel, fullModel, object = CoCoObject); # TRUE

# Non existing models:

isSubmodel("current", 7, object = CoCoObject); # NULLisSubmodel(7, "base", object = CoCoObject); # NULL

makeCurrent(7, object = CoCoObject);isSubmodel(1, 4, object = CoCoObject); # FALSEisSubmodel(4, 1, object = CoCoObject); # TRUE

showModel("all", object = CoCoObject);

makeCurrent(4, object = CoCoObject);isSubmodel("next", "base", object = CoCoObject); # Using current!isSubmodel("previous", "base", object = CoCoObject); # Using current!

# Text string with generating class:

isSubmodel("aby", object = CoCoObject); # TRUEisSubmodel("ab", "a,b", object = CoCoObject); # FALSE

enterModel("ab", object = CoCoObject);isSubmodel("aby", object = CoCoObject); # TRUE: Sub model of base!!!!makeBase(, object = CoCoObject);isSubmodel("aby", object = CoCoObject); # FALSE

endCoCo(object = CoCoObject);

makeCurrent Move the pointer named CURRENT (BASE) in the CoCo object

Description

Move the internal pointer named CURRENT (BASE) in the list of models in the CoCo object.Values returned from models are by default of the CURRENT model. By default, the CURRENTmodel is tested against the BASE model.

Usage

makeCurrent(model = "last", silent = TRUE, both = FALSE, push = FALSE,data = NULL, object = .object.of.model(model,

data = data, ...), ...)makeBase(model = "current", silent = TRUE, both = FALSE, push = FALSE,

Page 82: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

makeCurrent 77

data = NULL, object = .object.of.model(model,data = data, ...), ...)

Arguments

model Numeric, text string, or model object. If numeric then the CURRENT (BASE)pointer is moved to the model with that number (if the model is available).The model number is then returned. The text strings "base", "current","last", "previous", and "next"will cause the model pointer to be movedto respectively the BASE model, the CURRENT model, the LAST model (modelthe largest number), the model with the largest number smaller then the num-ber of the CURRENT (BASE) model, and finally the model with the smallestnumber larger then the number of the CURRENT (BASE) model.

silent Logical: If FALSE then some error messages are printed when the model is notavailable.

both Logical: If both is TRUE then both pointers (CURRENT and BASE) aremoved (in CoCoCg): For "next" and "previous" first the CURRENT(BASE) model of the call is set, and then the other pointer BASE (CURRENT)are moved to the same model.

push Logical: If push is TRUE then both pointers are pushed onto a stack internallyin the CoCoCg object - with the ability to restore the pointers by, e.g., the popargument to returnModelNumber.

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Details

The model first entered into a CoCo object is both BASE and CURRENT, and is given the number1. The BASE (first) model stays BASE until another model is declared as BASE. Additional enteredmodels, models created by editModel and models selected in steps of backward and forwardare given an increasing number, and inserted into the model list. The model last entered is theCURRENT model. The last model generated by editModel or selected in steps of backwardor forward is the LAST model, and can be named CURRENT by makeCurrent(model ="last", ...).

Value

The logical FALSE is returned, if the model is not available, else an integer is returned. If the modelargument is an integer or a model object then the model number is returned.

Note

both and push is only implemented for CoCoCg objects.

makeCurrent(model = "previous", ...) at the first model will return FALSE, butmakeCurrent(model = "next", ...) at the last model will set the CURRENT to thefirst model in the model list, and return an integer.

Page 83: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

78 makeCurrent

makeCurrent will not accept a text string with the generating class of a model as an argument.(makeCurrent without a CoCo object is irrelevant. )

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel, showModel, returnTest, isSubmodel, propertyModel, returnModeland returnModelNumber.

Examples

library(CoCo);data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);

# Enter the saturated model:enterModel("*", object = CoCoObject);

# Generate some models, here by "backward":backward(recursive = TRUE, headlong = TRUE, coherent = TRUE,

follow = TRUE, object = CoCoObject);

# Show the model list:showModel("all", object = CoCoObject);

# Test the last model against the saturated model (the first model):makeCurrent("last", object = CoCoObject);showTest(object = CoCoObject);

# "last" is default for makeCurrent:showModel("all", object = CoCoObject);makeCurrent(object = CoCoObject);showModel("all", object = CoCoObject);

# "current" is default for makeBase:makeBase(object = CoCoObject);showModel("all", object = CoCoObject);makeBase("current", object = CoCoObject);showModel("all", object = CoCoObject);

# Generate some more models, here by "editModel":

# enterModel("ADEF,ABDG.;", object = CoCoObject);

Page 84: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

numberVariates 79

enterModel("ACDE,ABCF.;", object = CoCoObject);makeBase(object = CoCoObject);

editModel(action = "drop.interactions", modification = "ABDG.;",object = CoCoObject);

makeCurrent("last", object = CoCoObject);showTest(object = CoCoObject);

editModel(action = "drop.edges", modification = "AD,BG.;",object = CoCoObject);

makeCurrent("last", object = CoCoObject);showTest(object = CoCoObject);

# enterModel("ADF,AEF,BD,G.;", object = CoCoObject);enterModel("ACE,ADE,BC,F.;", object = CoCoObject);makeCurrent("last", object = CoCoObject);showTest(object = CoCoObject);

enterModel(".;", object = CoCoObject);

showModel("all", object = CoCoObject);

makeBase(2, object = CoCoObject);makeCurrent(6, object = CoCoObject);

showModel("all", object = CoCoObject);

# Show the first 10 models:makeCurrent(10, object = CoCoObject)while(makeCurrent("previous",

object = CoCoObject)) showModel(object = CoCoObject)

# Show the first 10 models:makeCurrent(10, object = CoCoObject)while(returnModelNumber("current", object = CoCoObject) < 15) {

makeCurrent("next", object = CoCoObject);showModel(object = CoCoObject); }

endCoCo(object = CoCoObject);

numberVariates The number of variables in the CoCo object

Description

Return the number of variables entered into the CoCo object.

Usage

numberVariates(full = FALSE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Page 85: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

80 numberVariates

Arguments

full Logical, if full is TRUE then the number of specified variables is returned,that is number without setUseVariables.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

Numeric

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

setUseVariables and showOptions.

Examples

library(CoCo);data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);numberVariates(object = CoCoObject);

Specification <- returnVariableDescription(object = CoCoObject);setUseVariables(paste(Specification[[1]][c(1,3,4,6)], collapse = ""),

object = CoCoObject);enterTable(c(Reinis), object = CoCoObject);

numberVariates(object = CoCoObject);numberVariates(full = TRUE, object = CoCoObject);

showOptions("specification", object = CoCoObject);

endCoCo(object = CoCoObject);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();

Page 86: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

optionsCoCo 81

enterDataFrame(Rats, object = CoCoObject);

numberVariates(object = CoCoObject);numberVariates(full = TRUE, object = CoCoObject);

endCoCo(object = CoCoObject);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

library(CoCo);data(Byssinosis38);CoCoObject <- makeCoCo();enterTable(Byssinosis38, object = CoCoObject);

numberVariates(object = CoCoObject);

endCoCo(object = CoCoObject);

optionsCoCo Options settings for CoCo objects

Description

Allow the user to set and examine a variety of "options" for each CoCo object which affect the wayin which CoCo and CoCoCg computes and displays its results.

Usage

optionsCoCo(..., section = "all", status = FALSE, force.files = FALSE,data = NULL, object = .object.of.thing(data = data))

Arguments

... Any options can be defined, using ’name = value’, similar to options. Fur-ther, ’options(’name’) == options()[’name’]’, see the example. Those from thesection "cg" are only avaliable in CoCoCg.

section The character string "formats", "tests", "ips", "cg", "em", "exact","other", or "files".

status Logical, if status is TRUE, then the options values are also print on standardoutput.

force.files Logical. If section is "all" (default), then the options for files (names, etc.)are only returned if force.files is set to TRUE. ( You do not want to sharefile names between CoCo objects. )

data See exportCoCo.

object See exportCoCo.

Page 87: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

82 optionsCoCo

Details

Value

A list with the following items:

width int 127

height int 65

...

warnings logi TRUE

Formats

width int 127

height int 65

digits.table int 10

decimals.table.probabilities int 6

decimals.table.expected int 2

decimals.table.residual int 4

digits.test.statistics int 9

decimals.test.statistics int 4

digits.test.pvalues int 7

decimals.test.pvalues int 5

digits int 10

decimals int 4

pausing.of.output logi FALSE

n.lines int 22

short.test.output logi FALSE

Tests

algorithm chr "c": "a", "b" or "c"

partitioning logi TRUE

adjusted.df logi TRUE

power.lambda num 1

ic logi FALSE

bic logi FALSE

ic.kappa num 3

decomposable.mode logi FALSE

search.statistic chr "deviance": "deviance", "power", or "chisq"

Page 88: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

optionsCoCo 83

acceptance.limit num 0.05

rejection.limit num 0.05

components.limit num 2

separators.limit num 2

reuse.tests logi TRUE

Ips

ips.criterion chr "cell": "cell" or "sum"

ips.algorithm chr "normal": "normal", "arithmetic", "geometric", or "harmonic"

ips.number.of.iterations int 100

ips.epsilon num 1e-07

Cips

cips.criterion chr "cell": "cell" or "sum"

cips.cycles int 100

cips.epsilon num 1e-07

Cg

mixed.criterion chr "rell": "cell", "sum", "suff", or "rell"

mixed.cycles int 2000

mixed.epsilon num 1e-04

mixed.init.epsilon num 0.001

mixed.log.l.round.error num 1e-05

mixed.random.noise num 1e-04

mixed.min.lambda num 0.001

cholesky.epsilon num 1e-04

Em

em logi FALSE

em.number.of.iterations int 100

em.epsilon num 1e-07

em.initial chr "uniform": "uniform", "first", "last", "mean", "random", or "input"

Page 89: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

84 optionsCoCo

Exact

exact.test chr "off": "off", "flop", "on", "all", or "deviance"exact.epsilon num 1e-07

exact.test.joined.test logi TRUEexact.test.components logi TRUE

exact.test.unparted.test logi TRUEexact.test.only.for.log.l logi TRUEexact.number.of.tables int 1000

exact.list int [1:7] 20 2 1000 8 100 20 20exact.asymptotic num 2

fast logi TRUEexact.seed int 0

Other

graph.mode logi FALSEreport logi FALSEtrace logi FALSE

debug logi FALSEtimer logi FALSEecho logi FALSEnote logi FALSE

sorted logi FALSElarge logi FALSEhuge logi TRUE

graphical.search logi TRUEwarnings logi TRUE

Files

diary logi FALSEdiary.name chr "/home/jhb/CoCo.diary.001.tmp"keep.diary logi FALSE

dump logi FALSEdump.name chr ""keep.dump logi FALSE

report logi FALSEreport.name chr "/home/jhb/CoCo.report.003.tmp"keep.report logi FALSE

log logi TRUElog.name chr "/home/jhb/CoCo.log.002.tmp"keep.log logi FALSElog.data logi TRUE

Page 90: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

partialAssociations 85

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

options and showOptions.

Examples

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();

old.options <- optionsCoCo();

enterDataFrame(Rats, object = CoCoObject);

endCoCo(object = CoCoObject);

partialAssociationsShow partial associations

Description

Print on standard output the two dimensional tables with margins, possible for each configurationin the cross classification of other variables, and compute the measures of partial associations onthese tables.

Usage

partialAssociations(a = "", b = "", c = "", options, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

a A character string with the name of first variable.

b A character string with the name of second variable.

c A character string with the names of variables to condition on.

options A character string with options, currently not used.

data See exportCoCo.

Page 91: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

86 partialAssociations

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

Fisher’s exact test :

Pearson X.2 test :

G.2 likelihood ratio test :

Continuity-adj. X.2 :

Yates corrected X.2 :

McNemar test of symmetry :

Cramer’s V :

Phi :

Max Phi :

Contingency Coefficient C :

Max Contingency coef. :

Cross-product ratio alpha :

Mantel-Haenszel chi-square :

Pearson (product) corr. :

Spearman rank corr. coef. :

Ln(Cross-product ratio) :

Yule’s Q :

Yule’s Y :

Gamma, G :

Kendall’s Tau b :

Stuart’s Tau c :

Somers’ D, R|C :

Somers’ D, C|R :

Goodman-Kruskal’s Tau, R|C :

Goodman-Kruskal’s Tau, C|R :

Optimal pred. lambda, R|C :

Optimal pred. lambda, C|R :

Optimal pred. lambda, sym :

Optimal pred. lambda* R|C :

Optimal pred. lambda* C|R :

Uncertainty coef. U, R|C :

Uncertainty coef. U, C|R :

Uncertainty coef. U, sym :

Kappa :

Page 92: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

partialAssociations 87

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

showTest.

Examples

library(CoCo);data(HairEyeColor);CoCoObject <- makeCoCo();enterTable(HairEyeColor, object = CoCoObject);

partialAssociations(":Hair:Eye", object = CoCoObject);partialAssociations(":Hair", ":Eye", object = CoCoObject);partialAssociations(":Hair", ":Eye", ":Sex", object = CoCoObject);

endCoCo(object = CoCoObject);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

library(CoCo);data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);partialAssociations("AB", object = CoCoObject);

setOrdinal("AB", object = CoCoObject);partialAssociations("AB", object = CoCoObject);

# Get Fisher's EXACT test when the total count of the sub table# is less than 1000:

partialAssociations("A", "B", "F", object = CoCoObject);

endCoCo(object = CoCoObject);

Page 93: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

88 propertyModel

propertyModel Ask a query for a model

Description

Test a query for a model.

Usage

propertyModel(query = "chordal", model = FALSE,prior.action = NULL, modification = NULL, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

query A character string. The argument query is "graphical", "decomposable",(or "chordal", "triangulated", or "rigid.circuit"), "tree","connected", "undirected" (or "skeleton"), "moral", "acyclic","MIM-model", "mean-linear", "d-collapsible", "q-equivalent","homogeneous", "full-specified", "degenerated", "discrete"(or "pure-discrete"), "continuous" (or "pure-continuous"), "mixed",or "regression" (or "cg-regression").

model See returnModel.

prior.action A character string, if prior.action is set, then the model is modified by thisaction before asking the query. See editModel.

modification See editModel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

Graphical :

Decomposable (or "chordal", "triangulated", or "rigid.circuit"):

Tree :

Connected :

Undirected (or "skeleton"):

Moral :

Acyclic :

MIM-model :

Degenerated :

Page 94: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

propertyModel 89

Mean-linear :

D-collapsible :

Q-equivalent :

Homogeneous :

Full-specified :

Discrete (or "pure-discrete"):

Continuous (or "pure-continuous"):

Mixed (or "regression" or "cg-regression"):

Value

Logical.

Author(s)

Jens Henrik Badsberg

See Also

propertySet.

Examples

library(CoCo);data(Fuchs82);CoCoObject <- makeCoCo();enterTable(Fuchs82, object = CoCoObject);

enterModel("mdp,da,am,dg,gs,sa", object = CoCoObject);

propertyModel("graphical", object = CoCoObject);propertyModel("decomposable", object = CoCoObject);propertyModel("connected", object = CoCoObject);propertyModel("tree", object = CoCoObject);

enterModel("*", object = CoCoObject);backward(recursive = TRUE, follow = TRUE, object = CoCoObject);makeCurrent("last", object = CoCoObject);showModel("all", object = CoCoObject);propertyModel("graphical", object = CoCoObject);propertyModel("decomposable", object = CoCoObject);propertyModel("connected", object = CoCoObject);propertyModel("tree", object = CoCoObject);

editModel("drop.edges", "md", object = CoCoObject);makeCurrent("last", object = CoCoObject);showModel("all", object = CoCoObject);propertyModel("graphical", object = CoCoObject);propertyModel("decomposable", object = CoCoObject);

Page 95: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

90 propertySet

propertyModel("connected", object = CoCoObject);propertyModel("tree", object = CoCoObject);

endCoCo(CoCoObject);

propertySet Ask a query for a set of variables

Description

Test a query for a subset of the variables of a model.

Usage

propertySet(query = "in.one.clique", set = "", set.a = "", set.b = "",model = FALSE, prior.action = NULL,modification = NULL, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

query A character string with the query: "is.separator", "is.d-separator",or "in.one.clique".

set A character string: Test whether set is in one and only one clique or a separatoraccording to the argument query.

set.a A character string: If query is "is.separator" or "is.d-separator"and set.a and set.b are given, then it is tested whether set separatesset.a and set.b in the model.

set.b A character string: See argument set.a.

model See returnModel.

prior.action A character string, if prior.action is set, then the model is modified by thisaction before asking the query. See editModel.

modification See editModel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

In one clique :

Is separator :

Is d-separator :

Page 96: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

propertySet 91

Value

Logical

Author(s)

Jens Henrik Badsberg

See Also

propertyModel.

Examples

library(CoCo);

data(Fuchs82);

CoCoObject <- makeCoCo();enterTable(Fuchs82, object = CoCoObject);

enterModel("mdp,da,am,dg,gs,sa", object = CoCoObject);

propertySet("in.one.clique", set = "d,m.", object = CoCoObject);

propertySet(query = "separator", set = "ds.", object = CoCoObject);propertySet(query = "separator", set = "a.", object = CoCoObject);propertySet(query = "separator", set = "ag.", object = CoCoObject);propertySet(query = "separator", set = "adm.", object = CoCoObject);propertySet(query = "separator", set = "am.", object = CoCoObject);propertySet(query = "separator", set = "dm.", object = CoCoObject);

returnSets(model = FALSE, type = "is.separator", set = "dm.",object = CoCoObject);

propertySet(query = "separator", set = "d.",set.a = "dpm", set.b = "gsa", object = CoCoObject);

propertySet(query = "separator", set = "da.",set.a = "dpm", set.b = "gs", object = CoCoObject);

propertySet(query = "separator", set = "da.",set.a = "dpm", set.b = "gsa", object = CoCoObject);

propertySet(query = "separator", set = "dm.",set.a = "dpm", set.b = "gsa", object = CoCoObject);

propertySet(query = "separator", set = "ds.", set.a = "dpm", set.b = "ga");

enterModel("gasd,adm,dpm.;", object = CoCoObject);

propertySet("in.one.clique", set = "d,s.", object = CoCoObject);propertySet("in.one.clique", set = "d,m.", object = CoCoObject);propertySet("in.one.clique", set = "s,p.", object = CoCoObject);

endCoCo(CoCoObject);

Page 97: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

92 randomTableReplacement

randomTableReplacementReplace the table of counts with a random table with margins un-changed

Description

Replace the table observed counts with random table of counts but with counts as the counts of thesufficient tables for the decomposable model.

Usage

randomTableReplacement(model = "current", data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

model See returnModel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterDataFrame.

Examples

library(CoCo);data(HairEyeColor);CoCoObject <- makeCoCo();enterTable(HairEyeColor, object = CoCoObject);enterModel(":Hair:Sex,:Eye:Sex", object = CoCoObject);

Page 98: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnDeviance 93

returnTable("observed", "*", object = CoCoObject);returnTable("observed", ":Hair:Sex", object = CoCoObject);returnTable("observed", ":Eye:Sex", object = CoCoObject);

randomTableReplacement(object = CoCoObject);returnTable("observed", "*", object = CoCoObject);returnTable("observed", ":Hair:Sex", object = CoCoObject);returnTable("observed", ":Eye:Sex", object = CoCoObject);

randomTableReplacement(object = CoCoObject);returnTable("observed", "*", object = CoCoObject);returnTable("observed", ":Hair:Sex", object = CoCoObject);returnTable("observed", ":Eye:Sex", object = CoCoObject);

endCoCo(object = CoCoObject);

returnDeviance Return likelihoods, deviance, dimensions, etc.

Description

Returns the test statistics (deviance and F-test statistics) with p-values based on the likelihoods andthe dimensions of the two argument models. For discrete models also an adjustment of the degreesof freedom is returned.

Usage

returnDeviance(model.1 = "current", model.2 = "base", data = NULL,object = .object.of.models(model.1, model.2,

data = data, ...), ...)

Arguments

model.1 See isSubmodel.

model.2 See isSubmodel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

A labeled vector of reals.

Note

A vector of zeros is returned if an error occurs. returnTest will return NULL if the models arenot available or nested.

Page 99: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

94 returnEdges

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel, makeModel, showModel, makeCurrent, returnModel, returnModelNumber,partialAssociations, optionsCoCo, showTest, showDeviance, returnTest, backwardand forward.

Examples

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

# ( Should be replaced by calculation of the tests of David Edwards book. )

# Generate some models, here by "backward":backward(recursive = TRUE, headlong = TRUE, coherent = TRUE,

follow = TRUE, object = CoCoObject);

# Show the model list:showModel("all", object = CoCoObject);

returnDeviance("last", 1, object = CoCoObject);

homogeneModel <- makeModel(enterModel("[[ab]] / [[aby][abx]] / [[x^][abxy][y^]]",object = CoCoObject));

returnDeviance("last", 1, object = CoCoObject);

endCoCo(object = CoCoObject);

returnEdges Return the indices of vertices of edges

Page 100: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnEdges 95

Description

Return a matrix with the indices of the vertices of the edges. The edges can be the edges of themodel, the edges not in the model, or the model can be ignored (and thus the edges are returnedfrom the saturated model according to the fixing of edges). And the edges can be edges not fixed inthe model, edges fixed in the model, or the fixing of edges can be ignored.

Usage

returnEdges(model = "current", edges = "in.model", fix = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See returnModel.

edges Text string: "in.model", "all", or "not.in.model". Default: "in.model".

fix Text string: "fix.edges", "ignore.fixing" (ignore fixing of edges), or"not.fix.edges". Default: "not.fix.edges".

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

A matrix of integers with the indices of the variables of the edges.

Note

Fixing of edges is set by backward, forward, and by ehForceFix.

Author(s)

Jens Henrik Badsberg

See Also

backward, forward, eh, ehForceFix, returnFix and showOptions.

Examples

library(CoCoCg);

# Without "data" require ending the CoCo object:

# returnEdges("ab,xy", data = "From.input", continuous = "xy");# endCoCo();

# With CoCo object:

Page 101: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

96 returnEdges

data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);

Base <- makeModel(enterModel("[[ab]] / [[ay][ax][bx]] / [[xy]]",object = CoCoObject));

Current <- makeModel(enterModel("[[a][b]] / [[ay][ax][bx]] / [[xy]]",object = CoCoObject));

showModel("all");

returnEdges(object = CoCoObject);

returnEdges("base", object = CoCoObject); # Does not work ?!?returnEdges(Base, object = CoCoObject);returnEdges(1, object = CoCoObject);returnEdges("current", object = CoCoObject);returnEdges(Current, object = CoCoObject);returnEdges(4, object = CoCoObject);returnEdges("last", object = CoCoObject);returnEdges(8, object = CoCoObject); # ?!?: Should return NULL!!!

returnEdges("ab", object = CoCoObject);returnEdges("xy", object = CoCoObject);returnEdges("axy", object = CoCoObject);

backward(recursive = TRUE, headlong = TRUE, coherent = TRUE, follow = TRUE,fix.edges = "xy", object = CoCoObject);

# .fix.edges("xy", object = CoCoObject);

returnEdges(object = CoCoObject);

returnEdges(fix = "all", object = CoCoObject);returnEdges(fix = "fix.edges", object = CoCoObject);returnEdges(fix = "non.fix.edges", object = CoCoObject);

returnEdges(edges = "all", object = CoCoObject);returnEdges(edges = "in.model", object = CoCoObject);returnEdges(edges = "not.in.model", object = CoCoObject);

returnEdges(edges = "all", fix = "all", object = CoCoObject);returnEdges(edges = "in.model", fix = "all", object = CoCoObject);returnEdges(edges = "not.in.model", fix = "all", object = CoCoObject);

returnEdges(edges = "all", fix = "fix.edges", object = CoCoObject);returnEdges(edges = "in.model", fix = "fix.edges", object = CoCoObject);returnEdges(edges = "not.in.model", fix = "fix.edges", object = CoCoObject);

returnEdges(edges = "all", fix = "non.fix.edges", object = CoCoObject);returnEdges(edges = "in.model", fix = "non.fix.edges", object = CoCoObject);

Page 102: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnExpression 97

returnEdges(edges = "not.in.model", fix = "non.fix.edges", object = CoCoObject);

endCoCo(object = CoCoObject);

returnExpression Return the expression of the estimates of parameters

Description

Return closed form expression for the parameter estimates.

Usage

returnExpression(model = "current", type = "expression",omit.prime.components = FALSE, omit.separators = FALSE,omit.generators = FALSE, state.space = FALSE,return.flags = FALSE, split.sets = FALSE,split.models = TRUE, split.generators = TRUE,eliminate.empty = TRUE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See returnModel.

type A character string: type can be "expression", "prime.components","separators", or "junction.tree.components". The type "junction.-", "tree.components" are only avaliable in CoCoCg objects.

omit.prime.componentsLogical, if omit.prime.components is TRUE then prime components areomitted, only separators are returned.

omit.separatorsLogical, if omit.separators is TRUE then separators are omitted, the primecomponents are returned.

omit.generatorsLogical, if omit.generators is TRUE then generators of non decompos-able irreducible components are omitted, for non decomposable irreducible com-ponents only the vertex sets are returned.

state.space Logical, if state.space is TRUE then variable sets of irreducible compo-nents are returned.

return.flags Logical, if return.flags is TRUE then flags are return for each irreduciblecomponent of mixed models. Only for CoCoCg objects. See also returnJunctionTree.

split.sets Logical, if split.sets is TRUE then for mixed models the character stringsfor variables in irreducible components and separators are split into lists of vari-ables. Only for CoCoCg objects. See also returnJunctionTree.

Page 103: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

98 returnExpression

split.models Logical, if split.models is TRUE then the character string with the mixedmodel is split into 3 lists: discrete, linear and quadratic generators. Only forCoCoCg objects. See also returnJunctionTree.

split.generatorsLogical, if split.generators is TRUE then each generator of a mixedmodel is split into a list of variables. Only for CoCoCg objects. See alsoreturnJunctionTree.

eliminate.emptyLogical, if eliminate.empty is TRUE then empty sets are eliminated. Onlyfor CoCoCg objects. See also returnJunctionTree.

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Value

For discrete model in CoCo, a list with

[[1]] A character string with complete components, separators and non-decomposableirreducible components with generators,

[[2]] A numeric vector with the indices of the complete components and separators,

[[3]] A constant for the model depending on the discrete variables not in the model.

In CoCoCg ...

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

returnJunctionTree.

Examples

library(CoCo);data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);

# Enter the saturated model:enterModel("*", object = CoCoObject);

Page 104: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnExpression 99

# Generate some models, here by "backward":backward(recursive = TRUE, headlong = TRUE, coherent = TRUE, follow = TRUE);

# Show the model list:showModel("all", object = CoCoObject);

makeCurrent("last", object = CoCoObject);

returnExpression(object = CoCoObject);

str(returnExpression(type = "expression", object = CoCoObject));

str(returnExpression(omit.prime.components = TRUE, object = CoCoObject));str(returnExpression(omit.separators = TRUE, object = CoCoObject));str(returnExpression(omit.generators = TRUE, object = CoCoObject));

str(returnExpression(type = "separators", object = CoCoObject));str(returnExpression(type = "prime.components", object = CoCoObject));

str(returnExpression(state.space = TRUE, object = CoCoObject)); # ?

endCoCo(CoCoObject);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

enterModel("[[a][b]] / [[ay][ax][bx]] / [[xy]]", object = CoCoObject);

showModel("all", object = CoCoObject);

makeCurrent("last", object = CoCoObject);

returnExpression(object = CoCoObject);

str(returnExpression(type = "expression", object = CoCoObject));

str(returnExpression(omit.prime.components = TRUE, object = CoCoObject));str(returnExpression(omit.separators = TRUE, object = CoCoObject));str(returnExpression(omit.generators = TRUE, object = CoCoObject));

str(returnExpression(type = "separators", object = CoCoObject));str(returnExpression(type = "prime.components", object = CoCoObject));

str(returnExpression(state.space = TRUE, object = CoCoObject)); # ?

str(returnExpression(return.flags = TRUE, object = CoCoObject));

str(returnExpression(split.sets = TRUE, object = CoCoObject)); # ?

Page 105: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

100 returnExpression

str(returnExpression(eliminate.empty = FALSE, object = CoCoObject)); # ?

str(returnExpression(type = "junction.tree.components",split.models = FALSE, object = CoCoObject));

str(returnExpression(type = "junction.tree.components",split.generators = FALSE, object = CoCoObject));

endCoCo(CoCoObject);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

data(Fuchs82);

CoCoObject <- makeCoCo();enterTable(Fuchs82, object = CoCoObject);

enterModel("mdp,da,am,dg,gs,sa", object = CoCoObject);

# State-space, with generators:returnExpression(model = FALSE, type = "expression",

omit.prime.components = FALSE, omit.separators = FALSE,omit.generators = FALSE, state.space = TRUE, object = CoCoObject);

# State-space, without generators:returnExpression(model = FALSE, type = "expression",

omit.prime.components = FALSE, omit.separators = FALSE,omit.generators = TRUE, state.space = TRUE, object = CoCoObject);

showFormula(object = CoCoObject);

# State-space, with generators:returnExpression(model = FALSE, type = "expression",

omit.prime.components = FALSE, omit.separators = FALSE,omit.generators = FALSE, state.space = TRUE, object = CoCoObject);

# State-space, without generators:returnExpression(model = FALSE, type = "expression",

omit.prime.components = FALSE, omit.separators = FALSE,omit.generators = TRUE, state.space = TRUE, object = CoCoObject);

# Expression:returnExpression(model = FALSE, type = "expression",

omit.prime.components = FALSE, omit.separators = FALSE,omit.generators = FALSE, state.space = FALSE, object = CoCoObject);

# Expression, without generators:returnExpression(model = FALSE, type = "expression",

omit.prime.components = FALSE, omit.separators = FALSE,omit.generators = TRUE, state.space = FALSE, object = CoCoObject);

# Prime components:returnExpression(model = FALSE, type = "expression",

Page 106: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnFix 101

omit.prime.components = FALSE, omit.separators = TRUE,omit.generators = TRUE, state.space = FALSE, object = CoCoObject);

returnExpression(model = FALSE, type = "prime.components", object = CoCoObject);

# Separators:returnExpression(model = FALSE, type = "expression",

omit.prime.components = TRUE, omit.separators = FALSE,omit.generators = TRUE, state.space = FALSE, object = CoCoObject);

returnExpression(model = FALSE, type = "separators", object = CoCoObject);

endCoCo(object = CoCoObject);

returnFix Return the edges fixed in model selection

Description

Return the edges fixed (e.i. not considered for removal in the latest call of backward or notconsidered for entering in the latest call of forward), or edges banned or forced into the EHprocedure by ehForceFix.

Usage

returnFix(code = "edges", data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

code A text string with "edges" (edges not considered for removal in the latest callof backward or not considered for entering in the latest call of forward),"in" (edges forced into EH by ehForceFix("what", fix = "in",...)), or "out" (edges banned in EH by ehForceFix("what", fix ="out", ...)).

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Value

A text string with a generating class of the fixing.

Note

Fixing of edges is set by backward, forward, and ehForceFix.

Page 107: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

102 returnJunctionTree

Author(s)

Jens Henrik Badsberg

See Also

forward, backward, eh, ehForceFix, returnFix and showOptions.

Examples

library(CoCo);data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);

# Enter the saturated model:enterModel("*", object = CoCoObject);

# Set a fixing of edges in "backward":

backward(recursive = TRUE, headlong = TRUE, coherent = TRUE, follow = TRUE,fix.edges = "[[AB][EF]]", object = CoCoObject);

returnFix(object = CoCoObject);

ehForceFix("DE", fix = "in", object = CoCoObject)ehForceFix("EF", fix = "out", object = CoCoObject)

returnFix("edges", object = CoCoObject);returnFix("in", object = CoCoObject);returnFix("out", object = CoCoObject);

eh(object = CoCoObject);

returnFix("edges", object = CoCoObject);returnFix("in", object = CoCoObject);returnFix("out", object = CoCoObject);

endCoCo(object = CoCoObject);

returnJunctionTree Return the junction tree

Description

Return the junction tree.

Page 108: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnJunctionTree 103

Usage

returnJunctionTree(model = "current", type = "junction.tree.components",omit.prime.components = FALSE, omit.separators = FALSE,omit.generators = FALSE, state.space = FALSE,return.flags = FALSE, split.sets = FALSE,split.models = TRUE, split.generators = TRUE,eliminate.empty = TRUE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See returnModel.

type A character string: type should be "junction.tree.components".omit.prime.components

Logical, if omit.prime.components is TRUE then prime components areomitted, only separators are returned.

omit.separatorsLogical, if omit.separators is TRUE then separators are omitted, the primecomponents are returned.

omit.generatorsLogical, if omit.generators is TRUE then generators of non decompos-able irreducible components are omitted, for non decomposable irreducible com-ponents only the vertex sets are returned.

state.space Logical, if state.space is TRUE then variable sets of irreducible compo-nents are returned.

return.flags Logical, if return.flags is TRUE then flags are return for each irreduciblecomponent of mixed models.

split.sets Logical, if split.sets is TRUE then for mixed models the character stringsfor variables in irreducible components and separators are split into lists of vari-ables.

split.models Logical, if split.models is TRUE then the character string with the mixedmodel is split into 3 lists: discrete, linear and quadratic generators.

split.generatorsLogical, if split.generators is TRUE then each generator of a mixedmodel is split into a list of variables.

eliminate.emptyLogical, if eliminate.empty is TRUE then empty sets are eliminated.

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Value

A tree structure with the junction tree.

Page 109: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

104 returnJunctionTree

Note

The function is only available for CoCoCg objects.

Author(s)

Jens Henrik Badsberg

See Also

returnExpression.

Examples

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

enterModel("[[a][b]] / [[ay][ax][bx]] / [[xy]]", object = CoCoObject);

showModel("all", object = CoCoObject);

makeCurrent("last", object = CoCoObject);

str(returnJunctionTree(object = CoCoObject));

str(returnJunctionTree(split.models = FALSE, object = CoCoObject));str(returnJunctionTree(split.generators = FALSE, object = CoCoObject));

str(returnJunctionTree(omit.generators = TRUE, object = CoCoObject));str(returnJunctionTree(omit.generators = TRUE, split.sets = TRUE,

object = CoCoObject));

str(returnJunctionTree(omit.separators = TRUE, split.models = FALSE,object = CoCoObject));

str(returnJunctionTree(omit.separators = TRUE, split.models = FALSE,eliminate.empty = TRUE, object = CoCoObject)); # ?

str(returnJunctionTree(omit.separators = TRUE, split.models = FALSE,omit.generator = TRUE, object = CoCoObject));

str(returnJunctionTree(omit.separators = TRUE, split.models = FALSE,return.flags = TRUE,omit.generator = TRUE, object = CoCoObject));

str(returnJunctionTree(omit.separators = TRUE, split.models = FALSE,return.flags = TRUE, state.space = TRUE,omit.generator = TRUE, object = CoCoObject));

Page 110: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnModel 105

endCoCo(CoCoObject);

returnModel Return the model

Description

Return the model or parts of it as a generating class.

Usage

returnModel(model = "current", type = "both", as.edges = FALSE,split.string = FALSE, split.generators = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model Numeric, model object, text string, or logical. A numeric should give a validmodel number in the object, see makeCurrent about the model list. Theargument can also be a CoCo model object, see makeModel about creatingmodel objects. A text string can give the model as a generating class (or gener-ating classes in MIM-form for mixed models), see enterModel for the nota-tion of models. The text strings "base", "current", or "last" refers tothe three models. The default value "current" for the CURRENT model canalso be given as the logical FALSE.

type A character string, selecting "gc": generating class(es), "cs": causal struc-ture, "both": both the generating class(es) and the causal structure, "discrete":discrete part of mixed models, "linear": linear part of mixed models, and"quadratic": quadratic part of mixed models.

as.edges Logical, if as.edges is TRUE then the edges of the model are returned.

split.string Logical, if split.string is TRUE then the generating classes are split intocharacter strings with the generators.

split.generatorsLogical, if split.generators is TRUE then the generating classes are splitinto lists, each item in the list a vector of character string with the vertices of agenerator.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

A character string, a vector of character strings, a list of vectors of character strings, or a matrix ofintegers.

Page 111: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

106 returnModel

Note

Currently only the generating class can be returned by as.edges.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

returnEdges.

Examples

library(CoCoCg);

# Without "data" require ending the CoCo object:

# returnModel("abxy,bcyz", type = "linear", data = "From.input", continuous = "xyz");# endCoCo();

# With CoCo a object:

data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

enterModel("[[b][a]] / [[by][bx][ay][ax]] / [[xy]]", object = CoCoObject);enterModel("[[a][b]] / [[ay][ax][bx]] / [[xy]]", object = CoCoObject);

homogeneModel <- makeModel(enterModel("[[ab]] / [[aby][abx]] / [[x^][abxy][y^]]",object = CoCoObject));

# Show the model list:

showModel("all", object = CoCoObject);

returnModel(object = CoCoObject);

returnModel(type="discrete", object = CoCoObject);returnModel(type="linear", object = CoCoObject);returnModel(type="quadratic", object = CoCoObject);

returnModel(type="gc", object = CoCoObject);returnModel(type="cs", object = CoCoObject);

returnModel(3, type="gc", object = CoCoObject);

Page 112: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnModelNumber 107

returnModel(3, type="discrete", object = CoCoObject);returnModel(3, type="linear", object = CoCoObject);returnModel(3, type="quadratic", object = CoCoObject);

returnModel(3, object = CoCoObject, split.string = TRUE);str(returnModel(3, object = CoCoObject, split.generators = TRUE));

returnModel(3, object = CoCoObject, as.edges = TRUE);.fix.edges("xy")returnModel(3, object = CoCoObject, as.edges = TRUE);returnModel(3, object = CoCoObject, as.edges = TRUE, fix = "all");

returnModel("abx", type = "discrete", object = CoCoObject);returnModel("a,bx", type = "discrete", object = CoCoObject);

endCoCo(object = CoCoObject);

returnModelNumber Return the number of the CURRENT, BASE, or the LAST model

Description

Return the internal model number of the CURRENT, the BASE. or the LAST model in the CoCoobject.

Usage

returnModelNumber(model = FALSE, no.warnings = FALSE, pop = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model The text string "base", "current" or "last".

no.warnings Logical, if no.warnings is set to TRUE then no warnings is given if themodel is not available.

pop Logical: If pop is set to TRUE in CoCoCg then the CURRENT and BASEpointers are set to the top pointers of the stack of CURRENT and BASE pointersin the CoCo object, see push at makeCurrent.

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Value

An integer with the model number, if the model is avaliable, else NULL.

Page 113: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

108 returnModelVariates

Note

pop is only implemented for CoCoCg objects.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel, showModel, returnTest, isSubmodel, propertyModel, makeCurrentand returnModel.

returnModelVariatesReturn the variates of the model

Description

Return the variables of the model.

Usage

returnModelVariates(model = FALSE, as.string = TRUE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See returnModel.

as.string Logical, if as.string is false then a vector of integers is returned. 1 (0) forvariables (not) in the model.

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Value

A character string with the variates of the model, or a vector of integers, 1 (0) for variables (not) inthe model.

Author(s)

Jens Henrik Badsberg

Page 114: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnNcells 109

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

returnModel.

Examples

library(CoCoCg);

data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

enterModel("ab,by", object = CoCoObject);enterModel("bx", object = CoCoObject);

returnModelVariates(1, object = CoCoObject);returnModelVariates(object = CoCoObject);

returnModelVariates(1, as.string = FALSE, object = CoCoObject);returnModelVariates(as.string = FALSE, object = CoCoObject);returnModelVariates(3, as.string = FALSE, object = CoCoObject);

returnModelVariates("by", as.string = FALSE, object = CoCoObject);

endCoCo(object = CoCoObject);

returnNcells Return the number of cells in a table

Description

Return the number of cells in the table formed by the cross classification according to a given set ofdiscrete variables.

Usage

returnNcells(set = "*", full = FALSE, total = FALSE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Page 115: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

110 returnNcells

Arguments

set A character string with a set of discrete variables.

full Logical, if full is TRUE then all specified variables (setUseVariables)are considered.

total Logical, if total is TRUE then also missing levels (excludeMissing) arecounted.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

An integer.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterNames, setUseVariables and excludeMissing.

Examples

library(CoCo)data(Hochberg77)ftable(Hochberg77, col.vars=4:6)

# Without "data" require ending the CoCo object:

# returnNcells(data = Hochberg77);# endCoCo();

# With CoCo object:

CoCoObject <- makeCoCo();

enterTable(Hochberg77, missing = c(1, 1, 0, 0, 0, 0), object = CoCoObject);

showOptions("specification", object = CoCoObject)

returnNcells(object = CoCoObject);

Page 116: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnSets 111

# With only a subset:

missing <- c(1, 1, 0, 0, 0, 0);enterNames(names(dimnames(Hochberg77)),

levels = dim(Hochberg77) - missing,missing = missing, CoCoObject);

setUseVariables("bcdef.", object = CoCoObject)

enterTable(c(Hochberg77), object = CoCoObject);

showOptions("specification", object = CoCoObject)

returnNcells(object = CoCoObject);

returnNcells(set = "abc", object = CoCoObject);

returnNcells(set = "bc.", full = FALSE, total = FALSE, object = CoCoObject);returnNcells(set = "bc.", full = FALSE, total = TRUE, object = CoCoObject);returnNcells(set = "abc.", full = TRUE, total = FALSE, object = CoCoObject);returnNcells(set = "abc.", full = TRUE, total = TRUE, object = CoCoObject);

excludeMissing("in", set = "bc.", object = CoCoObject);

returnNcells(set = "bc.", full = FALSE, total = FALSE, object = CoCoObject);returnNcells(set = "bc.", full = FALSE, total = TRUE, object = CoCoObject);returnNcells(set = "abc.", full = TRUE, total = FALSE, object = CoCoObject);returnNcells(set = "abc.", full = TRUE, total = TRUE, object = CoCoObject);

endCoCo(object = CoCoObject);

# With continuous:

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);returnNcells(set = "ab;", object = CoCoObject);returnNcells(object = CoCoObject);

endCoCo(object = CoCoObject);

returnSets Return a specific subset of the variables

Description

Return for a model the connected component containing a specific set, connected components,prime components, junction tree components, chain components, ancestral set, shortest paths be-

Page 117: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

112 returnSets

tween two sets, cut sets, separators, D-separators, neighbours of a set, TRUE if s set is a separator,or TRUE if s set is a d-separator.

Usage

returnSets(model = FALSE, set = "", set.a = "", set.b = "",u = "", v = "", type = "primes",split.gc = FALSE, split.generators = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See returnModel.

set A character string with a variable set.

set.a A character string with a variable set.

set.b A character string with a variable set.

u A character string with a single variable name.

v A character string with a single variable name.

type A character string with the text "connected.component" (set used),"connected.components", "prime.components", "chain.components","junction.tree.components", "ancestral.set", "shortest.paths"(u and v used), "cut.sets" (u and v or set.a and set.a used), "separators","d-separators", "neighbours", (set used), "is.separator", (setused), "is.d-separator", (set used).

split.gc See returnModel.split.generators

See returnModel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

Connected component : (set used)

Connected components :

Prime components :

Junction tree components :

Chain components :

Ancestral set :

Shortest paths : (u and v used)

Cut sets : (u and v or set.a and set.a used)

Separators :

Page 118: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnSets 113

D-separators :

Neighbours : (set used)

Is separator : (set used)

Is d-separator : (set used)

Value

A boolean, NULL, a list with the component string with a generating class, a list with vectors ofcharacter strings of variables, or a vector of character strings of sets of variable.

ToDo

Separators not returned from mixed models.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

propertySet, propertyModel, and returnVertexOrder.

Examples

library(CoCo);data(Fuchs82);

CoCoObject <- makeCoCo();enterTable(Fuchs82, object = CoCoObject);

enterModel("mdp,da,am,dg,gs,sa", object = CoCoObject);

returnSets(model = "current", type = "connected.component", set = "dm",object = CoCoObject);

returnSets(model = "current", type = "connected.components",object = CoCoObject);

returnSets(model = "current", type = "prime.components",object = CoCoObject);

returnExpression(type = "prime.components",object = CoCoObject);

returnSets(model = "current", type = "junction.tree.components",object = CoCoObject);

returnSets(model = "current", type = "chain.components",object = CoCoObject);

Page 119: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

114 returnSets

returnSets(model = "current", type = "ancestral.set",object = CoCoObject);

returnSets(model = "current", type = "shortests.paths", u = "s", v = "p",object = CoCoObject);

returnSets(model = "current", type = "cut.sets", u = "s", v = "p",object = CoCoObject);

returnSets(model = "current", type = "cut.sets", set.a = "sg", set.b = "p",object = CoCoObject);

returnSets(model = "current", type = "separators",object = CoCoObject);

returnSets(model = "current", type = "d-separators",object = CoCoObject);

returnSets(model = "current", type = "neighbours", set = "dm",object = CoCoObject);

returnSets(model = "current", type = "is.separator", set = "dm",object = CoCoObject);

returnSets(model = "current", type = "is.d-separator", set = "dm",object = CoCoObject);

returnModel(object = CoCoObject);

returnModel(split.generators = TRUE, object = CoCoObject);

returnSets(model = FALSE, type = "neighbours", set = c("d", "m"),object = CoCoObject);

returnSets(model = FALSE, type = "neighbours", set = "dm",object = CoCoObject);

returnSets(model = FALSE, type = "neighbours", set = "[dm]",object = CoCoObject);

returnSets(model = "current", type = "separators",split.gc = TRUE, object = CoCoObject);

returnSets(model = "current", type = "separators",split.generator = TRUE, split.gc = TRUE, object = CoCoObject);

returnSets(model = "current", type = "separators",split.generator = TRUE, object = CoCoObject); # ?

endCoCo(object = CoCoObject);

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);enterModel("ax,xb,y.", object = CoCoObject);

returnSets(model = "current", type = "connected.component", set = "ax",object = CoCoObject);

returnSets(model = "current", type = "connected.components",object = CoCoObject);

Page 120: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnSets 115

returnSets(model = "current", type = "prime.components",object = CoCoObject);

returnExpression(type = "prime.components",object = CoCoObject);

returnSets(model = "current", type = "junction.tree.components",object = CoCoObject);

returnSets(model = "current", type = "chain.components",object = CoCoObject);

returnSets(model = "current", type = "ancestral.set",object = CoCoObject);

returnSets(model = "current", type = "shortests.paths", u = "a", v = "b",object = CoCoObject);

returnSets(model = "current", type = "cut.sets", u = "a", v = "b",object = CoCoObject);

returnSets(model = "current", type = "cut.sets", set.a = "a", set.b = "b",object = CoCoObject);

returnSets(model = "current", type = "separators",object = CoCoObject); # ?

returnSets(model = "current", type = "d-separators",object = CoCoObject);

returnSets(model = "current", type = "neighbours", set = "x",object = CoCoObject);

returnSets(model = "current", type = "is.separator", set = "x",object = CoCoObject);

returnSets(model = "current", type = "is.d-separator", set = "x",object = CoCoObject);

returnModel(object = CoCoObject);

returnModel(split.generators = TRUE, object = CoCoObject);

returnSets(model = FALSE, type = "neighbours", set = c("x", "b"),object = CoCoObject);

returnSets(model = FALSE, type = "neighbours", set = "x",object = CoCoObject);

returnSets(model = FALSE, type = "neighbours", set = "[x]",object = CoCoObject);

returnSets(model = "current", type = "separators",split.gc = TRUE, object = CoCoObject);

returnSets(model = "current", type = "separators",split.generator = TRUE, split.gc = TRUE, object = CoCoObject);

returnSets(model = "current", type = "separators",split.generator = TRUE, object = CoCoObject); # ?

Page 121: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

116 returnTable

returnSets(model = "current", type = "separators",split.gc = TRUE, object = CoCoObject); # ?

returnSets(model = "current", type = "separators",split.generator = TRUE, split.gc = TRUE, object = CoCoObject); # ?

returnSets(model = "current", type = "separators",split.generator = TRUE, object = CoCoObject); # ?

endCoCo(object = CoCoObject);

returnTable Return the counts and fitted values of a marginal table

Description

Return the observed probabilities, counts, means, covariance matrix, canonical parameters, fittedvalues, residuals, etc. of marginal tables.

Usage

returnTable(type = "observed", set = "*", model = FALSE,random = FALSE, log.transformed = FALSE, complete = FALSE,discrete.ordered = TRUE, dump = FALSE, label = TRUE,split = TRUE, discrete.outer = TRUE, mixed = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

type See also showTable. For setwith only discrete variables the type "sparse.table"is avaliable to return the cells of the table with count different from zero. Forset with both discrete and continuous variables the argument type should be"canonical", "moment", "raw", "mk", or, "ms".

set See showTable.

model See returnModel.

random See showTable.log.transformed

See showTable.

complete See showTable.discrete.ordered

See showTable.

dump Logical. For set with only discrete variables. If dump is TRUE and dump ofoptionsCoCo also is TRUE then the table is written to the dump file.

label Logical, if label then labels are set on returned arrays.

Page 122: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnTable 117

split Logical, for the argument type with both discrete and continuous variables:If split is TRUE then the returned quantities are split into the three partsdiscrete, linear and quadratic.

discrete.outerLogical, for the argument type with both discrete and continuous variables:If discrete.outer is FALSE then order of the discrete and the continuousvariables are permuted.

mixed See showTable.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

showTable.

Examples

library(CoCoCg);data(fev);

fevCoCo <- makeCoCoCg();result <- enterDataFrame(fev, object = fevCoCo);

enterModel("*;", object = fevCoCo);

showTable("observed", ":Sex:Smoker", object = fevCoCo);

showTable("canonical", ":Sex:Smoker:Age:FEV:Height",table = TRUE, object = fevCoCo);

showTable("canonical", ":Sex:Smoker:Age:FEV:Height",matrix = TRUE, object = fevCoCo);

showTable("canonical", ":Age:FEV:Height",matrix = TRUE, object = fevCoCo);

c1 <- returnTable("canonical", ":Sex:Smoker:Age:FEV:Height",

Page 123: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

118 returnTest

label = FALSE, split = FALSE, object = fevCoCo);c2 <- returnTable("canonical", ":Sex:Smoker:Age:FEV:Height",

label = TRUE, object = fevCoCo);c3 <- returnTable("canonical", ":Sex:Smoker:Age:FEV:Height",

label = TRUE, split = FALSE, object = fevCoCo);c4 <- returnTable("canonical", ":Sex:Smoker:Age:FEV:Height",

label = TRUE, split = FALSE,discrete.outer = TRUE, object = fevCoCo);

returnTable("canonical", ":Sex:Smoker:Age:FEV:Height", label = TRUE);

returnTable("moment", ":Sex:Smoker:Age:Height", label = TRUE)$Mean;returnTable("moment", ":Smoker:Age:Height", label = TRUE)$Mean;returnTable("moment", ":Sex:Age:Height", label = TRUE)$Mean;

c4[,,1]c4[1,1,]c5 <- returnTable("canonical", ":Sex:Smoker:Age:FEV:Height",

label = TRUE, split = TRUE, discrete.outer = FALSE,object = fevCoCo);

c6 <- returnTable("canonical", ":Sex:Smoker:Age:FEV:Height",label = TRUE, split = TRUE, discrete.outer = TRUE,object = fevCoCo);

showTable("moment", ":Sex:Smoker:Age:FEV:Height",matrix = TRUE, object = fevCoCo);

m1 <- returnTable("moment", ":Sex:Smoker:Age:FEV:Height",label = FALSE, split = FALSE, object = fevCoCo);

m2 <- returnTable("moment", ":Sex:Smoker:Age:FEV:Height",label = TRUE, object = fevCoCo);

m3 <- returnTable("moment", ":Sex:Smoker:Age:FEV:Height",label = TRUE, split = FALSE, object = fevCoCo);

m4 <- returnTable("moment", ":Sex:Smoker:Age:FEV:Height",label = TRUE, split = FALSE,discrete.outer = TRUE, object = fevCoCo);

m4[,,1]m4[1,1,]m5 <- returnTable("moment", ":Sex:Smoker:Age:FEV:Height",

label = TRUE, split = TRUE,discrete.outer = FALSE, object = fevCoCo);

m6 <- returnTable("moment", ":Sex:Smoker:Age:FEV:Height",label = TRUE, split = TRUE,discrete.outer = TRUE, object = fevCoCo);

endCoCo(object = fevCoCo);

returnTest Return the Pearson χ2, the power divergence, etc.

Page 124: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnTest 119

Description

Return for discrete data the Pearson χ2, the power divergence, and the deviance, and for tests of twoordinal variable conditional independent given discrete also the Goodman and Kruskal’s Gammacoefficient, and for mixed data the deviance and the F-test. For discrete data also exact p-values canbe returned.

Usage

returnTest(model.1 = "current", model.2 = "base", push.pop = FALSE, data = NULL,object = .object.of.models(model.1, model.2, data = data, ...), ...)

Arguments

model.1 See isSubmodel.

model.2 See isSubmodel.

push.pop Logical, if push.pop is TRUE, both model arguments are numeric and theobject argument is a CoCoCg object then model pointers are restored by lesscalls of CoCoCg. See also returnModelNumber and makeCurrent.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

A labeled vector of reals, or NULL if the an error occur, e.g. the models are not available or notnested.

Note

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel, makeModel, showModel, makeCurrent, returnModel, returnModelNumber,partialAssociations, optionsCoCo, showTest, showDeviance, returnDeviance,backward and forward.

Page 125: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

120 returnVariableDescription

Examples

returnVariableDescriptionReturn the specification of the data in the CoCo object

Description

Return the specification of the data in the CoCo object in form of variable names, number of levels,number of levels marked as missing value and type of variable.

Usage

returnVariableDescription(full = FALSE, levels = TRUE,missing.levels = TRUE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

full Logical, if full is TRUE then the number of specified variables is returned,that is number without setUseVariables.

levels Logical, if levels is TRUE then return the number of levels.missing.levels

Logical, if missing.levels is TRUE then return the number of levels markedas missing.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

A list with the components

names chr

labels NULL

types int

stratum NULL

levels intmissing.levels

int

Page 126: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnVariableDescription 121

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

forward.

Examples

library(CoCo);data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);

showOptions("specification", object = CoCoObject);Specification <- returnVariableDescription(object = CoCoObject);Specification

endCoCo(object = CoCoObject);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);

numberVariates(object = CoCoObject);numberVariates(full = TRUE, object = CoCoObject);

endCoCo(object = CoCoObject);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

library(CoCo);data(Byssinosis38);CoCoObject <- makeCoCo();enterTable(Byssinosis38, object = CoCoObject);

numberVariates(object = CoCoObject);

endCoCo(object = CoCoObject);

Page 127: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

122 returnVertexOrder

returnVertexOrder Return vertex order

Description

Return vertex orderings, including MaxCard, LexM and paths.

Usage

returnVertexOrder(model = FALSE, invers.order = FALSE, default.order = TRUE,max.card = FALSE, path.order = FALSE, sub.path = FALSE,marked = paste(";"), u = "", v = "",names = NULL, levels = NULL, to.factor = NULL,discrete = NULL, continuous = NULL, data = NULL,object = .object.of.model(model, data = data, names = names,

levels = levels, to.factor = to.factor,discrete = discrete,continuous = continuous, ...), ...)

Arguments

model See returnModel.

invers.order Logical, if invers.order is TRUE then .default.order

Logical, if default.order is TRUE then .

max.card Logical, if max.card is TRUE then .

path.order Logical, if path.order is TRUE then .

sub.path Logical, if sub.path is TRUE then .

marked A character string, marked then .

u A character string, u then .

v A character string, v then .

names A character string, names ...

levels A vector of integers, levels ...

to.factor A vector of integers, to.factor ...

discrete A vector of integers or a character string, discrete ...

continuous A vector of integers or a character string, continuous ...

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Page 128: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnVertexOrder 123

Value

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

objects to See Also as coco.init,

Examples

library(CoCoCg);

# Without "data" does not require ending the CoCo object:

# returnVertexOrder("ab,xy", continuous = "xy");

# With CoCo object:

data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);

# Enter the saturated model:enterModel("*", object = CoCoObject);

# Generate some models, here by "backward":backward(recursive = TRUE, headlong = TRUE, coherent = TRUE,

follow = TRUE, object = CoCoObject);

# Show the model list:showModel("all", object = CoCoObject);

n <- returnModelNumber("last", object = CoCoObject);for (i in 1:n) {showFormula(i, object = CoCoObject);showVertexOrder(i, object = CoCoObject);print(returnVertexOrder(i, object = CoCoObject));

}

returnVertexOrder(9, object = CoCoObject);returnVertexOrder(9, max.card = TRUE, object = CoCoObject);returnVertexOrder(9, default.order = FALSE, max.card = TRUE, object = CoCoObject);returnVertexOrder(9, default.order = FALSE, max.card = FALSE, object = CoCoObject);

Page 129: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

124 returnVertexOrder

returnVertexOrder(9, marked = "AB;", object = CoCoObject);returnVertexOrder(9, marked = "EF;", object = CoCoObject);

returnVertexOrder(9, u = "B;", v = "F;",path.order = TRUE, sub.path = TRUE, object = CoCoObject);

returnVertexOrder(9, u = "C;", v = "F;",path.order = TRUE, sub.path = TRUE, object = CoCoObject);

endCoCo(CoCoObject);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

data(Fuchs82);

CoCoObject <- makeCoCo();enterTable(Fuchs82, object = CoCoObject);

enterModel("mdp,da,am,dg,gs,sa", object = CoCoObject);

returnVertexOrder(model = "current",path.order = TRUE, marked = paste("pd"),u = "m", v = "g", object = CoCoObject);

returnVertexOrder(model = "current", invers.order = TRUE,path.order = TRUE, marked = paste("pd"),u = "m", v = "g", object = CoCoObject);

returnVertexOrder(model = "current", sub.path = TRUE,path.order = TRUE, marked = paste("pd"),u = "m", v = "g", object = CoCoObject);

returnVertexOrder(model = "current",path.order = TRUE, marked = paste("adps"),u = "m", v = "g", object = CoCoObject);

returnVertexOrder(model = "current", sub.path = TRUE,path.order = TRUE, marked = paste("adps"),u = "m", v = "g", object = CoCoObject);

returnVertexOrder(model = "current",path.order = TRUE, marked = paste("adms"),u = "p", v = "g", object = CoCoObject);

returnVertexOrder(model = "current", sub.path = TRUE,path.order = TRUE, marked = paste("adms"),u = "p", v = "g", object = CoCoObject);

returnVertexOrder(model = "current",path.order = TRUE, marked = paste("adms"),u = "g", v = "p", object = CoCoObject);

returnVertexOrder(model = "current", sub.path = TRUE,path.order = TRUE, marked = paste("adms"),

Page 130: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

returnVertexOrder 125

u = "g", v = "p", object = CoCoObject);

showVertexOrder();

# Default order:VertexOrder <- returnVertexOrder(model = "current",

invers.order = FALSE,object = CoCoObject);

VertexOrder

# Default order, inverse:InverseOrder <- returnVertexOrder(model = "current",

invers.order = TRUE,object = CoCoObject);

InverseOrder

# Lex order:returnVertexOrder(model = "current", invers.order = FALSE,

default.order = FALSE, max.card = FALSE,object = CoCoObject);

# Lex order, inverse:returnVertexOrder(model = "current", invers.order = TRUE,

default.order = FALSE, max.card = FALSE,object = CoCoObject);

# Max-card order:returnVertexOrder(model = "current", invers.order = FALSE,

default.order = FALSE, max.card = TRUE,object = CoCoObject);

# Max-card order, inverse:returnVertexOrder(model = "current", invers.order = TRUE,

default.order = FALSE, max.card = TRUE,object = CoCoObject);

##

# Marked order, default:returnVertexOrder(model = "current", invers.order = FALSE,

marked = "g", object = CoCoObject);

# Marked order, Lex:returnVertexOrder(model = "current", invers.order = FALSE,

default.order = FALSE, max.card = FALSE,marked = "g", object = CoCoObject);

# (Marked order), Max-card:returnVertexOrder(model = "current", invers.order = FALSE,

default.order = FALSE, max.card = TRUE,marked = "g", object = CoCoObject);

##

Page 131: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

126 returnVertexOrder

# Marked order, default:returnVertexOrder(model = "current", invers.order = FALSE,

marked = "d", object = CoCoObject);

# Marked order, Lex:returnVertexOrder(model = "current", invers.order = FALSE,

default.order = FALSE, max.card = FALSE,marked = "d", object = CoCoObject);

# (Marked order), Max-card:returnVertexOrder(model = "current", invers.order = FALSE,

default.order = FALSE, max.card = TRUE,marked = "d", object = CoCoObject);

##

# Marked order, default:returnVertexOrder(model = "current", invers.order = FALSE,

marked = "p", object = CoCoObject);

# Marked order, Lex:returnVertexOrder(model = "current", invers.order = FALSE,

default.order = FALSE, max.card = FALSE,marked = "p", object = CoCoObject);

# (Marked order), Max-card:returnVertexOrder(model = "current", invers.order = FALSE,

default.order = FALSE, max.card = TRUE,marked = "p", object = CoCoObject);

endCoCo(CoCoObject);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

# Generate some models, here by "backward":backward(recursive = TRUE, headlong = TRUE, coherent = TRUE, follow = TRUE,

object = CoCoObject);

homogeneModel <- makeModel(enterModel("[[ab]] / [[aby][abx]] / [[x^][abxy][y^]]",object = CoCoObject));

enterModel("ab,bx,xy", object = CoCoObject);

enterModel("ax,xy,yb", object = CoCoObject);

enterModel("xa,ab,by", object = CoCoObject);

Page 132: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

setOrdinal 127

# Show the model list:showModel("all", object = CoCoObject);

n <- returnModelNumber("last", object = CoCoObject);for (i in 1:n) {showFormula(i, object = CoCoObject);print(returnVertexOrder(i, object = CoCoObject));

}

endCoCo(CoCoObject);

setOrdinal Declare some of the discrete variables to be ordinal

Description

Declare some of the discrete variables to be ordinal.

Usage

setOrdinal(set = "*", setslot = TRUE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

set A character string with the ordinal variables set.

setslot Logical, if setslot is TRUE then set is added to object.

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Details

Value

A character sting with the ordinal variables set.

Author(s)

Jens Henrik Badsberg

Page 133: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

128 setUseVariables

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterDataFrame, partialAssociations, optionsCoCo, showDeviance, returnTest,returnDeviance, backward and forward.

setUseVariables Declare which variables to enter

Description

Between entering specification and observations, declare which variables to enter into the CoCoobject.

Usage

setUseVariables(hit = "all", set = ";", setslot = FALSE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

hit Character string with "all", "what" or a set of variables.

set Character string with set of variables.

setslot See enterNames.

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Value

A character sting with the variables set to use.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

Page 134: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

showDeviance 129

See Also

returnNcells for example.

Examples

library(CoCo);data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);numberVariates(object = CoCoObject);

Specification <- returnVariableDescription(object = CoCoObject);setUseVariables(paste(Specification$names[c(1,3,4,6)], collapse = ""),

object = CoCoObject);enterTable(c(Reinis), object = CoCoObject);numberVariates(object = CoCoObject);numberVariates(full = TRUE, object = CoCoObject);

showOptions("specification", object = CoCoObject);

endCoCo(object = CoCoObject);

showDeviance Show the difference between likelihoods, dimension, etc.

Description

Print on standard output the test statistics (deviance and F-test statistics) with p-values based onlikelihoods and dimensions of the two argument models. For discrete models the adjustment of thedegrees of freedom is also reported.

Usage

showDeviance(model.1 = "current", model.2 = "base", data = NULL,object = .object.of.models(model.1, model.2, data = data, ...), ...)

Arguments

model.1 See isSubmodel.

model.2 See isSubmodel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

The value TRUE is returned. If an error occurs then a warning is printed.

Page 135: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

130 showDeviance

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel, makeModel, showModel, makeCurrent, returnModel, returnModelNumber,partialAssociations, optionsCoCo, showTest, returnTest, returnDeviance,backward and forward.

Examples

library(MASS);data(anorexia);library(CoCoCg);

# showDeviance(model.1 ="[[:Prewt:Postwt][:Treat:Postwt]];",# model.2 ="*;", data = anorexia);# endCoCo();

#

CoCoObject <- makeCoCoCg();enterDataFrame(anorexia, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

# fullGraph <- dG(fullModel, title = "Full");

backward(recursive = TRUE, object = CoCoObject);

# lastModel <- makeModel("last", object = CoCoObject);# backwardGraph <- dG(lastModel, title = "Last");

showModel("all", object = CoCoObject);makeCurrent(object = CoCoObject);

# These two calls does not produce the same deviance,# since the second correctly tests the inhomogene model:

showTest(object = CoCoObject);showDeviance(object = CoCoObject);

# The default models for showTest and showDeviance are "current" and "base",# but the default models for returnTest and returnDeviance was/are FALSE,# which both will refer to "base" when no models are set:

returnTest(object = CoCoObject); # model.1 was/is by default "base"!!!

Page 136: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

showFormula 131

returnTest(FALSE, FALSE, object = CoCoObject);returnTest("base", "base", object = CoCoObject);returnTest("current", object = CoCoObject);returnTest("current", "base", object = CoCoObject);returnTest(model.2 = 1, object = CoCoObject);returnTest("base", "current", object = CoCoObject);

returnDeviance(object = CoCoObject); # model.1 was/is by default "base"!!!returnDeviance(FALSE, FALSE, object = CoCoObject);returnDeviance("base", "base", object = CoCoObject);returnDeviance("current", object = CoCoObject);returnDeviance("current", "base", object = CoCoObject);returnDeviance(model.2 = 1, object = CoCoObject);returnDeviance("base", "current", object = CoCoObject);

showTest(3, 1, object = CoCoObject);showDeviance(3, 1, object = CoCoObject);returnTest(3, 1, object = CoCoObject);returnDeviance(3, 1, object = CoCoObject);

showTest(1, 1, object = CoCoObject);showDeviance(1, 1, object = CoCoObject);returnTest(1, 1, object = CoCoObject);returnDeviance(1, 1, object = CoCoObject);

# inhoModel <- makeModel(enterModel("[[:Treat]] / [[:Prewt][:Treat:Postwt]] / [[:Treat:Prewt:Postwt]]", object = CoCoObject));

# inhoModel <- makeModel(enterModel("[[:Treat]] / [[:Prewt][:Treat:Postwt]] / [:Prewt^][:Treat:Prewt:Postwt][:Treat:Postwt^]]", object = CoCoObject));

# inhoModel <- makeModel(enterModel("[[:Treat]] / [[:Prewt][:Treat:Postwt]] / [:Prewt^][:Prewt:Postwt][:Treat:Postwt^]]", object = CoCoObject));

inhoModel <- makeModel(enterModel("[[:Prewt:Postwt][:Treat:Postwt]]", object = CoCoObject));

showModel("all", object = CoCoObject);makeCurrent(object = CoCoObject);

showTest(object = CoCoObject);showDeviance(object = CoCoObject);returnTest("current", "base", object = CoCoObject);returnDeviance("current", "base", object = CoCoObject);

exportCoCo("anorexia.xpt");

endCoCo(object = CoCoObject);

showFormula Show the model formula

Description

Print on standard output the expression for estimating the parameters of the model.

Page 137: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

132 showModel

Usage

showFormula(model = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See returnModel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

showModel.

showModel Show the model

Description

Print on standard output the model. The model can also be given a longer description with adjacencymatrix and expression for estimates.

Usage

showModel(model = FALSE, a = FALSE, b = FALSE, describe.model = FALSE,data = NULL, object = .object.of.model(model, data = data, ...), ...)

Page 138: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

showModel 133

Arguments

model Numeric, model object, text string, or logical. A numeric should give a validmodel number in the object, see makeCurrent about the model list. Theargument can also be a CoCo model object, see makeModel about creatingmodel objects. The text strings "base", "current", or "last" refers tothe three models. The text strings "interval" will show the interval givenby the arguments a and b. The default value "current" for the CURRENTmodel can also be given as the logical FALSE (or NULL). model can also bea vector or list with the above, but not recursive. model can not be a characterstring with a generating class.

a Numeric, a is the first model of the interval.

b Numeric, b is the last model of the interval.describe.model

Logical, if describe.model is TRUE the the longer description is given.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel and makeCurrent.

Examples

library(CoCo);data(Byssinosis38);CoCoObject <- makeCoCo();enterTable(Byssinosis38, object = CoCoObject);

# Generate some models:

enterModel("*", object = CoCoObject);backward(recursive = TRUE, headlong = TRUE, coherent = TRUE,

follow = TRUE, object = CoCoObject);

Page 139: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

134 showModel

backwardResult <- returnModelNumber("last", object = CoCoObject);enterModel(".;", object = CoCoObject);forward(recursive = TRUE, headlong = TRUE, coherent = TRUE, object = CoCoObject);makeCurrent(backwardResult, object = CoCoObject);

# Show the models:

showModel("all", object = CoCoObject);showModel("last", object = CoCoObject);showModel("base", object = CoCoObject);showModel("current", object = CoCoObject);showModel("number", 3, object = CoCoObject);

# showModel(FALSE, object = CoCoObject);# showModel(TRUE, object = CoCoObject);# showModel(NULL, object = CoCoObject);

# showModel(c(1, 2, c(7)), object = CoCoObject);# showModel("list", list(1, 2), object = CoCoObject);

# showModel(c("current", 7, 9, "last"), object = CoCoObject);# showModel(c("current", "base", "last"), object = CoCoObject);

# showModel("list", list("current", 2), object = CoCoObject);

# Show the model "backwardResult" down to 1:

while(makeCurrent("previous",object = CoCoObject)) showModel(object = CoCoObject);

# Show the model 10 to 15 3 times:

showModel(10:15, object = CoCoObject);

showModel("interval", 10, 15, object = CoCoObject);

makeCurrent(10, object = CoCoObject)while(returnModelNumber("current", object = CoCoObject) < 15) {

makeCurrent("next", object = CoCoObject);showModel(object = CoCoObject); }

makeCurrent(backwardResult, object = CoCoObject);

showModel(6, describe.model = TRUE, object = CoCoObject);showModel("current", describe.model = TRUE, object = CoCoObject);

showModel(1, describe.model = TRUE, object = CoCoObject);

# "base" and "last" gives shorter description:

showModel("base", describe.model = TRUE, object = CoCoObject);showModel("last", describe.model = TRUE, object = CoCoObject);

Page 140: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

showOptions 135

endCoCo(object = CoCoObject);

showOptions Show the options of the CoCo object

Description

Print on standard output the options of the CoCo object.

Usage

showOptions(hit = "all", dump = FALSE, data = NULL,object = .object.of.thing(data = data, ...), ...)

Arguments

hit A character string "all", "formats", "tests", "exact", "fix", "ips","cips", "mips", "em", "old", "specification", "factors", "observations","data", "limits", "files", "other", "search", or "eh".

dump Logical, if dump is TRUE, then write CoCo commands for setting the options.Only implemented for CoCoCg.

data ( See exportCoCo. )

object See exportCoCo.

... ( Additional arguments to generate the CoCo object from the data argument.See propertyModel. )

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

optionsCoCo.

Page 141: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

136 showTable

Examples

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);showOptions(object = CoCoObject);showOptions("specification", object = CoCoObject);

sinkCoCo(file.name = "Diary.tmp", type = "diary", object = CoCoObject);showOptions("formats", object = CoCoObject);showOptions("formats", dump = TRUE, object = CoCoObject);

sinkCoCo(file.name = "Diary.tmp", type = "diary", object = CoCoObject);showOptions("tests", object = CoCoObject);showOptions("tests", dump = TRUE, object = CoCoObject);

endCoCo(object = CoCoObject);

showTable The counts and fitted values of a marginal table

Description

Print on standard output the observed probabilities, counts, means, covariance matrix, canonicalparameters, fitted values, residuals, etc. of marginal tables.

Usage

showTable(type = "observed", set = "*", model = FALSE,random = FALSE, log.transformed = FALSE, complete = FALSE,discrete.ordered = TRUE, table = FALSE, matrix = TRUE,mixed = FALSE, output.form = "table", data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

type A character string. The argument type for discrete variables: "counts","probabilities", "expected", "unadjusted", "absolute", "f-res", "r-f", "g-res", "r-g", "adjusted", "c-res", "m-res", "standardized","standard", "x-res", "l-res", "freeman-tukey", "sqrt", "power","index", "zero", "error".The argument type for both discrete and continuous variables: "leverage","canonical", "gs", "hs", "ks", "moment", "means", "covariance","raw", "total", "ss", "ssds", "determinants", "mk", "ms".

set A character string with the set of variables.

model See returnModel.

Page 142: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

showTable 137

random Logical, if random then a random table with counts in the sufficient marginaltables as in the observed table is generated, and the values are are computed forthis random table.

log.transformedLogical, if TRUE then the values are log.transformed before printed.

complete Logical, if complete is TRUE then no value is returned for cells to be zero bystructure.

discrete.orderedLogical, if discrete.ordered then the variables are ordered as specifiedby the call.

table Logical, for CoCoCg objects. If table is FALSE then for each configurationin the cross classification of the discrete variables the means and covariancesof the continuous variables are printed according to the argument matrix. Iftable is TRUE then for each mean and for each covariance a table formed bythe cross classification of the discrete variables is printed with the quantity.

matrix Logical, for CoCoCg objects. If matrix is TRUE then the means and covari-ances are printed in a matrix with the continuous variables as headings, else allthe quantities for the continuous variables are printed on a single line for eachconfiguration in the cross classification of the discrete variables.

mixed Logical, if mixed is TRUE then mixed quantities are printed..

output.form A character string. The argument output.form is only used for only discretevariables: "table" for the table of the value selected by the argument type,"sparse.table" for a list of counts in cells with count different for zero,"case.list" for a case list, or, "list.all.values" for a list of all thevalues for discrete variables.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Details

Marginal model :

Observed : (or "counts")

Probabilities :

Expected :

Unadjusted : (or "absolute")

F-res :

R-f :

G-res :

R-g :

Adjusted :

C-res :

Page 143: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

138 showTable

Standardized : (or "m-res", "x-res", or "standard")

X-res :

Deviance : (or "l-res" or "-2log")

Freeman-tukey :

Sqrt : (or "2n-m")

Power :

Index :

Zero :

Leverage :

Canonical :

Gs :

Hs :

Ks :

Moment :

Means :

Covariance :

Raw :

Total :

Ss :

Ssds : (or "sigma")

Determinants :

Mk :

Ms :

Error :

Table :

Sparse table :

Case list :

List all values :

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

Page 144: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

showTable 139

See Also

summaryTable.

Examples

library(CoCoCg);library(MASS)data(crabs);

crabsCoCo <- makeCoCoCg();result <- enterDataFrame(crabs[,-3], object = crabsCoCo);

enterModel("*;", object = crabsCoCo);

showTable("observed", "[:sp:sex]", object = crabsCoCo);

showTable("canonical", "[:sp:sex:FL:RW:CL:CW:BD]",matrix = TRUE, object = crabsCoCo);

showTable("canonical", "[:sp:sex:FL:RW:CL:CW:BD]", matrix = TRUE);

showTable("moment", "[:sp:sex:FL:RW:CL:CW:BD]",matrix = TRUE, object = crabsCoCo);

returnTable("canonical", "[:sp:sex:FL:RW:CL:CW:BD]");

returnTable("mk", "[:sp:sex:FL:RW:CL:CW:BD]");

# backward(recursive = TRUE, headlong = TRUE, coherent = TRUE, follow = TRUE,# object = crabsCoCo);

m5 <- "[[:sp:sex]] / [[:sp:sex:FL][:sp:sex:RW][:sex:CL][:sp:sex:BD][:sp:sex:CW]] / [[:sex:FL:CL][:sp:sex:FL:CW][:sp:sex:FL:BD][:sp:sex:RW:CW][:sex:CL:CW][:sex:CL:BD][:sp:sex:CW:BD]]"m4 <- "[[:sp:sex]] / [[:sp:sex:RW][:sp:sex:BD][:sp:sex:CW][:sp:sex:FL][:sex:CL]] / [[:sp:sex:CW:BD][:sex:CL:BD][:sex:CL:CW][:sp:sex:RW:BD][:sp:sex:RW:CW][:sp:sex:FL:BD][:sp:sex:FL:CW][:sex:FL:CL]]"m3 <- "[[:sp:sex]] / [[:sp:sex:FL][:sp:sex:RW][:sex:CL][:sp:sex:BD][:sp:sex:CW]] / [[:sp:sex:FL:RW][:sex:FL:CL][:sp:sex:FL:CW][:sp:sex:FL:BD][:sp:sex:RW:CW][:sp:sex:RW:BD][:sex:CL:CW][:sex:CL:BD][:sp:sex:CW:BD]]"m2 <- "[[:sp:sex]] / [[:sp:sex:BD][:sp:sex:CW][:sex:CL][:sp:sex:RW][:sp:sex:FL]] / [[:sp:sex:CW:BD][:sex:CL:BD][:sex:CL:CW][:sp:sex:RW:BD][:sp:sex:RW:CW][:sex:RW:CL][:sp:sex:FL:BD][:sp:sex:FL:CW][:sex:FL:CL][:sp:sex:FL:RW]]"m1 <- "[[:sp:sex]] / [[:sp:sex:BD][:sp:sex:CW][:sp:sex:CL][:sp:sex:RW][:sp:sex:FL]] / [[:sp:sex:CW:BD][:sp:sex:CL:BD][:sp:sex:CL:CW][:sp:sex:RW:BD][:sp:sex:RW:CW][:sp:sex:RW:CL][:sp:sex:FL:BD][:sp:sex:FL:CW][:sp:sex:FL:CL][:sp:sex:FL:RW]]"

enterModel(m1, object = crabsCoCo);enterModel(m2, object = crabsCoCo);enterModel(m3, object = crabsCoCo);enterModel(m4, object = crabsCoCo);enterModel(m5, object = crabsCoCo);

makeCurrent("last", object = crabsCoCo)returnTable("mk", "[:sp:sex:FL:RW:CL:CW:BD]");

Rfirst <- returnTable("mk", "[:sp:sex:FL:RW:CL:CW:BD]", model = 1);Rlast <- returnTable("mk", "[:sp:sex:FL:RW:CL:CW:BD]", model = 6);Sfirst <- returnTable("ms", "[:sp:sex:FL:RW:CL:CW:BD]", model = 1);Slast <- returnTable("ms", "[:sp:sex:FL:RW:CL:CW:BD]", model = 6);

Rfirst$h-Rlast$h

Page 145: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

140 showTest

Rfirst$K-Rlast$KSfirst$Mean-Slast$Mean

endCoCo(object = crabsCoCo);

showTest Show the Pearson χ2, the power divergence, etc.

Description

Print on standard output for discrete data the Pearson χ2, the power divergence, and the deviance,and for tests of two ordinal variable conditional independent given discrete also the Goodman andKruskal’s Gamma coefficient, and for mixed data the deviance and the F-test statistic, all with p-values. For discrete data also exact p-values can be printed.

Usage

showTest(model.1 = "current", model.2 = "base", exact.test = NULL,break.down = "", set = ";", only.if.one.edge = FALSE, data = NULL,object = .object.of.models(model.1, model.2, data = data, ...), ...)

Arguments

model.1 See isSubmodel.

model.2 See isSubmodel.

exact.test Logical, if exact.test is TRUE then exact p-values are computed by MonteCarlo simulation.

break.down Text-string: "edges": Break down the test in a sequence of tests, each testa test between two models differing by one edge. The order of the edges arecontrolled by the argument set. "interactions": Break down the testin a sequence of tests, each test a test between two models differing by oneinteraction term. The order of the terms are controlled by the argument set."components": Find sets that are complete separators for both models, andshow tests collapsed to each component. "show.common.decompositions":Do not perform a test, show separators which are complete in both models."decompose.models": Do not perform a test, but decompose both modelswith respect to the argument set.

set Text string with set of variables, see the argument break.down.only.if.one.edge

Logical, if only.if.one.edge is set to TRUE then the test is only per-formed if the models differs with one edge and only one edge.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Page 146: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

showTest 141

Value

TRUE

Note

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel, makeModel, showModel, makeCurrent, returnModel, returnModelNumber,partialAssociations, optionsCoCo, showDeviance, returnTest, returnDeviance,backward and forward.

Examples

# data(HairEyeColor);# library(CoCo);# showTest(":H:S,:E:S", "*", data = HairEyeColor, exact.test = "on");# endCoCo();

library(MASS);data(cabbages);library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(cabbages, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

# Generate some models, here by "backward":backward(recursive = TRUE, headlong = TRUE, coherent = TRUE,

follow = TRUE, object = CoCoObject);

makeCurrent("last", object = CoCoObject);showTest("last", object = CoCoObject);

returnTable("moment", ":Cult:Date:HeadWt:VitC", object = CoCoObject);returnTable("moment", ":Cult:Date:HeadWt:VitC", matrix = TRUE,

object = CoCoObject);

returnTable("mk", ":Cult:Date:HeadWt:VitC", matrix = TRUE,object = CoCoObject);

Page 147: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

142 showTests

showTable("mk", ":Cult:Date:HeadWt:VitC", matrix = TRUE,object = CoCoObject);

showTable("mk", ":Cult:Date:HeadWt:VitC",object = CoCoObject);

showTable("ms", ":Cult:Date:HeadWt:VitC",object = CoCoObject);

endCoCo(CoCoObject);

showTests Show all the stored tests of a CoCo object

Description

Print on standard output all the stored tests in the CoCo object.

Usage

showTests(data = NULL, object = .object.of.thing(data = data, ...), ...)

Arguments

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Note

Reuse of tests in the CoCo object can be turned of by optionsCoCo(reuse.tests=FALSE).Thus no tests are inserted into the test list of the CoCo object.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

Page 148: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

showVertexOrder 143

See Also

optionsCoCo, showTest, showDeviance, returnTest, showTest, eh, backwardand forward.

Examples

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

# Generate some models, here by "backward":backward(recursive = TRUE, headlong = TRUE,

coherent = TRUE, follow = TRUE, object = CoCoObject);

# Show the model list:showModel("all", object = CoCoObject);

showTests(object = CoCoObject);

endCoCo(object = CoCoObject);

showVertexOrder Show the vertex ordering

Description

Print on standard output the vertex ordering used to decompose the model.

Usage

showVertexOrder(model = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

model See returnModel.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Value

TRUE

Page 149: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

144 showVertexOrder

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

returnVertexOrder.

Examples

library(CoCo);data(Reinis);CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);

# Enter the saturated model:enterModel("*", object = CoCoObject);

# Generate some models, here by "backward":backward(recursive = TRUE, headlong = TRUE,

coherent = TRUE, follow = TRUE, object = CoCoObject);

# Show the model list:showModel("all", object = CoCoObject);

n <- returnModelNumber("last", object = CoCoObject);for (i in 1:n) {showFormula(i, object = CoCoObject);showVertexOrder(i, object = CoCoObject);

}

endCoCo(CoCoObject);

library(CoCoCg);data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));

# Generate some models, here by "backward":backward(recursive = TRUE, headlong = TRUE, coherent = TRUE,

follow = TRUE, object = CoCoObject);

homogeneModel <- makeModel(enterModel("[[ab]] / [[aby][abx]] / [[x^][abxy][y^]]",object = CoCoObject));

enterModel("ab,bx,xy", object = CoCoObject);

Page 150: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

sinkCoCo 145

enterModel("ax,xy,yb", object = CoCoObject);

enterModel("xa,ab,by", object = CoCoObject);

# Show the model list:showModel("all", object = CoCoObject);

n <- returnModelNumber("last", object = CoCoObject);for (i in 1:n) {showFormula(i, object = CoCoObject);# showVertexOrder(i, object = CoCoObject); # Fault !!!!

}

endCoCo(CoCoObject);

sinkCoCo Direct output to a file

Description

Diverts CoCo output to a file.

Usage

sinkCoCo(file.name = "Diary.tmp", type = "diary", object = .current.coco)

Arguments

file.name A character string naming the file to write to. To return the file name set thefile.name to "what".

type Textstring with "output", "log", "diary", "report", or "dump".

object See exportCoCo.

Details

The output from CoCo to standard output consists of "output" form the procedures and echo,"log", from the parser. Both parts can be copied to the "diary". Number of cycles in iterativealgorithmes and simular are reported in "report". Some output, from e.g. returnTable, canbe written to the "dump" file.

Value

The text string with the file name.

Author(s)

Jens Henrik Badsberg

Page 151: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

146 summaryTable

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

showOptions and optionsCoCo.

summaryTable Univariate summary statistics for table values

Description

Print on standard output univariate summary statistics, histogram, and uniform and quantile-quantileplots of values in marginal tables.

Usage

summaryTable(type = "observed", set = "*", model = FALSE, random = FALSE,log.transformed = FALSE, complete = FALSE, uniform = FALSE,rankit = FALSE, probit = FALSE, data = NULL,object = .object.of.model(model, data = data, ...), ...)

Arguments

type A character string. The argument type for discrete variables: "counts","probabilities", "expected", "unadjusted", "absolute", "f-res", "r-f", "g-res", "r-g", "adjusted", "c-res", "m-res", "standard","x-res", "l-res", "freeman-tukey", "sqrt", "power", "index","zero", "error". See also showTable.

set See showTable.

model See returnModel.

random See showTable.log.transformed

See showTable.

complete See showTable.

uniform Logical, if uniform is TRUE then a Q-Q-plot is plotted according to the argu-ment.

rankit Logical, if rankit is TRUE then a Q-Q-plot is plotted.

probit Logical, if probit is TRUE then a Q-Q-plot is plotted.

data See exportCoCo.

object See exportCoCo.

... Additional arguments to generate the CoCo object from the data argument.See propertyModel.

Page 152: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

summaryTable 147

Value

TRUE

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

showTable.

Page 153: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

148 summaryTable

Page 154: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Package ‘CoCo’

Namespace CoCo

Title CoCo - Graphical modelling on contingency tables

Description CoCo - Graphical modelling on contingency tables

Depends R (>= 2.0.0), methods

Byssinosis38 Byssinosis

Description

Byssinosis

Usage

data(Byssinosis38)

Format

The format is: num [1:2, 1:3, 1:2, 1:2, 1:2, 1:3] 3 37 0 74 2 258 25 139 0 88 ... - attr(*, "dim-names")=List of 6 ..$ :byssinosis: chr [1:2] "1" "2" ..$ :dust : chr [1:3] "1" "2" "3" ..$ :race : chr[1:2] "1" "2" ..$ :sex : chr [1:2] "1" "2" ..$ :smoking : chr [1:2] "1" "2" ..$ :employment: chr [1:3]"1" "2" "3"

Source

A Handbook of Small Data Sets, edited by D.J. Hand et al., from Chapman and Hall, ISBN 0 41239920 2.

References

Higgens, J.E. and Koch, G.G. (1977), Variable selection and generalized chi-square analysis of cat-egorical data applied to a large cross-sectional occupational health survey, International StatisticalReviews, 45, 51-62.

149

Page 155: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

150 CoCo

Examples

library(CoCo);data(Byssinosis38);ftable(Byssinosis38, col.vars=4:6);

CoCoObject <- makeCoCo();enterTable(Byssinosis38, object = CoCoObject);eh(object = CoCoObject);eh(sub.class = "hierarchical", object = CoCoObject);endCoCo(object = CoCoObject);

CoCo-internal Internal CoCo objects

Description

Internal CoCo and imported objects.

Details

These are not to be called by the user.

Note

The function dG is an "alias" for dg, but with loading the package "CoCoGraph". For help on dguse help(dg, package = "dynamicGraph").

CoCo The CoCo package

Description

The CoCo package with the interface functions to CoCo and CoCo for discrete data.

Note

The function dG is an "alias" for dg, but with loading the packages "CoCoGraph" and "dynam-icGraph". These packages with dg for CoCo-objects are not loaded when loading the package"CoCo" to make the loading of "CoCo" faster.

For help on dg use help(dg, package = "dynamicGraph").

Please quit by quitCoCo to remove temporary files.

Author(s)

Jens Henrik Badsberg

Page 156: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Dawid79 151

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg,J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

CoCoCg.

Examples

# Attach data, here table of counts:data(Reinis);

# Create a CoCo-object:CoCoObject <- makeCoCo();

# Enter the table of counts into the CoCo-object:enterTable(Reinis, object = CoCoObject);

# Enter the saturated model into the CoCo-object, and return a model object:fullModel <- makeModel(enterModel("*", object = CoCoObject));

# Display a graph of the model:fullGraph <- dG(fullModel, title = "Full", returnLink = TRUE);

# Do a backward elimination of edges:backward(recursive = TRUE, headlong = TRUE, coherent = TRUE,

follow = TRUE, object = CoCoObject);

# Display the result of the backward elimination:lastModel <- makeModel("last", object = CoCoObject);backwardGraph <- dG(lastModel, title = "Last",

dynamicGraph = fullGraph, slave = TRUE);

# Do the EH-procedure:eh(object = CoCoObject);

# Terminate the CoCo-object with disposing temporary files:endCoCo(object = CoCoObject);

Dawid79 Dawid and Skene (1979)

Description

Data used in "Maximum likelihood estimation of observed errorrates using the EM algorithm".

Usage

data(Dawid79)

Page 157: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

152 Fever

Format

The format is: int [1:45, 1:11] 1 1 1 1 1 1 1 1 1 1 ... - attr(*, "dimnames")=List of 2 ..: NULL.. :chr [1:11] "count" "v" "w" "a" ...

Source

Dawid, A. P. and Skene, A. M. (1979). Maximum likelihood estimation of observed errorrates usingthe EM algorithm. Appl. Statist. 28, 20-28.

Examples

library(CoCo);data(Dawid79); Dawid79;levels <- apply(Dawid79, 2, max)[-1]; missing <- c(rep(0, 9), 1);CoCoObject <- makeCoCo();enterNames(names(levels), levels - missing, missing = missing,

object = CoCoObject);enterList(c(t(Dawid79)), accumulated = TRUE, object = CoCoObject);showOptions("specification", object = CoCoObject);showTable("observed", "*", output.form = "sparse.table", object = CoCoObject);endCoCo(object = CoCoObject);

Fever Risk of rheumatic fever recurrence after streptococcal infections

Description

Risk of rheumatic fever recurrence after streptococcal infections, prospective study of clinical andsocial factors.

Usage

data(Fever)

Format

The format is: num [1:2, 1:2, 1:2, 1:2, 1:4] 3 3 3 1 0 9 1 3 4 11 ... - attr(*, "dimnames")=List of 5..$ R: chr [1:2] "1" "2" ..$ N: chr [1:2] "1" "2" ..$ H: chr [1:2] "1" "2" ..$ I: chr [1:2] "1" "2" ..$ L:chr [1:4] "1" "2" "3" "4"

Details

1, Laboratory results : 1 = ASO rise of 0 or 1 in presence of antibody rise, \ 2 = ASO rise of 2 or 3 in presence ofantibody rise, \ 3 = ASO rise of 4,5 or 6 in presence of antibody rise, \ 4 = ASO rise of 0 or 1in absence of antibody rise,

2, Interval from last attack : 1 = less than 24 mounths, \ 2 = 24 mounths or more,3, Heart disease : 1 = Yes, \ 2 = No,

4, Number of previous attacks : 1 = only the initial rheumatic fever attack, \ 2 = more than the initial rheumatic fever attack,5, Recurrence of rheumatic fever : 1 = Yes, \ 2 = No,

Page 158: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Fuchs82 153

Source

From Example 3.8-1: Recurrence of rheumatic fever: Adjusted degrees of freedom for empty cells.Bishop, Fienberg and Holland (1975), page 117.

References

Spagnuolo, M., Pasternack, B. and Taranta, A (1971) Risk of rheumatic fever recurrence afterstreptococcal infections, prospective study of clinical and social factors. New Eng. J. Med. 285,641-647.

Examples

data(Fever);ftable(Fever, col.vars=3:5);

CoCoObject <- makeCoCo();enterTable(Fever, object = CoCoObject);eh(object = CoCoObject);eh(sub.class = "hierarchical", object = CoCoObject);endCoCo(object = CoCoObject);

Fuchs82 Fuchs, C. (1982)

Description

Data used in "Maximum likelihood estimation and model selection in contingencytables with miss-ing data".

Usage

data(Fuchs82)

Format

The format is: num [1:2, 1:2, 1:2, 1:2, 1:3, 1:3] 0 2 5 3 0 0 2 1 1 0 ... - attr(*, "dimnames")=List of6 ..$ g: chr [1:2] "1" "2" ..$ a: chr [1:2] "1" "2" ..$ s: chr [1:2] "1" "2" ..$ d: chr [1:2] "1" "2" ..$ p:chr [1:3] "1" "2" "3" ..$ m: chr [1:3] "1" "2" "3"

Details

D, Survival status : survived, deceased,

G, Group membership : experiment, control,

S, Sex : male, female,

A, Age : less than 75, over 75,

P, Physical status : poor, good,

M, Mental status : poor, good,

Page 159: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

154 Hochberg77

Source

Fuchs, C. (1982). Maximum likelihood estimation and model selection in contingencytables withmissing data. J. Amer. Statist Soc. 77, 270-278.

Examples

data(Fuchs82);ftable(Fuchs82, col.vars=4:6);

CoCoObject <- makeCoCo();enterTable(Fuchs82, object = CoCoObject);eh(object = CoCoObject);eh(sub.class = "hierarchical", object = CoCoObject);endCoCo(object = CoCoObject);

Hochberg77 Highway safety

Description

Highway safety.

Usage

data(Hochberg77)

Format

The format is: num [1:3, 1:3, 1:2, 1:2, 1:2, 1:2] 407 62 0 45 7 ... - attr(*, "dimnames")=List of 6 ..$a: chr [1:3] "1" "2" "3" ..$ b: chr [1:3] "1" "2" "3" ..$ c: chr [1:2] "1" "2" ..$ d: chr [1:2] "1" "2" ..$e: chr [1:2] "1" "2" ..$ f: chr [1:2] "1" "2"

Details

a : belt use recorded by non-police devices,

b : driver injury recorded by non-police devices,

c : driver’s sex,

d : car damage,

e : belt use recorded by police,

f : driver injury recorded by police.

Source

Zhi Geng and Chooichiro Asano (1988): Recursive procedures for hierarchical loglinear models onhigh-dimensional contingency tables. J. Japanese Soc. Comp. Statist, 17-26.

Page 160: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Reinis 155

References

Hochberg, Y (1977): On the use of double sampling schemes in analyzing categorical data withmisclassification errors. J. Am. Statist. Assoc. 72, 914-921.

Examples

data(Hochberg77)ftable(Hochberg77, col.vars=4:6);

CoCoObject <- makeCoCo();enterTable(Hochberg77, missing = c(1, 1, rep(0, 4)), object = CoCoObject);excludeMissing("on", object = CoCoObject);eh(object = CoCoObject);eh(sub.class = "hierarchical", object = CoCoObject);endCoCo(object = CoCoObject);

Reinis Reinis: Coronary heart disease

Description

Prognostic significance of the risk profile in the prevention of coronary heart disease.

Usage

data(Reinis)

Format

The format is: num [1:2, 1:2, 1:2, 1:2, 1:2, 1:2] 44 40 112 67 129 145 12 23 35 12 ... - attr(*,"dimnames")=List of 6 ..$ A: chr [1:2] "1" "2" ..$ B: chr [1:2] "1" "2" ..$ C: chr [1:2] "1" "2" ..$ D:chr [1:2] "1" "2" ..$ E: chr [1:2] "1" "2" ..$ F: chr [1:2] "1" "2"

Details

A : Smoking,

B : strenuous mental work,

C : strenuous physical work,

D : systolic blood pressure,

E : ratio of ‘alpha’ to ‘beta’ lipoproteins,

F : family anamnesis of coronary heart disease.

Source

Edwards, D. and Havranek, T. (1987). A fast model selection procedure for large families of models.J. Amer. Stat. Assoc. 82: 205-231.

Page 161: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

156 Scrotal94

References

Reinis, Z., Pokorny, J., Basika, V., Tiserova, J., Gorican, K., Horakova, D., Stuchlikova, E., Havranek,T. and Hrabovsky, F. (1981): Prognosticky vyznam rizikoveho profilu v prevenci ischemicke chorobysrdce. Bratis. lek. Listy. 76, 137-50. (Prognostic significance of the risk profile in the preventionof coronary heart disease)

Examples

library(CoCo);data(Reinis);ftable(Reinis, col.vars=4:6);

CoCoObject <- makeCoCo();enterTable(Reinis, object = CoCoObject);eh(object = CoCoObject);eh(sub.class = "hierarchical", object = CoCoObject);endCoCo(object = CoCoObject);

Scrotal94 Scrotal Swelling Data

Description

Scrotal Swelling Data

Usage

data(Scrotal94)

Format

The format is: num [1:2, 1:2, 1:2, 1:2, 1:2, 1:2, 1:2, 1:2] 0 0 16 0 0 0 38 0 0 0 ... - attr(*,"dimnames")=List of 8 ..$ H: chr [1:2] "1" "2" ..$ A: chr [1:2] "1" "2" ..$ B: chr [1:2] "1" "2"..$ C: chr [1:2] "1" "2" ..$ D: chr [1:2] "1" "2" ..$ E: chr [1:2] "1" "2" ..$ F: chr [1:2] "1" "2" ..$ G:chr [1:2] "1" "2"

Details

H : Hernia,

A : Possible to get above the swelling,

B : Swelling transilluminates,

C : Swelling separated from testes,

D : Positive Valsalva,

E : Tenderness,

F : Pain,

G : Urinal tract infection.

Page 162: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

UterineCervix411 157

Source

David Madigan and Adrian E. Raftery (1994): Model Selection and Accounting for Model Uncer-tainty in Graphical Models Using Occam’s Window. J. Am. Statist. Assoc. 428, 1535-1546.

Examples

library(CoCo);data(Scrotal94);ftable(Scrotal94, col.vars=5:8);

CoCoObject <- makeCoCo();enterTable(Scrotal94, object = CoCoObject);eh(object = CoCoObject);eh(sub.class = "hierarchical", object = CoCoObject);endCoCo(object = CoCoObject);

UterineCervix411 Carcinoma of the uterine cervix

Description

Carcinoma of the uterine cervix.

Usage

data(UterineCervix411)

Format

The format is: int [1:77, 1:9] 10 1 2 1 1 8 1 1 1 2 ... - attr(*, "dimnames")=List of 2 ..: NULL.. :chr [1:9] "count" "a" "b" "c" ...

Source

A Handbook of Small Data Sets, edited by D.J. Hand et al., from Chapman and Hall, ISBN 0 41239920 2.

Examples

library(CoCo);data(UterineCervix411); UterineCervix411;levels <- apply(UterineCervix411, 2, max)[-1]; missing <- c(rep(0, 7), 1);CoCoObject <- makeCoCo();enterNames(names(levels), levels - missing, missing = missing,

object = CoCoObject);enterList(c(t(UterineCervix411)), accumulated = TRUE, object = CoCoObject);showOptions("specification", object = CoCoObject);returnTable("sparse.table", object = CoCoObject);

Page 163: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

158 makeCoCo

showTable("observed", "*", output.form = "sparse.table", object = CoCoObject);endCoCo(object = CoCoObject);

makeCoCo Make a CoCo object

Description

Make a CoCo object.

Usage

makeCoCo(...)

Arguments

... make.coco.

Details

The distributed source code is only able to handle one concurrent CoCo object. Use endCoCo.

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

make.coco.

Page 164: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Package ‘CoCoCg’

Namespace CoCoCg

Title API to CoCoCg

Description Interface to CoCoCg from R and Splus.

Depends R (>= 2.0.0), CoCo, methods

CoCoCg-internal Internal CoCoCg objects

Description

Internal CoCoCg and imported objects.

Details

These are not to be called by the user.

CoCoCg The CoCoCg package

Description

The CoCoCg package with the shared library of CoCoCg, for data with both discrete and continuousvariables, the continuous conditional Gaussian.

Note

Please quit by quitCoCo to remove temporary files.

Author(s)

Jens Henrik Badsberg

159

Page 165: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

160 Rats

See Also

CoCo.

Examples

# Attach data:data(Rats);

# Create a CoCoCg-object:CoCoObject <- makeCoCoCg();

# Enter the table of counts into the CoCo-object:enterDataFrame(Rats, object = CoCoObject);

# Enter the saturated model into the CoCo-object, and return a model object:fullModel <- makeModel(enterModel("*", object = CoCoObject));

# Display a graph of the model:fullGraph <- dG(fullModel, title = "Full");

# Do a backward elimination of edges:backward(recursive = TRUE, headlong = TRUE, coherent = TRUE,

follow = TRUE, object = CoCoObject);

# Display the result of the backward elimination:lastModel <- makeModel("last", object = CoCoObject);backwardGraph <- dG(lastModel, title = "Last");

# Do the EH-procedure:eh(object = CoCoObject);

# Terminate the CoCo-object with disposing temporary files:endCoCo(object = CoCoObject);

Rats Rats’ Weights

Description

Drug trail on rats: Weight loss.

Usage

data(Rats)

Page 166: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

fev 161

Format

A data frame with 24 observations on the following 4 variables.

a Sex : a factor with levels 1 2

b Drug : a factor with levels 1 2 3

x Wt. loss 1 : a numeric vector

y Wt. loss 2 : a numeric vector

Details

Page 75 of Edwards (2000): The data stem from another drug trail, in which the weight losses ofmale and female rats under three drug treatments are studied. Four rats of each sex are assigned atrandom to each drug. Weight losses are observed after one and two weeks.

Source

Edwards, David (2000). Introduction to Graphical modelling, Springer.

References

Morrison (1976). Multivariate Statistical Methods, McGraw-Hill. Mardia, Kent, and Bibby (1979).Multivariate Analysis, Academic Press.

Examples

data(Rats);CoCoObject <- makeCoCoCg();enterDataFrame(Rats, object = CoCoObject);fullModel <- makeModel(enterModel("*", object = CoCoObject));eh(object = CoCoObject);eh(sub.class = "hierarchical", object = CoCoObject);endCoCo(object = CoCoObject);

fev Childhood Respiratory Disease

Description

FEV (forced expiratory volume) is an index of pulmonary function that measures the volume ofair expelled after one second of constant effort. The data contains determinations of FEV on 654children ages 6-22 who were seen in the Childhood Respiratory Desease Study in 1980 in EastBoston, Massachusetts. The data are part of a larger study to follow the change in pulmonaryfunction over time in children.

Usage

data(fev)

Page 167: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

162 fev

Format

A data frame with 654 observations on the following 6 variables.

ID ( ID number) , a numeric vector

Age ( Years) , a numeric vector

FEV ( Liters) , a numeric vector

Height ( Inches) , a numeric vector

Sex ( Male or Female) , a factor with levels Female Male

Smoker ( Non = nonsmoker, Current = current smoke) , a factor with levels Current Non

Source

Gordon Smyth: http://www.isd.sdu.dk/ gks/data/general/fev.html

References

Tager, I. B., Weiss, S. T., Rosner, B., and Speizer, F. E. (1979). Effect of parental cigarette smokingon pulmonary function in children. American Journal of Epidemiology, 110, 15-26.

Rosner, B. (1990). Fundamentals of Biostatistics, 3rd Edition. PWS-Kent, Boston, Massachusetts.

Examples

data(fev);FevObject <- makeCoCoCg();result <- enterDataFrame(fev[,2:6], object = FevObject);enterModel("*;", object = FevObject);makeBase("current", object = FevObject);showOptions(object = FevObject);showModel("all", object = FevObject);backward(only = TRUE, sorted = TRUE, decomposable.mode = TRUE,

coherent = TRUE, headlong = TRUE, recursive = TRUE, follow = TRUE,object = FevObject);

makeCurrent("last", object = FevObject);showModel("all", object = FevObject);showModel("current", describe = TRUE, object = FevObject);str(returnExpression(model = FALSE, type = "junction.tree.components",

omit.prime.components = FALSE, omit.separators = FALSE,omit.generators = FALSE, return.flags = TRUE,object = FevObject));

endCoCo(object = FevObject)

Page 168: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

makeCoCoCg 163

makeCoCoCg Make a CoCoCg object

Description

Make a CoCoCg object.

Usage

makeCoCoCg(...)

Arguments

... make.coco.

Details

The distributed source code is only able to handle one concurrent CoCo object. Use endCoCo.

Author(s)

Jens Henrik Badsberg

See Also

make.coco.

Page 169: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

164 makeCoCoCg

Page 170: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

Index

∗Topic classesCoCoClass-class, 3CoCoIdClass-class, 4CoCoModelClass-class, 5CoCoTestClass-class, 2

∗Topic datasetsByssinosis38, 149Dawid79, 151fev, 161Fever, 152Fuchs82, 153Hochberg77, 154Rats, 160Reinis, 155Scrotal94, 156UterineCervix411, 157

∗Topic interfacecall.coco, 11call.coco.chars, 13call.coco.simple, 14clearCoCoObjects, 6coco.enter.all, 15coco.init, 16coco.load, 18coco.simple.model, 19coco.start, 20currentCoCo, 7endCoCo, 60is.gc, 22is.number, 23make.coco, 24make.model, 25makeCoCo, 158makeCoCoCg, 163my.assign, 26my.not.a.number, 27ok.coco, 27

∗Topic internalCoCo, 150

CoCo-internal, 150CoCoCg, 159CoCoCg-internal, 159CoCoCore-internal, 11CoCoGraph-internal, 1CoCoObjects-internal, 6CoCoOldData-internal, 29CoCoRaw-internal, 39

∗Topic methodsbackward, 39cleanData, 43cutpoints, 29disposeOfEh, 43disposeOfModel, 45disposeOfQtable, 46editModel, 47eh, 49ehExtract, 50ehFindDual, 52ehFit, 53ehForceAccept, 54ehForceAddDualToClass, 55ehForceFix, 56ehSetBase, 57ehSetMainEffects, 58emOn, 59enterDataFrame, 61enterList, 62enterModel, 63enterNames, 66enterQtable, 67enterTable, 68excludeMissing, 70exportCoCo, 71extractData, 73isSubmodel, 74makeCurrent, 76makeModel, 8numberVariates, 79

165

Page 171: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

166 INDEX

optionsCoCo, 81partialAssociations, 85propertyModel, 88propertySet, 90randomTableReplacement, 92read.data, 30read.q.table, 31recover.coco.model, 9redefine.factor, 32reject.cases, 33returnDeviance, 93returnEdges, 94returnExpression, 97returnFix, 101returnJunctionTree, 102returnModel, 105returnModelNumber, 107returnModelVariates, 108returnNcells, 109returnSets, 111returnTable, 116returnTest, 118returnVariableDescription,

120returnVertexOrder, 122set.data.file, 34set.output, 35setOrdinal, 127setUseVariables, 128showDeviance, 129showFormula, 131showModel, 132showOptions, 135showTable, 136showTest, 140showTests, 142showVertexOrder, 143sinkCoCo, 145skip.missing, 35source.coco, 36summaryTable, 146

∗Topic multivariatebackward, 39call.coco, 11call.coco.chars, 13call.coco.simple, 14cleanData, 43clearCoCoObjects, 6

coco.enter.all, 15coco.init, 16coco.load, 18coco.simple.model, 19coco.start, 20currentCoCo, 7cutpoints, 29disposeOfEh, 43disposeOfModel, 45disposeOfQtable, 46editModel, 47eh, 49ehExtract, 50ehFindDual, 52ehFit, 53ehForceAccept, 54ehForceAddDualToClass, 55ehForceFix, 56ehSetBase, 57ehSetMainEffects, 58emOn, 59endCoCo, 60enterDataFrame, 61enterList, 62enterModel, 63enterNames, 66enterQtable, 67enterTable, 68excludeMissing, 70exportCoCo, 71extractData, 73is.gc, 22is.number, 23isSubmodel, 74make.coco, 24make.model, 25makeCoCo, 158makeCoCoCg, 163makeCurrent, 76makeModel, 8my.assign, 26my.not.a.number, 27numberVariates, 79ok.coco, 27optionsCoCo, 81partialAssociations, 85propertyModel, 88propertySet, 90

Page 172: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

INDEX 167

randomTableReplacement, 92read.data, 30read.q.table, 31recover.coco.model, 9redefine.factor, 32reject.cases, 33returnDeviance, 93returnEdges, 94returnExpression, 97returnFix, 101returnJunctionTree, 102returnModel, 105returnModelNumber, 107returnModelVariates, 108returnNcells, 109returnSets, 111returnTable, 116returnTest, 118returnVariableDescription,

120returnVertexOrder, 122set.data.file, 34set.output, 35setOrdinal, 127setUseVariables, 128showDeviance, 129showFormula, 131showModel, 132showOptions, 135showTable, 136showTest, 140showTests, 142showVertexOrder, 143sinkCoCo, 145skip.missing, 35source.coco, 36summaryTable, 146

.-C-CoCoClass(CoCoObjects-internal), 6

.-C-CoCoIdClass(CoCoObjects-internal), 6

.-C-CoCoModelClass(CoCoObjects-internal), 6

.First.lib (CoCo-internal), 150

.First.lib (CoCoCg-internal), 159

.First.lib (CoCoCore-internal), 11

.First.lib (CoCoGraph-internal), 1

.First.lib

(CoCoObjects-internal), 6.First.lib

(CoCoOldData-internal), 29.First.lib (CoCoRaw-internal), 39.GlobalEnv, 18, 26.Last.lib (CoCoCore-internal), 11.SetSlotValue

(CoCoObjects-internal), 6.SetSlotValue

(CoCoOldData-internal), 29.after.set.current

(CoCoCore-internal), 11.base (CoCoRaw-internal), 39.before.set.both

(CoCoCore-internal), 11.before.set.current

(CoCoCore-internal), 11.clean.up (CoCoRaw-internal), 39.clear.coco.objects

(CoCoObjects-internal), 6.clear.coco.objects

(CoCoOldData-internal), 29.coco.command.implemented

(CoCoCore-internal), 11.coco.id (CoCoCore-internal), 11.coco.load (CoCoCore-internal), 11.current (CoCoRaw-internal), 39.decompose.models

(CoCoRaw-internal), 39.dispose.of.fitted.values

(CoCoRaw-internal), 39.eh.enter.base.model

(CoCoRaw-internal), 39.empty.string

(CoCoCore-internal), 11.encode (CoCoCore-internal), 11.encode.model.1

(CoCoCore-internal), 11.encode.type.and.options

(CoCoCore-internal), 11.encode.visit

(CoCoCore-internal), 11.end.temporary.object

(CoCoObjects-internal), 6.enter.double.list

(CoCoRaw-internal), 39.enter.n.interactions

(CoCoRaw-internal), 39

Page 173: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

168 INDEX

.false.if.NULL(CoCoCore-internal), 11

.fix.edges (CoCoRaw-internal), 39

.get.cocolib.name(CoCoCore-internal), 11

.get.lib.and.tmp(CoCoCore-internal), 11

.get.rs.cshlib.name(CoCoCore-internal), 11

.is.current.model(CoCoCore-internal), 11

.is.nil.model(CoCoCore-internal), 11

.mips.load (CoCoCore-internal), 11

.my.ascii (CoCoCore-internal), 11

.my.dyn.load.open(CoCoCore-internal), 11

.my.getenv (CoCoCore-internal), 11

.my.test.file.found(CoCoCore-internal), 11

.my.trace (CoCoCore-internal), 11

.names.from.model(CoCoRaw-internal), 39

.new.coco (CoCoObjects-internal),6

.new.coco (CoCoOldData-internal),29

.object.of.model(CoCoObjects-internal), 6

.object.of.model(CoCoOldData-internal), 29

.object.of.models(CoCoCore-internal), 11

.object.of.thing(CoCoObjects-internal), 6

.object.of.thing(CoCoOldData-internal), 29

.omit.test (CoCoRaw-internal), 39

.onAttach (CoCo-internal), 150

.onAttach (CoCoCg-internal), 159

.onAttach (CoCoCore-internal), 11

.onAttach (CoCoGraph-internal), 1

.onAttach (CoCoObjects-internal),6

.onAttach (CoCoRaw-internal), 39

.onLoad (CoCo-internal), 150

.onLoad (CoCoCg-internal), 159

.onLoad (CoCoCore-internal), 11

.onLoad (CoCoGraph-internal), 1

.onLoad (CoCoObjects-internal), 6

.onLoad (CoCoOldData-internal), 29

.onLoad (CoCoRaw-internal), 39

.packageName (CoCoCore-internal),11

.packageName(CoCoGraph-internal), 1

.packageName(CoCoObjects-internal), 6

.plotCoCo (CoCoRaw-internal), 39

.recover (CoCoObjects-internal), 6

.recover.model(CoCoOldData-internal), 29

.recover.reference(CoCoOldData-internal), 29

.return.complex(CoCoRaw-internal), 39

.return.factor.type.list(CoCoCore-internal), 11

.return.key(CoCoObjects-internal), 6

.return.key(CoCoOldData-internal), 29

.return.level.list(CoCoCore-internal), 11

.return.missing.list(CoCoCore-internal), 11

.return.model.number(CoCoObjects-internal), 6

.return.model.number(CoCoOldData-internal), 29

.return.model.of.object(CoCoObjects-internal), 6

.return.model.of.object(CoCoOldData-internal), 29

.return.name.list.string(CoCoCore-internal), 11

.return.object.model.number(CoCoObjects-internal), 6

.return.object.model.number(CoCoOldData-internal), 29

.return.reference(CoCoObjects-internal), 6

.return.reference(CoCoOldData-internal), 29

.return.type(CoCoObjects-internal), 6

Page 174: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

INDEX 169

.return.type(CoCoOldData-internal), 29

.set.acceptance(CoCoCore-internal), 11

.set.asymptotic(CoCoOldData-internal), 29

.set.coco.value(CoCoObjects-internal), 6

.set.coco.value(CoCoOldData-internal), 29

.set.components(CoCoCore-internal), 11

.set.current.model(CoCoCore-internal), 11

.set.datastructure(CoCoRaw-internal), 39

.set.em.epsilon(CoCoOldData-internal), 29

.set.em.initial(CoCoOldData-internal), 29

.set.em.max.iterations(CoCoOldData-internal), 29

.set.exact.epsilon(CoCoOldData-internal), 29

.set.exact.test(CoCoOldData-internal), 29

.set.ic (CoCoRaw-internal), 39

.set.ips.epsilon(CoCoOldData-internal), 29

.set.ips.max.iterations(CoCoOldData-internal), 29

.set.ips.stop.criterion(CoCoOldData-internal), 29

.set.list.of.number.of.tables(CoCoOldData-internal), 29

.set.number.of.tables(CoCoOldData-internal), 29

.set.page.formats(CoCoOldData-internal), 29

.set.paging.length(CoCoOldData-internal), 29

.set.power.lambda(CoCoOldData-internal), 29

.set.print.formats(CoCoOldData-internal), 29

.set.rejection(CoCoCore-internal), 11

.set.seed.coco

(CoCoOldData-internal), 29.set.separators

(CoCoCore-internal), 11.set.switch (CoCoRaw-internal), 39.set.table.formats

(CoCoOldData-internal), 29.set.test (CoCoOldData-internal),

29.show.log.lik (CoCoRaw-internal),

39.split.data (CoCoCore-internal),

11.split.model.gc

(CoCoRaw-internal), 39.split.name.set

(CoCoRaw-internal), 39.sub.recover.coco

(CoCoObjects-internal), 6.sub.split.names

(CoCoRaw-internal), 39.table.value (CoCoCore-internal),

11.to.search (CoCoCore-internal), 11.visit.interval

(CoCoCore-internal), 11.visit.model (CoCoCore-internal),

11.visit.models

(CoCoCore-internal), 11

array, 68assign, 26

backward, 15, 39, 50, 77, 94, 95, 101, 102,119, 128, 130, 141, 143

Byssinosis38, 149

call.coco, 11, 12, 14–16, 20call.coco.chars, 12, 13, 14call.coco.longs, 12, 14call.coco.longs

(call.coco.chars), 13call.coco.message, 12call.coco.reals, 12, 14call.coco.reals

(call.coco.chars), 13call.coco.simple, 12, 14, 15cleanData, 3, 15, 43clearCoCoObjects, 6

Page 175: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

170 INDEX

CoCo, 150, 160CoCo-internal, 150coco.enter.all, 12, 15, 16coco.enter.string, 14coco.enter.string

(call.coco.chars), 13coco.init, 3–6, 12, 13, 16, 18, 21, 24–28,

61, 123coco.init (CoCoCg), 159coco.init (CoCoOldData-internal),

29coco.init (CoCoRaw-internal), 39coco.init (CoCo), 150coco.load, 17, 18, 24coco.replace.all, 12, 16coco.replace.all

(coco.enter.all), 15coco.resume, 12, 20coco.resume

(CoCoOldData-internal), 29coco.resume (coco.start), 20coco.simple.command, 12, 15coco.simple.command

(call.coco.simple), 14coco.simple.double, 15, 20coco.simple.double

(coco.simple.model), 19coco.simple.model, 15, 19, 20coco.start, 20coco.start

(CoCoOldData-internal), 29coco.string.double, 12, 14, 20coco.string.double

(coco.simple.model), 19coco.string.model, 12, 14, 20coco.string.model

(coco.simple.model), 19CoCoCg, 151, 159CoCoCg-internal, 159CoCoClass-class, 5, 6CoCoClass-class, 3, 5CoCoCore-internal, 11CoCoGraph-internal, 1CoCoIdClass-class, 4, 6CoCoIdClass-class, 4CoCoModelClass-class, 4, 5, 9CoCoModelClass-class, 5CoCoObjects-internal, 6

CoCoOldData-internal, 29CoCoRaw-internal, 39CoCoTestClass-class, 2currentCoCo, 7, 7, 8currentCoCo

(CoCoOldData-internal), 29cutpoints, 3, 12, 29

Dawid79, 151dG (CoCo), 150dg, 1, 150dg (CoCoGraph-internal), 1dg,character-method

(CoCoGraph-internal), 1dg,CoCoModelClass-method

(CoCoGraph-internal), 1dg,numeric-method

(CoCoGraph-internal), 1dimnames, 68disposeOfEh, 15, 43, 50, 57disposeOfModel, 45disposeOfQtable, 14, 46, 68dyn.load, 18dynamic.Graph

(CoCoOldData-internal), 29

editModel, 12, 20, 25, 42, 47, 64, 77, 88, 90editmodel, 19, 20eh, 15, 42, 44, 49, 51–55, 57–59, 95, 102, 143ehExtract, 15, 50ehFindDual, 15, 52, 55ehFit, 14, 15, 53, 54ehForceAccept, 14, 51, 53, 54ehForceAddDualToClass, 15, 52, 55ehForceFix, 14, 56, 58, 59, 95, 101, 102ehForceReject, 14, 51, 53ehForceReject (ehForceAccept), 54ehSetBase, 14, 15, 57, 59ehSetMainEffects, 14, 58, 59emOn, 4, 15, 59, 70, 71endCoCo, 7, 12, 13, 15, 16, 21, 24, 60, 61, 66,

71, 158, 163endCoCo (CoCoOldData-internal), 29enterDataFrame, 4, 61, 71, 92, 128enterList, 4, 14, 36, 62, 62, 63, 66, 67enterModel, 12, 14, 25, 45, 47, 49, 63, 74,

75, 78, 94, 105, 108, 119, 130, 133,141

Page 176: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

INDEX 171

enterNames, 3, 12, 30–34, 36, 37, 60–63,66, 66–70, 110, 128

enterQlist, 4, 12, 43, 46, 67, 71enterQlist (enterQtable), 67enterQtable, 4, 12, 43, 46, 67, 71enterTable, 4, 14, 36, 66, 67, 68, 68enterTwoList, 4enterTwoLists, 12enterTwoLists (enterList), 62ExcludeMissing, 4excludeMissing, 14, 15, 36, 60, 67, 70,

71, 110exportCoCo, 9, 14, 20, 25, 30–36, 42–46,

48, 49, 51–56, 58–61, 63, 64, 66, 67,69, 70, 71, 72–74, 77, 80, 81, 85, 86,88, 90, 92, 93, 95, 98, 101, 103, 105,107, 108, 110, 112, 117, 119, 120,122, 127–129, 132, 133, 135, 137,140, 142, 143, 145, 146

extractData, 73

fev, 161Fever, 152forward, 15, 50, 77, 94, 95, 101, 102, 119,

121, 128, 130, 141, 143forward (backward), 39Fuchs82, 153

graphComponents,CoCoModelClass-method(CoCoGraph-internal), 1

graphEdges,CoCoModelClass-method(CoCoGraph-internal), 1

GraphLatticeProto-class, 4–6

Hochberg77, 154

importCoCo, 3, 14, 72importCoCo (exportCoCo), 71initialize,CoCoTestClass-method

(CoCoTestClass-class), 2is.character, 22is.complex, 23is.gc, 22is.na, 23is.number, 23is.number (CoCoOldData-internal),

29is.numeric, 23isSubmodel, 12, 19, 74, 78, 93, 108, 119,

129, 140

label (CoCoOldData-internal), 29label,CoCoTestClass-method

(CoCoTestClass-class), 2

make.coco, 24, 158, 163make.coco (CoCoOldData-internal),

29make.cococg

(CoCoOldData-internal), 29make.cococg (make.coco), 24make.model, 25make.model

(CoCoOldData-internal), 29makeBase, 14makeBase (makeCurrent), 76makeCoCo, 2, 3, 9, 10, 158makeCoCoCg, 3, 163makeCurrent, 9, 14, 20, 47, 51, 64, 74, 75,

76, 94, 105, 107, 108, 119, 130, 133,141

makeCurrentCoCo, 7, 71makeCurrentCoCo

(CoCoOldData-internal), 29makeCurrentCoCo (currentCoCo), 7makeModel, 5, 8, 47, 64, 74, 75, 94, 105,

119, 130, 133, 141makeModel (CoCoOldData-internal),

29modifyModel, 1modifyModel (CoCoGraph-internal),

1modifyModel

(CoCoOldData-internal), 29modifyModel,CoCoModelClass-method

(CoCoGraph-internal), 1my.assign, 26my.assign (CoCoOldData-internal),

29my.not.a.number, 27

newCoCoTestObject(CoCoOldData-internal), 29

numberVariates, 14, 79

ok.coco, 13, 27options, 81, 85optionsCoCo, 14–16, 40, 42, 71, 81, 94,

116, 119, 128, 130, 135, 141, 143,146

Page 177: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

172 INDEX

or.reject.cases, 3, 12or.reject.cases (reject.cases), 33or.select.cases, 3, 12or.select.cases (reject.cases), 33

partialAssociations, 14, 85, 94, 119,128, 130, 141

propertyModel, 9, 12, 20, 42–46, 48, 49,51–56, 58–61, 63, 64, 66, 67, 69–71,73–75, 77, 78, 80, 86, 88, 88, 90–93,95, 98, 101, 103, 105, 107, 108, 110,112, 113, 117, 119, 120, 122,127–129, 132, 133, 135, 137, 140,142, 143, 146

propertySet, 12, 89, 90, 113

quit, 60quitCoCo, 150, 159quitCoCo (CoCoOldData-internal),

29quitCoCo (endCoCo), 60

randomTableReplacement, 3, 15, 92Rats, 160read.data, 3, 15, 30, 30, 32–34, 36read.factors, 3, 15read.factors (read.data), 30read.list, 3, 15read.list (read.data), 30read.names, 3, 15read.names (read.data), 30read.observations, 3, 15read.observations (read.data), 30read.q.list, 3, 14read.q.list (read.q.table), 31read.q.table, 3, 14, 31read.specification, 3, 15read.specification (read.data), 30read.table.coco, 3, 15read.table.coco (read.data), 30recover.coco.model, 9recover.coco.model

(CoCoOldData-internal), 29redefine.factor, 3, 12, 32Reinis, 155Reinis (CoCoCg), 159reject.cases, 3, 12, 33returnDeviance, 12, 93, 119, 128, 130,

141

returnEdges, 12, 94, 106returnExpression, 97, 104returnFix, 57, 95, 101, 102returnJunctionTree, 97, 98, 102returnModel, 8, 14, 19, 22, 25, 41, 58, 75,

78, 88, 90, 92, 94, 95, 97, 103, 105,108, 109, 112, 116, 119, 122, 130,132, 136, 141, 143, 146

returnModelNumber, 9, 14, 20, 47, 75, 77,78, 94, 107, 119, 130, 141

returnModelVariates, 14, 108returnNcells, 12, 109, 129returnSets, 14, 16, 111returnTable, 12, 16, 116, 145returnTest, 12, 48, 75, 78, 93, 94, 108,

118, 128, 130, 141, 143returnVariableDescription, 120returnVertexOrder, 16, 113, 122, 144

Scrotal94, 156select.cases, 3, 12select.cases (reject.cases), 33set.data.file, 3, 14, 31, 34set.observations.file, 3, 14set.observations.file

(set.data.file), 34set.output, 14, 35set.specification.file, 3, 14set.specification.file

(set.data.file), 34setGraphComponents,CoCoModelClass-method

(CoCoGraph-internal), 1setGraphEdges,CoCoModelClass-method

(CoCoGraph-internal), 1setOrdinal, 4, 14, 127setSlots,CoCoTestClass-method

(CoCoTestClass-class), 2setUseVariables, 3, 14, 15, 59, 66, 67,

71, 73, 80, 110, 120, 128showDeviance, 20, 94, 119, 128, 129, 141,

143showFormula, 20, 131showModel, 45, 53, 54, 64, 75, 78, 94, 108,

119, 130, 132, 132, 141showOptions, 15, 80, 85, 95, 102, 135, 146showTable, 12, 14, 20, 116, 117, 136, 146,

147showTest, 20, 87, 94, 119, 130, 140, 143showTests, 15, 142

Page 178: The CoCo Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/CoCo.pdf · Package ‘CoCoObjects’ Namespace CoCoObjects Title Objects for CoCo Description

INDEX 173

showVertexOrder, 20, 143sinkCoCo, 14, 145skip.missing, 3, 15, 35source.coco, 14, 36subModifyModel

(CoCoGraph-internal), 1subModifyModel

(CoCoOldData-internal), 29subModifyModel,CoCoModelClass-method

(CoCoGraph-internal), 1summaryTable, 12, 139, 146

testEdge, 1testEdge (CoCoGraph-internal), 1testEdge (CoCoOldData-internal),

29testEdge,CoCoModelClass-method

(CoCoGraph-internal), 1testLabel (CoCoOldData-internal),

29testWidth (CoCoOldData-internal),

29

UterineCervix411, 157

width (CoCoOldData-internal), 29width,CoCoTestClass-method

(CoCoTestClass-class), 2