gneiss.regression.OLSModel

class gneiss.regression.OLSModel(*args, **kwargs)[source]

Summary object for storing ordinary least squares results.

A OLSModel object stores information about the individual balances used in the regression, the coefficients, residuals. This object can be used to perform predictions. In addition, summary statistics such as the coefficient of determination for the overall fit can be calculated.

Variables:
  • submodels (list of statsmodels objects) – List of statsmodels result objects.
  • basis (pd.DataFrame) – Orthonormal basis in the Aitchison simplex. Row names correspond to the leaves of the tree and the column names correspond to the internal nodes in the tree. If this is not specified, then project cannot be enabled in coefficients or predict.
  • tree (skbio.TreeNode) – Bifurcating tree that defines basis.
  • balances (pd.DataFrame) – A table of balances where samples are rows and balances are columns. These balances were calculated using tree.
__init__(*args, **kwargs)[source]

Methods

__init__(\*args, \*\*kwargs)
coefficients([project]) Returns coefficients from fit.
fit([regularized]) Fit the model.
loo(\*\*kwargs) Leave one out cross-validation.
lovo(\*\*kwargs) Leave one variable out cross-validation.
percent_explained() Proportion explained by each principal balance.
predict([X, project]) Performs a prediction based on model.
read_pickle(filename) Reads Model object from pickle file.
residuals([project]) Returns calculated residuals from fit.
split_balance(balance_name) Splits a balance into its log ratio components.
summary([ndim]) Summarize the Ordinary Least Squares Regression Results.
write_pickle(filename) Writes Model object to pickle file.

Attributes

mse Mean Sum of squares Error
pvalues Return pvalues from each of the coefficients in the fit.
r2 Coefficient of determination for overall fit