Package 'NetCoupler'

Title: Inference of Causal Links Between a Network and an External Variable
Description: The 'NetCoupler' algorithm identifies potential direct effects of correlated, high-dimensional variables formed as a network with an external variable. The external variable may act as the dependent/response variable or as an independent/predictor variable to the network.
Authors: Luke Johnston [aut, cre, cph] , Clemens Wittenbecher [aut, cph] , Fabian Eichelmann [ctb], Helena Zacharias [ctb], Daniel Ibsen [ctb]
Maintainer: Luke Johnston <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0.9000
Built: 2024-10-31 19:48:03 UTC
Source: https://github.com/netcoupler/netcoupler

Help Index


Convert network graphs to edge tables as tibbles/data.frames.

Description

[Experimental]

Usage

as_edge_tbl(network_object)

Arguments

network_object

Network graph from nc_estimate_network().

Value

A tibble, with at least two columns:

  • source_node: The starting node (variable).

  • target_node: The ending node (variable) that links with the source node.

  • adjacency_weight: (Optional) The "weight" given to the edge, which represents the strength of the link between two nodes.

See Also

See nc_estimate_links for examples on using NetCoupler.


Classification options for direct, ambigious, and no effect.

Description

Classification options for direct, ambigious, and no effect.

Usage

classify_options(
  single_metabolite_threshold = 0.05,
  network_threshold = 0.1,
  direct_effect_adjustment = NA
)

Arguments

single_metabolite_threshold, network_threshold, direct_effect_adjustment

See the classify_option_list argument in nc_estimate_links for details.

Value

List with options for the classification.


Create an estimate of the metabolic network as an undirected graph.

Description

[Experimental]

The main NetCoupler network creator. Uses the input data to estimate the underlying undirected graph. The default uses the PC algorithm, implemented within NetCoupler with pc_estimate_undirected_graph() Defaults to using the PC algorithm to calculate possible edges. Any missing values in the input data are removed by this function, since some computations can't handle missingness.

Usage

nc_estimate_network(data, cols = everything(), alpha = 0.01)

Arguments

data

Data that would form the underlying network.

cols

<tidy-select> Variables to include by using dplyr::select() style selection.

alpha

The alpha level to use to test whether an edge exists or not. Default is 0.01.

Value

Outputs a tidygraph::tbl_graph() with the start and end nodes, as well as the edge weights.

See Also

See nc_estimate_links for examples on using NetCoupler and pc_estimate_undirected_graph for more details on the PC-algorithm network estimation method.


Standardize the metabolic variables.

Description

[Experimental]

Can standardize by either 1) log()-transforming and then applying scale() (mean-center and scaled by standard deviation), or 2) if regressed_on variables are given, then log-transforming, running a linear regression to obtain the stats::residuals(), and finally scaled. Use regressed_on to try to remove influence of potential confounding.

Usage

nc_standardize(data, cols = everything(), regressed_on = NULL)

Arguments

data

Data frame.

cols

Metabolic variables that will make up the network.

regressed_on

Optional. A character vector of variables to regress the metabolic variables on. Use if you want to standardize the metabolic variables on variables that are known to influence them, e.g. sex or age. Calculates the residuals from a linear regression model.

Value

Outputs a tibble object, with the original metabolic variables now standardized.

See Also

nc_estimate_links for more detailed examples or the vignette("NetCoupler").

Examples

# Don't regress on any variable
simulated_data %>%
  nc_standardize(starts_with("metabolite_"))

# Extract residuals by regressing on a variable
simulated_data %>%
  nc_standardize(starts_with("metabolite_"), "age")

# Works with factors too
simulated_data %>%
  dplyr::mutate(Sex = as.factor(sample(rep(c("F", "M"), times = nrow(.) / 2)))) %>%
  nc_standardize(starts_with("metabolite_"), c("age", "Sex"))

Simulated dataset with an underlying Directed Graph structure for the metabolites.

Description

Simulated dataset with an underlying Directed Graph structure for the metabolites.

Usage

simulated_data

Format

The simulated dataset is a tibble with the following variables:

  • Two outcome variables (outcome_continuous and outcome_binary) along with survival time (outcome_event_time) that is used for the outcome_binary variable

  • A generic exposure variable as continuous

  • 12 ⁠metabolite_*⁠ variables

  • An age variable used as a confounder