Title: | Structure Learning with Copula Graphical Model |
---|---|
Description: | Statistical tool for learning the structure of direct associations among variables for continuous data, discrete data and mixed discrete-continuous data. The package is based on the copula graphical model in Behrouzi and Wit (2017) <doi:10.1111/rssc.12287>. |
Authors: | Pariya Behrouzi <https://orcid.org/0000-0001-6762-5433> |
Maintainer: | Pariya Behrouzi <[email protected]> |
License: | GPL-3 |
Version: | 0.1.2 |
Built: | 2024-11-15 05:06:47 UTC |
Source: | https://github.com/cran/nutriNetwork |
Statistical tool for learning the structure of direct associations among variables for continuous data, discrete data and mixed discrete-continuous data. The package is based on the copula graphical model in Behrouzi and Wit (2017) <doi:10.1111/rssc.12287>.
Pariya Behrouzi
Maintainers: Pariya Behrouzi [email protected]
1. Behrouzi, P., and Wit, E. C. (2019). Detecting epistatic selection with partially observed genotype data by using copula graphical models. Journal of the Royal Statistical Society: Series C (Applied Statistics), 68(1), 141-160.
3. Behrouzi, P., and Wit, E. C. (2017c). netgwas: An R Package for Network-Based Genome-Wide Association Studies. arXiv preprint, arXiv:1710.01236.
This is the main functions of the nutriNetwork package. This function infers the direct associations between variables. In another words, it measures pairwise associations among variables while correcting the effect of remaining variables. Three methods are available to reconstruct networks, namely (i) Gibbs sampling, (ii) approximation method, and (iii) nonparanormal approach within the copula graphical model. The first two methods are able to deal with missing genotypes. The last one is computationally faster.
nutriNetwork(data, method = "gibbs", rho = NULL, n.rho = NULL, rho.ratio = NULL, ncores = 1, em.iter = 5, em.tol=.001, verbose = TRUE)
nutriNetwork(data, method = "gibbs", rho = NULL, n.rho = NULL, rho.ratio = NULL, ncores = 1, em.iter = 5, em.tol=.001, verbose = TRUE)
data |
An ( |
method |
Reconstructing undirected graph using the three methods: "gibbs", "approx", and "npn". For a medium (~500) and a large number of variables we recommend to choose "gibbs" and "approx", respectively. Choosing "npn" for a very large number of variables (> 2000) is computationally efficient. The default method is "gibbs". |
rho |
Optional. A decreasing sequence of non-negative numbers that control the sparsity level. Leaving the input as |
n.rho |
Optional. The number of regularization parameters. The default value is |
rho.ratio |
Optional. Determines distance between the elements of |
ncores |
Optional. The number of cores to use for the calculations. Using |
em.iter |
Optional. The number of EM iterations. The default value is 5. |
em.tol |
Optional. A criteria to stop the EM iterations. The default value is .001. |
verbose |
Optional. Providing a detail message for tracing output. The default value is |
This function estimates a graph path . To select an optimal graph please refer to selectnet
.
An object with S3 class "nutriNetwork"
is returned:
Theta |
A list of estimated p by p precision matrices that show the conditional independence relationships patterns among measured items. |
path |
A list of estimated p by p adjacency matrices. This is the graph path corresponding to |
ES |
A list of estimated p by p conditional expectation corresponding to |
Z |
A list of n by p transformed data based on Gaussian copula. |
rho |
A |
loglik |
A |
data |
The |
Pariya Behrouzi
Maintainers: Pariya Behrouzi [email protected]
######## toy example data(vfit) test_dat <- vfit[1:10, c("sex", "ani.pro", "veg.pro", "B6", "B12", "B9", "SPPB.total", "HandGrip" )] out_test <- nutriNetwork(test_dat, method = "gibbs") ######## out <- nutriNetwork(vfit, method = "gibbs") sel <- selectnet(out) cl <- c(rep("gray70", 7), rep("green3",17), rep("red3",5)) plot(sel, vis= "parcor.network", sign.edg = TRUE, vertex.color = cl, curve = TRUE, layout.tree= TRUE, root.node= c(26, 29), pos.legend= "bottomleft", cex.legend=1) #diffeent visualization plot(sel, vis= "parcor.network", sign.edg = TRUE, layout = NULL, vertex.color = cl, curve = TRUE, pos.legend= "topleft", cex.legend=1 )
######## toy example data(vfit) test_dat <- vfit[1:10, c("sex", "ani.pro", "veg.pro", "B6", "B12", "B9", "SPPB.total", "HandGrip" )] out_test <- nutriNetwork(test_dat, method = "gibbs") ######## out <- nutriNetwork(vfit, method = "gibbs") sel <- selectnet(out) cl <- c(rep("gray70", 7), rep("green3",17), rep("red3",5)) plot(sel, vis= "parcor.network", sign.edg = TRUE, vertex.color = cl, curve = TRUE, layout.tree= TRUE, root.node= c(26, 29), pos.legend= "bottomleft", cex.legend=1) #diffeent visualization plot(sel, vis= "parcor.network", sign.edg = TRUE, layout = NULL, vertex.color = cl, curve = TRUE, pos.legend= "topleft", cex.legend=1 )
Plot the graph path which is the output of the nutriNetwork
.
## S3 method for class 'nutriNetwork' plot( x, n.memberships=NULL , ... )
## S3 method for class 'nutriNetwork' plot( x, n.memberships=NULL , ... )
x |
An object from "nutriNetwork" class. |
n.memberships |
A vector containing number of variables in each group. For example, the |
... |
System reserved (No specific usage) |
Pariya Behrouzi
Maintainer: Pariya Behrouzi [email protected]
Behrouzi, P., and Wit, E. C. (2017c). netgwas: An R Package for Network-Based Genome-Wide Association Studies. arXiv preprint, arXiv:1710.01236.
data(vfit) out <- nutriNetwork(vfit, method = "gibbs") plot(out)
data(vfit) out <- nutriNetwork(vfit, method = "gibbs") plot(out)
Plot the optimal graph by model selection
## S3 method for class 'select' plot(x, vis= NULL, xlab= NULL, ylab= NULL, n.mem= NULL, vertex.label= FALSE, ..., layout= NULL, label.vertex= "all", vertex.size= NULL, vertex.color= NULL, edge.color= "gray29", sel.nod.label= NULL, label.size = NULL, w.btw= 800, w.within = 10, sign.edg= TRUE, edge.width= NULL, edge.label= NULL, max.degree= NULL, layout.tree= NULL, root.node= NULL, degree.node= NULL, curve= FALSE, pos.legend= "bottomleft", cex.legend= 0.8, iterl = NULL, temp = NULL, tk.width = NULL, tk.height= NULL)
## S3 method for class 'select' plot(x, vis= NULL, xlab= NULL, ylab= NULL, n.mem= NULL, vertex.label= FALSE, ..., layout= NULL, label.vertex= "all", vertex.size= NULL, vertex.color= NULL, edge.color= "gray29", sel.nod.label= NULL, label.size = NULL, w.btw= 800, w.within = 10, sign.edg= TRUE, edge.width= NULL, edge.label= NULL, max.degree= NULL, layout.tree= NULL, root.node= NULL, degree.node= NULL, curve= FALSE, pos.legend= "bottomleft", cex.legend= 0.8, iterl = NULL, temp = NULL, tk.width = NULL, tk.height= NULL)
x |
An object with S3 class "select" |
vis |
Visualizing the results as a graph (network) or as a matrix. There are 4 options to visulize the selected graph: (i) "CI": plotting conditional independence (CI) relationships between variables, (ii) "interactive": plotting the conditional independence network, where opens a new windows with interactive graph drawing facility, and (iii) "parcor.network": plots the estimated graph based on partial correlation values. (iv) "parcor.interactive": plots the estimated graph based on partial correlation matrix with an interactive graph drawing facility. Default is "CI". |
xlab |
ONLY applicable when |
ylab |
ONLY applicable when |
n.mem |
A vector of memberships. For example, the |
vertex.label |
ONLY applicable when |
... |
ONLY applicable when |
layout |
ONLY applicable when |
label.vertex |
ONLY applicable when |
vertex.size |
Optional. The size of vertices in the graph visualization. The default value is 7. |
vertex.color |
ONLY applicable when |
edge.color |
ONLY applicable when |
sel.nod.label |
ONLY applicable when |
label.size |
ONLY applicable for |
w.btw |
Distance between nodes from different memberships of |
w.within |
Distance of nodes within one membership of |
sign.edg |
Optional. ONLY applicable when |
edge.width |
Optional. ONLY applicable when |
edge.label |
Optional. ONLY applicable when |
max.degree |
Optional. ONLY applicable when |
layout.tree |
Optional. ONLY applicable when |
root.node |
Optional. ONLY applicable when |
degree.node |
Optional. ONLY applicable when |
curve |
Optional. ONLY applicable when |
pos.legend |
Applicable when |
cex.legend |
Applicable when |
iterl |
Optional. ONLY applicable when |
temp |
Optional. ONLY applicable when |
tk.width |
Optional. The size of the drawing area of interactive plot. |
tk.height |
Optional. The size of the drawing area of interactive plot. |
An object with S3 class "select"
is returned:
network |
Plot of a selected graph, when |
adjacency |
Conditional independence (CI) relationships between variables, when |
network |
Interactive plot of a selected graph with .eps format, when |
Pariya Behrouzi
Maintainer: Pariya Behrouzi [email protected]
Behrouzi, P., and Wit, E. C. (2017c). netgwas: An R Package for Network-Based Genome-Wide Association Studies. arXiv preprint, arXiv:1710.01236.
data(vfit) out <- nutriNetwork(vfit) sel <- selectnet(out) plot(sel, vis= "image.parcorMatrix")
data(vfit) out <- nutriNetwork(vfit) sel <- selectnet(out) plot(sel, vis= "image.parcorMatrix")
Print a summary of results from function nutriNetwork
.
## S3 method for class 'nutriNetwork' print(x, ...)
## S3 method for class 'nutriNetwork' print(x, ...)
x |
An object with S3 class "nutriNetwork" |
... |
System reserved (No specific usage) |
Pariya Behrouzi and Ernst C. Wit
Maintainer: Pariya Behrouzi [email protected]
data(vfit) out <- nutriNetwork(vfit, method ="npn"); out
data(vfit) out <- nutriNetwork(vfit, method ="npn"); out
Print function for selectnet
.
## S3 method for class 'select' print(x, ...)
## S3 method for class 'select' print(x, ...)
x |
An object with S3 class "select" |
... |
System reserved (No specific usage) |
Pariya Behrouzi
Maintainer: Pariya Behrouzi [email protected]
Behrouzi, P., and Wit, E. C. (2017c). netgwas: An R Package for Network-Based Genome-Wide Association Studies. arXiv preprint, arXiv:1710.01236.
data(vfit) out <- nutriNetwork(vfit, method ="npn") sel <- selectnet(out) #A pxp adjacency matrix sel$opt.adj
data(vfit) out <- nutriNetwork(vfit, method ="npn") sel <- selectnet(out) #A pxp adjacency matrix sel$opt.adj
Estimate the optimal graph based on different information criteria .
selectnet(nutriNetwork.obj, opt.index= NULL, criteria= NULL, ebic.gamma=0.5, ncores= NULL, verbose= TRUE)
selectnet(nutriNetwork.obj, opt.index= NULL, criteria= NULL, ebic.gamma=0.5, ncores= NULL, verbose= TRUE)
nutriNetwork.obj |
An object with S3 class "nutriNetwork" |
opt.index |
The program internally determines an optimal graph using |
criteria |
Model selection criteria. "ebic" and "aic" are available. BIC model selection can be calculated by fixing |
ebic.gamma |
The tuning parameter for ebic. The |
ncores |
The number of cores to use for the calculations. Using |
verbose |
If |
An obj with S3 class "selectnet" is returned:
opt.adj |
The optimal graph selected from the graph path |
opt.theta |
The optimal precision matrix from the graph path |
opt.sigma |
The optimal covariance matrix from the graph path |
ebic.scores |
Extended BIC scores for regularization parameter selection at the EM convergence. Applicable if |
opt.index |
The index of optimal regularization parameter. |
opt.rho |
The selected regularization parameter. |
par.cor |
A partial correlation matrix. |
and anything else that is included in the input nutriNetwork.obj
.
Pariya Behrouzi
Maintainer: Pariya Behrouzi [email protected]
1. Behrouzi, P., and Wit, E. C. (2019). Detecting epistatic selection with partially observed genotype data by using copula graphical models. Journal of the Royal Statistical Society: Series C (Applied Statistics), 68(1), 141-160.
2. Behrouzi, P., and Wit, E. C. (2017c). netgwas: An R Package for Network-Based Genome-Wide Association Studies. arXiv preprint, arXiv:1710.01236.
3. Ibrahim, Joseph G., Hongtu Zhu, and Niansheng Tang. (2012). Model selection criteria for missing-data problems using the EM algorithm. Journal of the American Statistical Association.
4. D. Witten and J. Friedman. (2011). New insights and faster computations for the graphical lasso. Journal of Computational and Graphical Statistics, to appear.
5. J. Friedman, T. Hastie and R. Tibshirani. (2007). Sparse inverse covariance estimation with the lasso, Biostatistics.
6. Foygel, R. and M. Drton. (2010). Extended bayesian information criteria for Gaussian graphical models. In Advances in Neural Information Processing Systems, pp. 604-612.
######## toy example data(vfit) test_dat <- vfit[1:10, c("sex", "ani.pro", "veg.pro", "B6", "B12", "B9", "SPPB.total", "HandGrip" )] out_test <- nutriNetwork(test_dat, method = "gibbs") sel_test <- selectnet(out_test) ######## out <- nutriNetwork(vfit, method = "gibbs") sel <- selectnet(out) cl <- c(rep("gray70", 7), rep("green3",17), rep("red3",5)) plot(sel, vis= "parcor.network", sign.edg = TRUE, vertex.color = cl, curve = TRUE, layout.tree= TRUE, root.node= c(26, 29), pos.legend= "bottomleft", cex.legend=1) #diffeent visualization plot(sel, vis= "parcor.network", sign.edg = TRUE, layout = NULL, vertex.color = cl, curve = TRUE, pos.legend= "topleft", cex.legend=1 )
######## toy example data(vfit) test_dat <- vfit[1:10, c("sex", "ani.pro", "veg.pro", "B6", "B12", "B9", "SPPB.total", "HandGrip" )] out_test <- nutriNetwork(test_dat, method = "gibbs") sel_test <- selectnet(out_test) ######## out <- nutriNetwork(vfit, method = "gibbs") sel <- selectnet(out) cl <- c(rep("gray70", 7), rep("green3",17), rep("red3",5)) plot(sel, vis= "parcor.network", sign.edg = TRUE, vertex.color = cl, curve = TRUE, layout.tree= TRUE, root.node= c(26, 29), pos.legend= "bottomleft", cex.legend=1) #diffeent visualization plot(sel, vis= "parcor.network", sign.edg = TRUE, layout = NULL, vertex.color = cl, curve = TRUE, pos.legend= "topleft", cex.legend=1 )
A dietary study that includs dietary intake, physical performance, and muscle strength-related variables for 207 Dutch elderly people.
data(vfit)
data(vfit)
The format is a matrix containing 29 variables for 207 participants.
Participants of the V-Fit trial were recruited via personal letters sent to senior residencies, home care organisations, general practitioners and local advertisements. Eligible participants were aged 70 y and older, used care services, did not regularly exercise, had a BMI of less than 25.
Paw, M. J. C. A., de Jong, N., Schouten, E. G., Hiddink, G. J., & Kok, F. J. (2001). Physical exercise and/or enriched foods for functional improvement in frail, independently living elderly: a randomized controlled trial. Archives of physical medicine and rehabilitation, 82(6), 811-817.
data(vfit) head(vfit, n=3)
data(vfit) head(vfit, n=3)