gRchain: gRchain: Chain Graph Models in R

Description Details Examples

Description

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.

Details

The stops package provides five categories of important functions:

Models & Algorithms:

Helper functions:

Convenience functions:

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:

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

Maintainer: Thomas Rusch

Examples

 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)

gRchain documentation built on May 2, 2019, 6:48 p.m.