% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_neutral_model.R
\name{plot_neutral_model}
\alias{plot_neutral_model}
\title{Plot a fitted Neutral Model to Microbial Community Data}
\usage{
plot_neutral_model(fit_result)
}
\arguments{
\item{fit_result}{A list-like object returned by \link[=fit_neutral_model]{fit_neutral_model()}.}
}
\value{
A \link[ggplot2:ggplot]{ggplot2} object.

A \link[ggplot2:ggplot]{ggplot} object with:
\itemize{
\item \emph{x}-axis: \code{log10(mean abundance)} (\code{log10(otu_rel)});
\item \emph{y}-axis: \code{Occupancy} (\code{otu_occ});
\item Points colored by membership/fit class as described above;
\item Neutral-model curve (solid) with 95\\% CI (grey, twodash);
\item An inset white label reporting \emph{R}\eqn{^2} and \emph{m} taken
directly from \code{fit_result$goodness_of_fit}.
}

The function does not recompute statistics; it only visualizes the supplied
predictions and metrics.
}
\description{
This function plots ASV/OTUs log abundances into a fitted neutral model of
microbial abundance-occupancy distribution. ASV/OTUs that are \emph{Core}, \emph{As
predicted} (i.e. Neutral), \emph{Below} and \emph{Above} model predictions are drawn
with distinct point colors, see details.
}
\details{
Points are split into four groups for display:
\itemize{
\item \strong{Not core (as predicted)} – background points;
\item \strong{Core (as predicted)} – core taxa whose occupancy matches the model;
\item \strong{Core (above prediction)} – core taxa above the 95\\% CI;
\item \strong{Core (below prediction)} – core taxa below the 95\\% CI.
}
}
\examples{
library(BRCore)
data("switchgrass_core", package = "BRCore")

switchgrass_core_fit <- fit_neutral_model(
  otu_table = switchgrass_core$otu_table,
  core_set = switchgrass_core$increase_core,
  abundance_occupancy = switchgrass_core$abundance_occupancy
)

p <- plot_neutral_model(switchgrass_core_fit)
print(p)

}
\seealso{
\code{\link{fit_neutral_model}}
}
