| Title: | Circular Graphical Model Estimation |
|---|---|
| Description: | Provides methods for estimating circular graphical models using maximum likelihood estimation (MLE) and circular mean squared error (CMSE) approaches. The package includes tools for model fitting, network construction, network evaluation, and visualization. The CMSE-based methodology is related to Dar (2023) <https://open.metu.edu.tr/handle/11511/102577>. The package supports both simulated circular data and real-world applications, including gene-expression network analysis. |
| Authors: | Fatemeh Sarasir [aut, cre] (ORCID: <https://orcid.org/0009-0003-5432-1352>), Vilda Purutcuoglu [aut] (ORCID: <https://orcid.org/0000-0002-3913-9005>), Elif Dogan Dar [aut] (ORCID: <https://orcid.org/0000-0001-7969-3767>) |
| Maintainer: | Fatemeh Sarasir <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-07-15 09:48:02 UTC |
| Source: | https://github.com/cran/circularNet |
Constructs a binary network from estimated coefficients using thresholding.
build_network(beta_hat, threshold = 0.5)build_network(beta_hat, threshold = 0.5)
beta_hat |
Coefficient matrix. |
threshold |
Threshold value. |
Binary adjacency matrix.
set.seed(1) data <- matrix( runif(100, -pi, pi), ncol = 5 ) fit <- fit_circular_model(data) build_network( fit, threshold = 0.2 )set.seed(1) data <- matrix( runif(100, -pi, pi), ncol = 5 ) fit <- fit_circular_model(data) build_network( fit, threshold = 0.2 )
Computes the circular mean squared error.
CMSE(par, data)CMSE(par, data)
par |
Parameter vector. |
data |
Data matrix (p x n). |
Numeric CMSE value.
data <- matrix( runif(20, -pi, pi), nrow = 4 ) par <- rep(0, nrow(data)) CMSE(par, data)data <- matrix( runif(20, -pi, pi), nrow = 4 ) par <- rep(0, nrow(data)) CMSE(par, data)
Computes performance metrics comparing an estimated network with a reference network.
evaluate_network(est, truth)evaluate_network(est, truth)
est |
Estimated adjacency matrix. |
truth |
Ground-truth adjacency matrix. |
List of evaluation metrics.
est <- matrix( c(0,1,0, 1,0,1, 0,1,0), nrow = 3, byrow = TRUE ) truth <- matrix( c(0,1,0, 1,0,0, 0,0,0), nrow = 3, byrow = TRUE ) evaluate_network(est, truth)est <- matrix( c(0,1,0, 1,0,1, 0,1,0), nrow = 3, byrow = TRUE ) truth <- matrix( c(0,1,0, 1,0,0, 0,0,0), nrow = 3, byrow = TRUE ) evaluate_network(est, truth)
Estimates a circular graphical model using node-wise regression and likelihood-based optimization.
fit_circular_model(data)fit_circular_model(data)
data |
Matrix of circular observations (rows = observations, columns = variables). |
A coefficient matrix.
set.seed(1) data <- matrix( runif(100, -pi, pi), ncol = 5 ) fit <- fit_circular_model(data) round(fit, 2)set.seed(1) data <- matrix( runif(100, -pi, pi), ncol = 5 ) fit <- fit_circular_model(data) round(fit, 2)
Computes the negative log-likelihood used for parameter estimation in the likelihood-based circular graphical model.
log_likelihood(params, theta, phi, mu_theta, mu_phi)log_likelihood(params, theta, phi, mu_theta, mu_phi)
params |
Parameter vector containing alpha, beta coefficients, and kappa. |
theta |
Response variable. |
phi |
Predictor matrix. |
mu_theta |
Mean of theta. |
mu_phi |
Mean of phi. |
Negative log-likelihood value.
theta <- runif(20, -pi, pi) phi <- matrix(runif(40, -pi, pi), ncol = 2) params <- c(0.1, 0.1, 0.1, 1) log_likelihood( params, theta, phi, mean(theta), colMeans(phi) )theta <- runif(20, -pi, pi) phi <- matrix(runif(40, -pi, pi), ncol = 2) params <- c(0.1, 0.1, 0.1, 1) log_likelihood( params, theta, phi, mean(theta), colMeans(phi) )
Transforms numeric values to the interval (-pi, pi).
mod_twopi(x)mod_twopi(x)
x |
Numeric vector of angles. |
Numeric vector of wrapped angles.
mod_twopi(c(-4 * pi, -3, 0, 3, 4 * pi))mod_twopi(c(-4 * pi, -3, 0, 3, 4 * pi))
Fits a circular regression model using CMSE optimization.
model_fit_cmse(data)model_fit_cmse(data)
data |
Data matrix (p x n), where rows correspond to variables and columns correspond to samples. |
A list containing:
beta: coefficient matrix
code: optimization convergence codes
set.seed(1) data <- matrix( runif(40, -pi, pi), nrow = 4 ) model_fit_cmse(data)set.seed(1) data <- matrix( runif(40, -pi, pi), nrow = 4 ) model_fit_cmse(data)
Visualizes an adjacency matrix as a network graph.
plot_network(adj_matrix)plot_network(adj_matrix)
adj_matrix |
Adjacency matrix. |
A network plot.
adj <- matrix( c(0,1,1, 1,0,0, 1,0,0), nrow = 3, byrow = TRUE ) plot_network(adj)adj <- matrix( c(0,1,1, 1,0,0, 1,0,0), nrow = 3, byrow = TRUE ) plot_network(adj)
Computes predicted and observed circular values.
residual_fnc(par, data)residual_fnc(par, data)
par |
Parameter vector. |
data |
Data matrix (p x n). |
List with predicted and observed values.
data <- matrix( runif(20, -pi, pi), nrow = 4 ) par <- rep(0, nrow(data)) residual_fnc(par, data)data <- matrix( runif(20, -pi, pi), nrow = 4 ) par <- rep(0, nrow(data)) residual_fnc(par, data)