#### Model fitting (no group effect)
sem0 <- SEMrun(graph = sachs$graph, data = log(sachs$pkc))
summary(sem0$fit)
head(parameterEstimates(sem0$fit))
# Graphs
gplot(sem0$graph, main = "significant edge weights")
plot(sem0$graph, layout = layout.circle, main = "significant edge weights")
#### Model fitting (common model, group effect on nodes)
sem1 <- SEMrun(graph = sachs$graph, data = log(sachs$pkc),
group = sachs$group)
# Fitting summaries
summary(sem1$fit)
print(sem1$gest)
head(parameterEstimates(sem1$fit))
# Graphs
gplot(sem1$graph, main = "Between group node differences")
plot(sem1$graph, layout = layout.circle, main = "Between group node differences")
#### Two-group model fitting (group effect on edges)
sem2 <- SEMrun(graph = sachs$graph, data = log(sachs$pkc),
group = sachs$group,
fit = 2)
# Summaries
summary(sem2$fit)
print(sem2$dest)
head(parameterEstimates(sem2$fit))
# Graphs
gplot(sem2$graph, main = "Between group edge differences")
plot(sem2$graph, layout = layout.circle, main = "Between group edge differences")
# \donttest{
# Fitting and visualization of a large pathway:
g <- kegg.pathways[["Neurotrophin signaling pathway"]]
G <- properties(g)[[1]]
summary(G)
# Nonparanormal(npn) transformation
als.npn <- transformData(alsData$exprs)$data
g1 <- SEMrun(G, als.npn, alsData$group, algo = "cggm")$graph
g2 <- SEMrun(g1, als.npn, alsData$group, fit = 2, algo = "cggm")$graph
# extract the subgraph with node and edge differences
g2 <- g2 - E(g2)[-which(E(g2)$color != "gray50")]
g <- properties(g2)[[1]]
# plot graph
E(g)$color<- E(g2)$color[E(g2) %in% E(g)]
gplot(g, l="fdp", psize=40, main="node and edge group differences")
# }
Run the code above in your browser using DataLab