### Get Quantiles from Probabilities using metalog.q() Source: https://github.com/kimsergeo/metalog/blob/master/README.rst This snippet demonstrates how to use the `metalog.q()` function to calculate quantiles (x-values) given a metalog model (`m`), a list of probabilities (`y`), and the number of terms (`term`). This is the inverse operation of `metalog.p()`. For the input `y=[0.00275336, 0.82349578, 0.98686581]`, the function returns an array of quantiles such as `[50.02583336, 109.99861143, 149.99737059]`. ```Python metalog.q(m=metalog_salmon, y=[0.00275336, 0.82349578, 0.98686581], term=10) ``` -------------------------------- ### Draw Samples from Metalog Distribution in Python Source: https://github.com/kimsergeo/metalog/blob/master/README.rst This code demonstrates how to generate random samples from a fitted metalog distribution using `metalog.r()`. It allows specifying the number of samples (`n`) and the number of terms (`term`) to use for the sampling process, useful for simulations or further analysis. ```Python metalog.r(m=metalog_salmon, n=5, term=10) ``` -------------------------------- ### Summarize Fitted Metalog Distribution in Python Source: https://github.com/kimsergeo/metalog/blob/master/README.rst This snippet shows how to obtain a summary of a previously fitted metalog distribution object using `metalog.summary()`. The output provides details such as term limits, boundedness, bounds, step length, fit method, number of data points, and validation status for each term. ```Python metalog.summary(m=metalog_salmon) ``` -------------------------------- ### Fit Data to Bounded Metalog Distribution in Python Source: https://github.com/kimsergeo/metalog/blob/master/README.rst This code demonstrates how to use `metalog.fit()` to fit the prepared salmon data to a metalog distribution. It specifies a 'bounded' distribution type with bounds from 0 to 200 and sets a term limit of 10 for the fitting process. ```Python metalog_salmon = metalog.fit(x=salmon, boundedness='b', bounds=[0, 200], term_limit=10) ``` -------------------------------- ### Import Metalog Distribution Package in Python Source: https://github.com/kimsergeo/metalog/blob/master/README.rst This simple snippet shows the standard way to import the 'metalog' package into a Python script, making its functions available for use in statistical analysis. ```Python from metalog import metalog ``` -------------------------------- ### Prepare Salmon Length Data for Metalog Analysis in Python Source: https://github.com/kimsergeo/metalog/blob/master/README.rst This snippet demonstrates how to import necessary libraries (numpy, pandas) and load/filter salmon body length data from a CSV file. The data is then converted to a NumPy array, preparing it for use with the metalog distribution fitting functions. ```Python import numpy as np import pandas as pd salmon = pd.read_csv("Chinook and forage fish lengths.csv") # Filtered data for eelgrass vegetation and chinook salmon salmon = salmon[(salmon['Vegetation'] == 'Eelgrass') & (salmon['Species'] == 'Chinook_salmon')] salmon = np.array(salmon['Length']) ``` -------------------------------- ### APIDOC: metalog.fit() Function Parameters Source: https://github.com/kimsergeo/metalog/blob/master/README.rst This section details the parameters for the `metalog.fit()` function, used to fit data to a metalog distribution. It describes inputs such as the data array, boundedness type and values, term limits, step length, probabilities, fit method, and data saving options. ```APIDOC metalog.fit(x, bounds, boundedness, term_limit, term_lower_bound, step_len, probs, fit_method, save_data) x: data. bounds: bounds of metalog distribution. Depending on 'boundedness' argument can take zero, one or two values. boundedness: boundedness of metalog distribution. Can take values 'u' for unbounded, 'sl' for semi-bounded lower, 'su' for semi-bounded upper and 'b' for bounded on both sides. term_limit: maximum number of terms to specify the metalog distribution. Can take values from 3 to 30. term_lower_bound: the lowest number of terms to specify the metalog distribution. Must be greater or equal to 2 and less than 'term_limit'. The argument is optional. Default value is 2. step_len: size of steps to summarize the distribution. The argument is optional. Default value is 0.01. probs: probabilities corresponding to data. The argument is optional. Default value is numpy.nan. fit_method: fit method 'OLS', 'LP' or 'any'. The argument is optional. Default value is 'any'. save_data: if True then data will be saved for future update. The argument is optional. Default values is False. ``` -------------------------------- ### Plot PDF and CDF of Metalog Distribution in Python Source: https://github.com/kimsergeo/metalog/blob/master/README.rst This snippet illustrates how to visualize the Probability Density Function (PDF) and Cumulative Distribution Function (CDF) of a fitted metalog distribution. The `metalog.plot()` function generates a graphical representation, aiding in the understanding of the distribution's shape. ```Python metalog.plot(m=metalog_salmon) ``` -------------------------------- ### Calculate Densities from Quantiles of Metalog Distribution in Python Source: https://github.com/kimsergeo/metalog/blob/master/README.rst This snippet shows how to compute the probability densities for specified quantiles of a fitted metalog distribution using `metalog.d()`. It takes a vector of quantiles (`q`) and the number of terms (`term`) to return the corresponding density values. ```Python metalog.d(m=metalog_salmon, q=[50, 110, 150], term=10) ``` -------------------------------- ### Calculate Probabilities from Quantiles using metalog.p() Source: https://github.com/kimsergeo/metalog/blob/master/README.rst This snippet demonstrates how to use the `metalog.p()` function to calculate probabilities (y-values) given a metalog model (`m`), a list of quantiles (`q`), and the number of terms (`term`). For the input `q=[50, 110, 150]`, the function returns an array of probabilities such as `[0.00275336, 0.82349578, 0.98686581]`. ```Python metalog.p(m=metalog_salmon, q=[50, 110, 150], term=10) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.