diff --git a/birdman/default_models.py b/birdman/default_models.py index 24000b4..b7452ec 100644 --- a/birdman/default_models.py +++ b/birdman/default_models.py @@ -127,17 +127,25 @@ class NegativeBinomialSingle(SingleFeatureModel): y_{ij} &\\sim \\textrm{NB}(\\mu_{ij},\\phi_j) - \\mu_{ij} &= n_i p_{ij} - - \\textrm{alr}(p_i) &= x_i \\beta + \\log(\\mu_{ij}) &= \\log(\\textrm{Depth}_i) + x_i \\beta Priors: .. math:: - \\beta_j &\\sim \\textrm{Normal}(0, B_p), B_p \\in \\mathbb{R}_{>0} + \\begin{cases} + \\beta_j \\sim \\textrm{Normal}(-5.5, B_p), & j = 0 - \\frac{1}{\\phi_j} &\\sim \\textrm{Cauchy}(0, C_s), C_s \\in + \\beta_j \\sim \\textrm{Normal}(0, B_p), & j > 0 + \\end{cases} + + .. math:: + + B_p \\in \\mathbb{R}_{>0} + + .. math:: + + \\frac{1}{\\phi_j} \\sim \\textrm{Cauchy}(0, C_s), C_s \\in \\mathbb{R}_{>0} diff --git a/birdman/model_base.py b/birdman/model_base.py index 44b7541..1f180bb 100644 --- a/birdman/model_base.py +++ b/birdman/model_base.py @@ -17,9 +17,6 @@ class BaseModel(ABC): :param table: Feature table (features x samples) :type table: biom.table.Table - :param metadata: Metadata for design matrix - :type metadata: pd.DataFrame - :param model_path: Filepath to Stan model :type model_path: str @@ -239,9 +236,6 @@ def to_inference_object(self) -> az.InferenceData: class SingleFeatureModel(BaseModel): """Fit a model for a single feature.""" def __init__(self, table: biom.Table, feature_id: str, **kwargs): - if feature_id is None: - raise ValueError("Must provide feature ID!") - super().__init__(table=table, **kwargs) self.feature_id = feature_id values = table.data( diff --git a/birdman/templates/negative_binomial_single.stan b/birdman/templates/negative_binomial_single.stan index f53ab27..7acec16 100644 --- a/birdman/templates/negative_binomial_single.stan +++ b/birdman/templates/negative_binomial_single.stan @@ -25,7 +25,8 @@ transformed parameters { model { // setting priors ... reciprocal_phi ~ cauchy(0., phi_s); - for (j in 1:p){ + beta[1] ~ normal(-5.5, B_p); + for (j in 2:p){ beta[j] ~ normal(0., B_p); // uninformed prior } // generating counts diff --git a/docs/conf.py b/docs/conf.py index f806850..0e6baf6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -28,7 +28,8 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc' + 'sphinx.ext.autodoc', + 'sphinx.ext.mathjax' ] # Add any paths that contain templates here, relative to this directory.