Type: | Package |
Title: | Structure Learning with Copula Graphical Model |
Version: | 0.1.2 |
Author: | Pariya Behrouzi <https://orcid.org/0000-0001-6762-5433> |
Maintainer: | Pariya Behrouzi <pariya.behrouzi@gmail.com> |
Depends: | R (≥ 3.1.0) |
Imports: | Matrix, igraph, parallel, methods, glasso, huge, tmvtnorm |
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>. |
License: | GPL-3 |
Date: | 2023-07-05 |
NeedsCompilation: | no |
Packaged: | 2023-07-05 15:31:15 UTC; behro001 |
Repository: | CRAN |
Date/Publication: | 2023-07-05 15:50:02 UTC |
Undirected Network for nutrition multivariate data
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>.
Author(s)
Pariya Behrouzi
Maintainers: Pariya Behrouzi pariya.behrouzi@gmail.com
References
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.
Reconstructs conditional (in)dependence networks among variables
Description
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.
Usage
nutriNetwork(data, method = "gibbs", rho = NULL, n.rho = NULL, rho.ratio = NULL,
ncores = 1, em.iter = 5, em.tol=.001, verbose = TRUE)
Arguments
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 |
Details
This function estimates a graph path . To select an optimal graph please refer to selectnet
.
Value
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 |
Author(s)
Pariya Behrouzi
Maintainers: Pariya Behrouzi pariya.behrouzi@gmail.com
See Also
Examples
######## 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 )
nutriNetwork-internal
Description
Internal nutriNetwork functions. These are not intended to be called by the users.
Author(s)
Pariya Behrouzi <pariya.behrouzi@gmail.com>
plot for S3 class "nutriNetwork"
Description
Plot the graph path which is the output of the nutriNetwork
.
Usage
## S3 method for class 'nutriNetwork'
plot( x, n.memberships=NULL , ... )
Arguments
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) |
Author(s)
Pariya Behrouzi
Maintainer: Pariya Behrouzi pariya.behrouzi@gmail.com
References
Behrouzi, P., and Wit, E. C. (2017c). netgwas: An R Package for Network-Based Genome-Wide Association Studies. arXiv preprint, arXiv:1710.01236.
Examples
data(vfit)
out <- nutriNetwork(vfit, method = "gibbs")
plot(out)
Plot function for S3 class "select"
Description
Plot the optimal graph by model selection
Usage
## 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)
Arguments
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. |
Value
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 |
Author(s)
Pariya Behrouzi
Maintainer: Pariya Behrouzi pariya.behrouzi@gmail.com
References
Behrouzi, P., and Wit, E. C. (2017c). netgwas: An R Package for Network-Based Genome-Wide Association Studies. arXiv preprint, arXiv:1710.01236.
See Also
select
Examples
data(vfit)
out <- nutriNetwork(vfit)
sel <- selectnet(out)
plot(sel, vis= "image.parcorMatrix")
Print function for S3 class "nutriNetwork"
Description
Print a summary of results from function nutriNetwork
.
Usage
## S3 method for class 'nutriNetwork'
print(x, ...)
Arguments
x |
An object with S3 class "nutriNetwork" |
... |
System reserved (No specific usage) |
Author(s)
Pariya Behrouzi and Ernst C. Wit
Maintainer: Pariya Behrouzi pariya.behrouzi@gmail.com
See Also
Examples
data(vfit)
out <- nutriNetwork(vfit, method ="npn"); out
Print function for S3 class "select"
Description
Print function for selectnet
.
Usage
## S3 method for class 'select'
print(x, ...)
Arguments
x |
An object with S3 class "select" |
... |
System reserved (No specific usage) |
Author(s)
Pariya Behrouzi
Maintainer: Pariya Behrouzi pariya.behrouzi@gmail.com
References
Behrouzi, P., and Wit, E. C. (2017c). netgwas: An R Package for Network-Based Genome-Wide Association Studies. arXiv preprint, arXiv:1710.01236.
See Also
Examples
data(vfit)
out <- nutriNetwork(vfit, method ="npn")
sel <- selectnet(out)
#A pxp adjacency matrix
sel$opt.adj
Model selection for optimal graph estimation
Description
Estimate the optimal graph based on different information criteria .
Usage
selectnet(nutriNetwork.obj, opt.index= NULL, criteria= NULL, ebic.gamma=0.5,
ncores= NULL, verbose= TRUE)
Arguments
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 |
Value
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
.
Author(s)
Pariya Behrouzi
Maintainer: Pariya Behrouzi pariya.behrouzi@gmail.com
References
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.
Examples
######## 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 )
Baseline data from VFIT study
Description
A dietary study that includs dietary intake, physical performance, and muscle strength-related variables for 207 Dutch elderly people.
Usage
data(vfit)
Format
The format is a matrix containing 29 variables for 207 participants.
Details
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.
Source
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.
Examples
data(vfit)
head(vfit, n=3)