nc_estimate_links {NetCoupler} | R Documentation |
Compute model estimates between an external (exposure or outcome) variable and a network.
Description
This is the main function that identifies potential links between external factors and the network. There are two functions to estimate and classify links:
-
nc_estimate_exposure_links()
: Computes the model estimates for the exposure side. -
nc_estimate_outcome_links()
: Computes the model estimates for the exposure side.
Usage
nc_estimate_exposure_links(
data,
edge_tbl,
exposure,
adjustment_vars = NA,
model_function,
model_arg_list = NULL,
exponentiate = FALSE,
classify_option_list = classify_options()
)
nc_estimate_outcome_links(
data,
edge_tbl,
outcome,
adjustment_vars = NA,
model_function,
model_arg_list = NULL,
exponentiate = FALSE,
classify_option_list = classify_options()
)
Arguments
data |
The data.frame or tibble that contains the variables of interest, including the variables used to make the network. |
edge_tbl |
Output graph object from |
exposure , outcome |
Character. The exposure or outcome variable of interest. |
adjustment_vars |
Optional. Variables to adjust for in the models. |
model_function |
A function for the model to use (e.g. |
model_arg_list |
Optional. A list containing the named arguments that
will be passed to the model function. A simple example would be
|
exponentiate |
Logical. Whether to exponentiate the log estimates, as computed with e.g. logistic regression models. |
classify_option_list |
A list with classification options for direct, ambigious, or no
effects. Used with the
|
Value
Outputs a tibble that contains the model estimates from either the exposure or outcome side of the network as well as the effect classification. Each row represents the "no neighbour node adjusted" model and has the results for the outcome/exposure to index node pathway. Columns for the outcome are:
-
outcome
orexposure
: The name of the variable used as the external variable. -
index_node
: The name of the metabolite used as the index node from the network. In combination with the outcome/exposure variable, they represent the individual model used for the classification. -
estimate
: The estimate from the outcome/exposure and index node model. -
std_error
: The standard error from the outcome/exposure and index node model. -
fdr_p_value
: The False Discovery Rate-adjusted p-value from the outcome/exposure and index node model. -
effect
: The NetCoupler classified effect between the index node and the outcome/exposure. Effects are classified as "direct" (there is a probable link based on the given thresholds), "ambigious" (there is a potential link but not all thresholds were passed), and "none" (no potential link seen).
The tibble output also has an attribute that contains all the models
generated before classification. Access it with attr(output, "all_models_df")
.
See Also
vignette("examples")
article has more
details on how to use NetCoupler with different models.
Examples
standardized_data <- simulated_data %>%
nc_standardize(starts_with("metabolite"))
metabolite_network <- simulated_data %>%
nc_standardize(starts_with("metabolite"),
regressed_on = "age") %>%
nc_estimate_network(starts_with("metabolite"))
edge_table <- as_edge_tbl(metabolite_network)
results <- standardized_data %>%
nc_estimate_exposure_links(
edge_tbl = edge_table,
exposure = "exposure",
model_function = lm
)
results
# Get results of all models used prior to classification