% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/compute_edge_pvalues.R
\name{compute_edge_pvalues}
\alias{compute_edge_pvalues}
\title{Compute P-Values for Edge Differences Between Populations}
\usage{
compute_edge_pvalues(edge_counts, N, method = "fisher", adjust_method = "none")
}
\arguments{
\item{edge_counts}{An array of edge counts from \code{compute_edge_frequencies}.}

\item{N}{A vector of sample sizes for each population.}

\item{method}{The statistical test method to use: "fisher", "chi.squared", or "prop". Default is "fisher".}

\item{adjust_method}{The method for p-value adjustment for multiple testing. Default is "none".}
}
\value{
A matrix of p-values for each edge.
}
\description{
This function computes p-values for the differences in edge presence between populations
using statistical tests (e.g., Fisher's exact test, chi-squared test).
}
\examples{
# Generate synthetic populations
control_graphs <- generate_category_graphs(
  n_graphs = 5,
  n_nodes = 10,
  n_communities = 2,
  base_intra_prob = 0.8,
  base_inter_prob = 0.2,
  intra_prob_variation = 0.05,
  inter_prob_variation = 0.05,
  seed = 1
)
patient_graphs <- generate_category_graphs(
  n_graphs = 5,
  n_nodes = 10,
  n_communities = 2,
  base_intra_prob = 0.6,
  base_inter_prob = 0.4,
  intra_prob_variation = 0.05,
  inter_prob_variation = 0.05,
  seed = 2
)
populations <- list(Control = control_graphs, Patient = patient_graphs)

# Compute edge frequencies
frequencies <- compute_edge_frequencies(populations)
edge_counts <- frequencies$edge_counts
N <- sapply(populations, length)

# Compute p-values for edge differences
edge_pvalues <- compute_edge_pvalues(edge_counts, N)
# View p-values for the first few edges
print(edge_pvalues[1:5, 1:5])
}
