### Load rmetalog Package and Example Fish Size Data Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This snippet loads the `rmetalog` package and then loads the `fishSize` example dataset, which is included with the package. It also provides a summary of the `fishSize` data, illustrating its bi-modal nature. ```R library(rmetalog) data("fishSize") summary(fishSize) #> FishSize #> Min. : 3.0 #> 1st Qu.: 7.0 #> Median :10.0 #> Mean :10.2 #> 3rd Qu.:12.0 #> Max. :33.0 ``` -------------------------------- ### Install rmetalog Development Version from GitHub Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This snippet shows how to install the development version of the `rmetalog` package directly from its GitHub repository. It requires the `devtools` package to be loaded first. ```R library(devtools) install_github('isaacfab/rmetalog') ``` -------------------------------- ### Install rmetalog Package from CRAN Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This snippet demonstrates how to install the `rmetalog` package directly from CRAN, the official R package archive. This is the standard method for stable releases. ```R install.packages('rmetalog') ``` -------------------------------- ### Load and Summarize Fish Size Data in R Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html This snippet demonstrates how to load the `rmetalog` package and an included example dataset, `fishSize`. It then uses `summary()` to display basic descriptive statistics of the fish weight data, illustrating its bi-modal nature. ```R library(rmetalog) data("fishSize") summary(fishSize) ``` -------------------------------- ### Build a Bounded Metalog Distribution with metalog() Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This example demonstrates how to create a lower and upper bounded metalog distribution using the `metalog()` function. It specifies a term limit, lower bound for terms, explicit bounds for the distribution, and a 'bounded' type. ```R my_metalog <- metalog( fishSize$FishSize, term_limit = 9, term_lower_bound = 2, bounds = c(0, 60), boundedness = 'b', step_len = 0.01 ) ``` -------------------------------- ### Fit a Lower Bounded Metalog Distribution in R Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html This example shows how to fit a lower-bounded metalog distribution to the `fishSize` data using the `metalog()` function. It specifies a term limit, a lower bound, and the semi-lower boundedness type, along with a step length for summarization. ```R my_metalog <- metalog(fishSize$FishSize, term_limit = 9, bounds=0, boundedness = 'sl', step_len = .01) ``` -------------------------------- ### Calculate Density from RMetalog Quantiles Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html This R code snippet computes the probability density function (PDF) values for specified quantiles using the `dmetalog` function. It takes the metalog object, a vector of quantiles (q), and the number of terms. The example output shows the density values at each given quantile. ```R dmetalog(my_metalog, q = c(3,10,25), term = 9) ``` -------------------------------- ### Calculate Probabilities from RMetalog Quantiles Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html This R code snippet calculates the cumulative probabilities for given quantile values using the `pmetalog` function. It requires the metalog object, a vector of quantiles (q), and the number of terms. The example output provides the probability values associated with each input quantile. ```R pmetalog(my_metalog, q = c(3,10,25), term = 9) ``` -------------------------------- ### Retrieve Quantile Values from RMetalog Distribution Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html This R code snippet demonstrates how to retrieve quantile values from a fitted metalog distribution using the `qmetalog` function. It takes the metalog object, a vector of probabilities (y), and the number of terms to use for the distribution. The example output shows the calculated quantile values corresponding to the input probabilities. ```R qmetalog(my_metalog, y = c(0.25, 0.5, 0.75), term = 9) ``` -------------------------------- ### OpenAIModel Class Initialization Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html Documents the `OpenAIModel` class constructor, detailing its parameters and their purpose for initializing an OpenAI model. ```APIDOC OpenAIModel: __init__(model_name: str, provider: str = 'openai') model_name: The name of the OpenAI model to use provider: The provider to use (defaults to 'openai') ``` -------------------------------- ### OpenAIModel Constructor API Documentation Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html Documents the `__init__` method of the `OpenAIModel` class, detailing its parameters and their purpose. This model is used for interacting with OpenAI services, allowing specification of the model name and an optional provider. ```APIDOC OpenAIModel: __init__(model_name: str, provider: str = 'openai') model_name: The name of the OpenAI model to use provider: The provider to use (defaults to 'openai') ``` -------------------------------- ### OpenAIModel Class Constructor Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html Documents the constructor for the OpenAIModel class. It explains the 'model_name' parameter, which is mandatory, and the optional 'provider' parameter, which defaults to 'openai'. This snippet is crucial for understanding how to initialize an OpenAI model instance. ```APIDOC OpenAIModel: __init__(model_name: str, provider: str = 'openai') model_name: The name of the OpenAI model to use provider: The provider to use (defaults to 'openai') ``` -------------------------------- ### rmetalog Package: metalog() Function API Reference Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html This section details the `metalog()` function, the core of the `rmetalog` package, used for creating metalog distributions. It outlines all available parameters, their types, and descriptions, allowing for flexible distribution fitting. ```APIDOC metalog( x: vector of numeric data, term_limit: integer between 3 and 30, specifying the number of metalog distributions, with respective terms, terms to build (default: 13), bounds: numeric vector specifying lower or upper bounds, none required if the distribution is unbounded, boundedness: character string specifying unbounded, semi-bounded upper, semi-bounded lower or bounded; accepts values u, su, sl and b (default: ā€˜u’), term_lower_bound: (Optional) the smallest term to generate, used to minimize computation must be less than term_limit (default is 2), step_len: (Optional) size of steps to summarize the distribution (between 0.001 and 0.01, which is between approx 1000 and 100 summarized points). This is only used if the data vector length is greater than 100., probs: (Optional) probability quantiles, same length as x ) ``` -------------------------------- ### metalog() Function Parameters Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This section details the various parameters accepted by the `metalog()` function, including their types, descriptions, and default values. These parameters control the characteristics and fitting process of the metalog distribution. ```APIDOC metalog( x: vector of numeric data term_limit: integer between 3 and 30, specifying the number of metalog distributions, with respective terms, terms to build (default: 13) bounds: numeric vector specifying lower or upper bounds, none required if the distribution is unbounded boundedness: character string specifying unbounded, semi-bounded upper, semi-bounded lower or bounded; accepts values u, su, sl and b (default: ā€˜u’) term_lower_bound: (Optional) the smallest term to generate, used to minimize computation must be less than term_limit (default is 2) step_len: (Optional) size of steps to summarize the distribution (between 0.001 and 0.01, which is between approx 1000 and 100 summarized points). This is only used if the data vector length is greater than 100. probs: (Optional) probability quantiles, same length as x ) ``` -------------------------------- ### Generate Samples from Rmetalog Distribution Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html This R code snippet demonstrates how to generate 'n' samples from a 'metalog' distribution using the 'rmetalog' function. The 'term' parameter specifies the number of terms to use for the distribution, and the resulting samples are then visualized using a histogram. ```R s <- rmetalog(my_metalog, n = 1000, term = 9) hist(s) ``` -------------------------------- ### Summarize a Metalog Distribution Object Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This snippet shows how to use the `summary()` function on an object created by `metalog()`. It provides an overview of the distribution's parameters and the validation status of each term. ```R summary(my_metalog) #> ----------------------------------------------- #> Summary of Metalog Distribution Object #> ----------------------------------------------- #> #> Parameters #> Term Limit: 9 #> Term Lower Bound: 2 #> Boundedness: b #> Bounds (only used based on boundedness): 0 60 #> Step Length for Distribution Summary: 0.01 #> Method Use for Fitting: any #> #> #> Validation and Fit Method #> term valid method #> 2 yes OLS #> 3 yes OLS #> 4 yes OLS #> 5 yes OLS #> 6 yes OLS #> 7 yes OLS #> 8 yes OLS #> 9 yes OLS ``` -------------------------------- ### Generate Samples from a Metalog Distribution Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This snippet shows how to generate `n` random samples from a fitted metalog distribution using the `rmetalog()` function, specifying the desired term. It then visualizes the sampled data using a histogram. ```R s <- rmetalog(my_metalog, n = 1000, term = 9) hist(s) ``` -------------------------------- ### Calculate Density from Quantiles of a Metalog Distribution Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This snippet demonstrates how to calculate the probability density for given quantile values from a fitted metalog distribution using the `dmetalog()` function. It takes an `rmetalog` object, a vector of quantiles, and the desired term. ```R dmetalog(my_metalog, q = c(3, 10, 25), term = 9) #> [1] 0.004490 0.126724 0.002264 ``` -------------------------------- ### metalog() Function Signature Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This entry provides the basic function call for `metalog()`, which is the core function for creating metalog distributions within the `rmetalog` package. ```APIDOC metalog() ``` -------------------------------- ### Plot Metalog Distribution PDF and CDF Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This snippet demonstrates how to generate quick visual comparisons of the probability density function (PDF) and cumulative distribution function (CDF) for the metalog distributions by term, using the `plot()` function on the `rmetalog` object. ```R plot(my_metalog) #> $pdf #> #> $cdf ``` -------------------------------- ### Calculate Quantiles of a Metalog Distribution Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This snippet demonstrates how to retrieve quantile values from a fitted metalog distribution using the `qmetalog()` function, similar to standard R distribution functions. It takes an `rmetalog` object, a vector of probabilities, and the desired term. ```R qmetalog(my_metalog, y = c(0.25, 0.5, 0.75), term = 9) #> [1] 7.241 9.840 12.063 ``` -------------------------------- ### Summarize a Fitted rmetalog Distribution Object in R Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html After fitting a metalog distribution, this snippet demonstrates how to use the `summary()` function on the resulting `rmetalog` object. The summary provides details on the distribution's parameters, validation status, and the fitting method used for each term. ```R summary(my_metalog) ``` -------------------------------- ### Inject MathJax Script into HTML Head Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html This JavaScript snippet dynamically creates a script element and appends it to the HTML document's head. The script loads the MathJax library from RStudio's CDN, configured for TeX, AMS, MML, and HTML output, enabling mathematical rendering on the page. ```JavaScript (function () { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; document.getElementsByTagName("head")[0].appendChild(script); })(); ``` -------------------------------- ### Plot a Fitted rmetalog Distribution in R Source: https://github.com/isaacfab/rmetalog/blob/master/vignettes/rmetalog-vignette.html This snippet shows how to visualize the fitted metalog distributions using the `plot()` function on an `rmetalog` object. It generates a quick visual comparison of the distributions by term, aiding in understanding the fit. ```R plot(my_metalog) ``` -------------------------------- ### Calculate Probabilities from Quantiles of a Metalog Distribution Source: https://github.com/isaacfab/rmetalog/blob/master/README.md This snippet shows how to calculate the cumulative probabilities for given quantile values from a fitted metalog distribution using the `pmetalog()` function. It takes an `rmetalog` object, a vector of quantiles, and the desired term. ```R pmetalog(my_metalog, q = c(3, 10, 25), term = 9) #> [1] 0.001957 0.520058 0.992267 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.