Fits (block) chain graph models. The package contains various functions, wrappers, methods and classes for fitting, plotting and displaying different chain graph models. Currently the Cox Wermuth (1996) strategy is implemented based on the description in Caputo et al. (1997) together with some liberal interpretations of details by the package authors. Traceable regressions will follow.

The stops package provides five categories of important functions:

Models & Algorithms:

coxwer() ... which fits a block recursive chain graph model as in Cox and Wermuth (1996).

Helper functions:

prep_coxwer()... A function to set up the variable frame

Convenience functions:

adjmatrix() ... returns an adjacency matrix for the chain graph

write_cw() ... write a plot of the graphical model to a file

Methods: For most of the objects returned by the high-level functions S3 classes and methods for standard generics were implemented, including print, summary, plot, plot, predict.

References:

Caputo, A., Heinicke, A. \& Pigeot, I. (1997). A graphical chain model derived from a model selection strategy for the sociologists graduates study.

*Collaborative Research Center 386, Discussion Paper 73.*Cox, D. \& Wermuth, N. (1996).

*Multivariate Dependencies: Models, Analysis, Interpretation*. Florida:Chapman\&Hall/CRC.Rusch, T., Hatzinger, R. and Wurzer, M. (2013) Chain Graph Models in R: Implementing the Cox-Wermuth Procedure. Psychoco 2013, Zuerich, Switzerland.

Wurzer, M. \& Hatzinger, R. (2013). Using Graphical Models in Microsimulation. In C. O'Donoghue (ed.),

*New Pathways In Microsimulation*. Ashgate Publishing.

Authors: Thomas Rusch, Marcus Wurzer, Reinhold Hatzinger Contributors: Kathrin Gruber

Maintainer: Thomas Rusch

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ```
data(cmc)
data(cmc_prep)
#this is a 5 block model with age being
#purely explanatory (block 5) and nRchild and
#contraceptive being purely the targets (block 1)
#Using a var.frame
cmc_prep
res_cmc <- coxwer(var.frame=cmc_prep, data=cmc)
print(res_cmc) #Prints adjacency matrix
summary(res_cmc,target="contraceptive") #model path to "contraceptive" as the target variable
#Using a formula
#vartype is automatically detected which is crude for non-factors
res_cmc2<-coxwer(contraceptive + nrChild ~ #block 1 - only targets
mediaExp ~ #block 2
solIndex ~ #block 3
wifeRel + wifeWork + husbOcc + wifeEdu + husbEdu ~ #block 4
age, #block 5 - purely explanatory
data=cmc)
## Not run:
#Using a formula and specifying the vartype
#(so the algorithm can use better models for the metric/continuous variables)
res_cmc3<-coxwer(contraceptive + nrChild ~
mediaExp ~
solIndex ~
wifeRel + wifeWork + husbOcc + wifeEdu + husbEdu ~
age,
vartype=c("cate","count","bin","ord","bin","bin","ord","ord","ord","metric"),
data=cmc)
plot(res_cmc3)
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.