Description Usage Arguments Value Examples
Learns a power chain graph following Franco, Barros, Wiberg & Laros (under review).
1 |
data |
A data frame of the variables to be included in the PCG. |
clusters |
A integer vector of expected classes for each variable in data. If an exploratory approach is preferred, use "ega" for learning the cluster by the EGA method or "cgmm" learning the cluster by the CGMM method. |
alpha |
The significance level for testing the directional relations with the PC-stable algorithm. |
fineTuning |
Boolean indicating if fine-tuning should be performed. Defaults to FALSE. |
A list containing the following component:
PCG |
The estimated PCG. |
clusters |
The integer vector of expected classes for each variable in data. |
CG_U |
The undirected part of the chain graph induced by the PCG. |
CG_D |
The directed part of the chain graph induced by the PCG. |
CG_PC |
The directed part of the chain graph implied by the PCG, fine-tuned with the PC-stable algorithm. |
CG_HC |
The directed part of the chain graph implied by the PCG, fine-tuned with the hill-climbing algorithm. |
CG_MMCC |
The directed part of the chain graph implied by the PCG, fine-tuned with the Min-Max hill-climbing algorithm. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ### Use Big Five data
require(psych)
data("bfi")
data <- bfi[complete.cases(bfi),1:25]
### Run the analysis
fit <- PCG(data, clusters="ega", alpha=.05, fineTuning=F)
### Extract the results
pcg <- fit$PCG
ug <- fit$CG_U
dg <- fit$CG_D
### Visualize
require(qgraph)
require(EGAnet)
par(mfrow=c(2,1))
qgraph::qgraph(pcg)
qgraph::qgraphMixed(ug * qgraph::cor_auto(data, forcePD=T),
dg * EGAnet::EGA(data, plot=F)$network,
groups = as.factor(fit$clusters),
labels = colnames(data))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.