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
178
Embed
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
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
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
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.
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
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.
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".
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.
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.
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.
10 recover.coco.model
Author(s)
Jens Henrik Badsberg
See Also
makeCoCo.
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.
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.
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.
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.
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.
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.
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.
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.
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)
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
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.
38 source.coco
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.
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).
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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
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.
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, ...), ...)
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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, ...), ...)
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.
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();
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".
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.
data = data, ...), ...)makeBase(model = "current", silent = TRUE, both = FALSE, push = FALSE,
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.
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.
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.
... 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.
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"
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"
84 optionsCoCo
Exact
exact.test chr "off": "off", "flop", "on", "all", or "deviance"exact.epsilon num 1e-07
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.
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 :
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.
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.
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.
returnEdges Return the indices of vertices of edges
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();
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.
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.
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.
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.
102 returnJunctionTree
Author(s)
Jens Henrik Badsberg
See Also
forward, backward, eh, ehForceFix, returnFix and showOptions.
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.
104 returnJunctionTree
Note
The function is only available for CoCoCg objects.
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.
106 returnModel
Note
Currently only the generating class can be returned by as.edges.
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.
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-
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 :
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.
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.
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.
returnTest Return the Pearson χ2, the power divergence, etc.
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.
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.
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.
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.
# 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"!!!
Print on standard output the expression for estimating the parameters of the model.
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, ...), ...)
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.
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.
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 :
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.
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
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.
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.
# 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
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.
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.
148 summaryTable
Package ‘CoCo’
Namespace CoCo
Title CoCo - Graphical modelling on contingency tables
Description CoCo - Graphical modelling on contingency tables
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.
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
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)
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.
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,
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.
Zhi Geng and Chooichiro Asano (1988): Recursive procedures for hierarchical loglinear models onhigh-dimensional contingency tables. J. Japanese Soc. Comp. Statist, 17-26.
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.
Edwards, D. and Havranek, T. (1987). A fast model selection procedure for large families of models.J. Amer. Stat. Assoc. 82: 205-231.
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)
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.
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
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)
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.
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)
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.