% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/negative_binomial_check.R
\name{goodness_of_fit_nb}
\alias{goodness_of_fit_nb}
\title{This function calculates goodness-of-fit pvalues for all genes by looking at
how the NB model by edgeR or DESeq2 fit the data}
\usage{
goodness_of_fit_nb(
  se,
  count_matrix,
  condition,
  other_variables = NULL,
  method = "edgeR",
  num_genes = 500,
  small_sample_cutoff = 21
)
}
\arguments{
\item{se}{the se object; se object where all the data is contained}

\item{count_matrix}{string; name of the assay with gene expression matrix
(in counts)}

\item{condition}{string; name of the se colData with the condition status}

\item{other_variables}{string; name of the se colData containing other
variables of interest that should be considered in the model}

\item{method}{string; method to use for the parametric or non-parametric
test;either "DESeq2" or "edgeR"; default is "edgeR"}

\item{num_genes}{down sample value, default is 500 (or all genes if less)}

\item{small_sample_cutoff}{value at which non-parametric test will be used
(considered "large sample size") vs parametric will be used (considered
"small sample size); default is 21}
}
\value{
a matrix of p-values where each row is a gene and each column is a
level within the condition of interest
}
\description{
This function calculates goodness-of-fit pvalues for all genes by looking at
how the NB model by edgeR or DESeq2 fit the data
}
\examples{
# example code for small sample
library(scran)
se <- mockSCE(ncells = 20)
se$Treatment <- as.factor(se$Treatment)
se$Mutation_Status <- as.factor(se$Mutation_Status)
nb_results <- goodness_of_fit_nb(se = se, count_matrix = "counts",
  condition = "Treatment", other_variables = "Mutation_Status",
  method = "edgeR")
nb_results[1]
nb_results[2]
nb_results[3]

# example code for large sample
library(scran)
se <- mockSCE(ncells = 150)
se$Treatment <- as.factor(se$Treatment)
se$Mutation_Status <- as.factor(se$Mutation_Status)
nb_results <- goodness_of_fit_nb(se = se, count_matrix = "counts",
  condition = "Treatment", other_variables = "Mutation_Status",
  method = "edgeR")
nb_results[1]
nb_results[2]
nb_results[3]
}
