| Title: | Build Networks from EHRs and Omics Data Using Linear Mixed Models |
|---|---|
| Description: | Analyzing longitudinal clinical data from Electronic Health Records (EHRs) using linear mixed models (LMM) and visualizing the results as networks. It includes functions for fitting LMM, normalizing adjacency matrices, and comparing networks. It also allows the integration of omics data (e.g. gene expression or protein abundance) with longitudinal clinical variables, building networks of molecular feature-clinical relationships. The package is designed for researchers in clinical and biomedical fields who need to model longitudinal data and explore relationships between variables. For more details see Bates et al. (2015) <doi:10.18637/jss.v067.i01>. |
| Authors: | Vargas-Fernández Marina [aut, cre], Martorell-Marugán Jordi [aut], Carmona-Sáez Pedro [aut] |
| Maintainer: | Vargas-Fernández Marina <[email protected]> |
| License: | GPL-3 |
| Version: | 2.0.0 |
| Built: | 2026-11-20 13:07:25 UTC |
| Source: | https://github.com/cran/MariNET |
This function returns difference matrix between two networks. It is useful for comparing two networks represented by adjacency matrices.
differentiation(matrix1, matrix2)differentiation(matrix1, matrix2)
matrix1 |
The first adjacency matrix. |
matrix2 |
The second adjacency matrix. |
a normalized matrix containing values between 0 and 1.
This dataset contains self-reported psychological and behavioral responses from individuals.
example_dataexample_data
A data frame with multiple rows and 17 variables:
Unique participant identifier (integer).
Self-reported relaxation level (integer scale).
Self-reported irritability level (integer scale).
Level of worry experienced (integer scale).
Self-reported nervousness (integer scale).
Concerns about the future (integer scale).
Self-reported lack of enjoyment (integer scale).
Level of tiredness (integer scale).
Self-reported hunger level (integer scale).
Feeling of loneliness (integer scale).
Level of anger experienced (integer scale).
Offline social interactions (integer scale).
Online social interactions (integer scale).
Time spent listening to music (integer scale).
Self-reported procrastination (integer scale).
Time spent outdoors (integer scale).
Engagement in activities during COVID-19 (integer scale).
Level of worry related to COVID-19 (integer scale).
Time spent at home (integer scale).
Day number of the study (integer).
Moment within the day when data was collected (integer).
Self-reported concentration level (integer scale).
This dataset was collected from a study examining psychological and behavioral responses to various daily experiences. Each row represents a unique moment of self-reporting.
Reproducible figure for Nature Methods primer paper, Borsboom et al. 2021. This examples contains a subset of variables collected and modeled in our covid19 paper. This paper, with full data is available on https://journals.sagepub.com/doi/10.1177/21677026211017839. Eiko Fried, March 14 2021
data(example_data) head(example_data)data(example_data) head(example_data)
This dataset contains fully simulated longitudinal clinical measurements and molecular
features (e.g. gene expression) for 80 participants with up to 4 visits.
It is intended to illustrate the integration of molecular features with
clinical variables using lmm_integration_analysis().
example_omicsexample_omics
A data frame with 296 rows and 18 variables:
Unique participant identifier (character).
Month of the visit since baseline (0, 12, 24 or 36).
Sex of the participant (Female or Male).
Age of the participant at baseline (years).
Systolic blood pressure (mmHg).
Diastolic blood pressure (mmHg).
Resting heart rate (beats per minute).
Body mass index (kg/m2).
Fasting blood glucose (mg/dL).
Total blood cholesterol (mg/dL).
Simulated molecular features (e.g. normalized gene expression).
Data are fully synthetic and do not correspond to any real participant or study. Some molecular features were simulated to be associated with clinical variables: GENE1 with Systolic_BP (positive), GENE2 with Cholesterol (negative), GENE3 with Glucose (positive) and GENE4 with Heart_rate (negative). GENE5 to GENE8 have no association with clinical variables. Around 10% of follow-up visits were removed to mimic missed visits.
Simulated data. The code used to generate the dataset is available in the
data-raw folder of the package source.
data(example_omics) head(example_omics)data(example_omics) head(example_omics)
This function automates the analysis of longitudinal clinical data using linear mixed models. It models clinical variables and returns a weighted matrix of model coefficient scores.
lmm_analysis( clinical_data, variables_to_scale, random_effects = "(1 | participant_id)" )lmm_analysis( clinical_data, variables_to_scale, random_effects = "(1 | participant_id)" )
clinical_data |
Dataframe containing clinical and metadata for participants, including identifier as |
variables_to_scale |
Character vector of variable names to be analyzed. |
random_effects |
A character string specifying the random effects formula (default: "(1 | participant_id)"). |
A matrix of model coefficient scores, where rows represent dependent variables and columns represent independent variables.
This function builds a network between molecular features (e.g. genes or proteins) and clinical variables from longitudinal data using linear mixed models. Two sets of models are fitted: each clinical variable is modeled on all other clinical variables and the molecular features, and each molecular feature is modeled on the clinical variables. The weight of a feature-clinical edge is the mean of both t-values. Clinical-clinical and feature-feature edges are set to zero, so the network only contains feature-clinical edges.
lmm_integration_analysis( clinical_data, variables_to_scale, molecular_features, random_effects = "(1 | participant_id)" )lmm_integration_analysis( clinical_data, variables_to_scale, molecular_features, random_effects = "(1 | participant_id)" )
clinical_data |
Dataframe containing clinical data, metadata and molecular features (one column per feature, samples merged with clinical data), including identifier as 'participant_id'. |
variables_to_scale |
Character vector of clinical variable names to be analyzed. |
molecular_features |
Character vector of molecular feature names (columns of 'clinical_data'). Names that are not syntactically valid in R (e.g. "H1-0") are allowed. |
random_effects |
A character string specifying the random effects formula (default: "(1 | participant_id)"). |
A symmetric matrix of model coefficient scores with clinical variables followed by molecular features.
data(example_omics) clinical_vars <- c("Systolic_BP", "Diastolic_BP", "Heart_rate", "BMI", "Glucose", "Cholesterol") molecular_features <- paste0("GENE", 1:8) net <- lmm_integration_analysis(example_omics, clinical_vars, molecular_features, random_effects = "(1|participant_id)") round(net[clinical_vars, molecular_features], 2)data(example_omics) clinical_vars <- c("Systolic_BP", "Diastolic_BP", "Heart_rate", "BMI", "Glucose", "Cholesterol") molecular_features <- paste0("GENE", 1:8) net <- lmm_integration_analysis(example_omics, clinical_vars, molecular_features, random_effects = "(1|participant_id)") round(net[clinical_vars, molecular_features], 2)
This function normalizes weighted adjacency matrix derived from lmm.
normalization(matrix)normalization(matrix)
matrix |
The adjacency matrix (to be normalized). |
a normalized matrix containing values between 0 and 1.
This function adjusts an original matrix by copying the lower triangular part from a shifted matrix.
score_matrix(original_matrix, shifted_matrix)score_matrix(original_matrix, shifted_matrix)
original_matrix |
A numeric matrix representing the original data. |
shifted_matrix |
A numeric matrix that has been transformed using |
A new matrix with adjusted values in the lower triangular part.
This function modifies the shape of a model weights matrix by shifting its elements.
shift_matrix(mat)shift_matrix(mat)
mat |
A numeric matrix to be transformed. |
A shifted version of the input matrix.