Additional libraries
Release: |
4.6 • 5.0 • 5.1 • 5.2 • 5.3 • 5.4 • 6.0 • 6.1 • 6.2 • 6.3 • 6.4 • 6.5 |
---|
This page describes a set of useful Analytica function libraries. These are additional to the Standard libraries that are automatically installed when you install Analytica. If you want to use any of these additional libraries, click on its link and it will download onto your computer. Depending on your download settings, it may automatically open it in Analytica. Either way, you should save it into a directory so that you can add it into your models. It's usually most convenient to save it with your Standard libraries in directory
"C: \Program Files\Lumina\Analytica 6.4\Libraries"
You can then easily add it into your models using the standard menu option Add Library... from the File menu.
See User-defined Functions and Libraries to build your own functions and libraries.
Misc. libraries
Large Sample Library
Download: media:Large_Sample_Library_v10.ana
The Large Sample Library is an Analytica library that lets you run a Monte Carlo simulation for large models or a large sample size that might otherwise exhaust computer memory, including virtual memory. It breaks up a large sample into a series of batch samples, each small enough to run in memory. For selected variables, known as the Large Sample Variables or LSVs, it accumulates the batches into a large sample. You can then view the probability distributions for each LSV using the standard methods — confidence bands, PDF, CDF, etc. — with the full precision of the large sample.
See Large Sample Library: User Guide.
The Sensitivity Analysis Library
The Sensitivity Analysis Library provides functions for analyzing the sensitivity of an output to each cell of each array-valued chance input, and locating those individual scalar inputs that have the greatest impact on the result. See The Sensitivity Analysis Library for documentation on using this library.
The library itself can be downloaded from Sensitivity Analysis Library.ana, and an example model to demonstrate its usage is at Sensitivity Functions Examples.ana.
Model Documentation Library
Download: Model Documentation Library.ana
Prerequisites: Analytica 5.0 or later. The Domain acts as self index legacy preference must be OFF. You must be using ClearType text (not the very old non-clearType legacy setting).
Some people like to create a concise report on paper that contains all objects in their model along with descriptions or other selected attributes. The "Print Report" feature in Analytica can be used for this purpose, but is not at all concise and ends up placing each object window on a separate page. The Model Documentation Library allows you to select a module from your model and produce a result table containing every object within that module with its selected attributes such as title, description, units, definition, or user-defined attributes. This table can then be exported to Excel where you can format it nicely and print it. Thus, you can end up with a very concise report on paper.
To use this library, load your model and then select File → Add Module.... Add the Model Documentation Library.ana module file using Embed. In that module, using the pulldown, select the top-level module for the report. Follow the instructions shown on the diagram. If you make changes to your model later, press the Update Model Documentation button to adjust the pulldown content.
Units Conversion Library
Download: Units conversion library.ana
These functions convert between different units -- for example, from feet to kilometers, or from Btu (British thermal units) to gigajoules of energy. They relieve you from having to look up conversion factors. They also make your model more transparent by making it clear where you are converting from one units to another -- instead of just embedding conversion constants in the formulas.
You can use the Conversion example section to enter a quantity, select its type (dimensions) and units, and convert it to another unit of that type.
Library functions
Units_factor(oldUnits, newUnits) to give a conversion factor between two units. If you omit newUnits, it will assume the standard units for that type (dimensions). The units parameters text values must match an abbreviation, synonym, or full name (case insensitive) in the Units data table. If the units are of different dimensions, e.g. energy and power, or if it doesn't recognize the units, it will give an error.
Units_conversion(x, oldUnits, newUnits) returns the value of quantity x converted from oldUnits to newUnits. This works for units like temperature, where simple factors don't work.
Units_real_dollars(yr, baseYr) returns a multiplication factor used to convert nominal dollars in year yr to real (also known as constant) dollars using baseYr as the base year. If you omit baseYr, it uses the "Standard base year for inflation" which you can set in the Units Conversion Library user interface. It uses consumer price index data provided by the US Energy Information Administration from 1949 to 2017 with projections up to 2040. It gives an error if yr or baseYr are outside that range.
The Units_table contains the list of units, with abbreviation, full-name, and synonyms, type (dimensions) and conversion factors to the base unit for each type. For example, the base unit for 'Energy' is Joule. The conversion factor for gigajoule (GJ) is 10^9. You can add your own units. Be careful to select the correct type (dimensions).
Greatest Common Divisor functions
Download: GCD function library.ana
This library contains two User-Defined Functions for computing the greatest common divisor.
Database library
Download: Database library.ana
A library of functions to make it easy to create, read, update, examine and delete database tables, without having to write SQL. It works with Microsoft Access, Microsoft SQL Server, MariaDB, and PostgreSQL, and can be expanded to support other database platforms.
DB Conversion Library
Download: DB conversion lib.ana
Lets you embed data obtained from a database into the Analytica model. This breaks the need to use it with an external database, so -- for example -- you can send to someone (e.g. Lumina tech support) who does not have access to the database or has an edition of Analytica (e.g. Professional) that doesn't support database access.
Press a button in this library to transform all the variables defined using DbQuery, DbLabels and DbTable to literal data. Variables and indexes defined using DbQuery or DbLabels are transformed to list definitions, and those defined using DbTable are transformed into edit tables. This breaks the connection to the external database. So, of course, the model will no longer be able to get new or extended data from the database.
The library is limited in its scope. It only works when all calls to DbQuery, DbLabels and DbTable occur at the top level of variable definitions. Do not try to use it if the calls to these functions are embedded within larger expressions or in User-Defined Functions.
Use with extreme caution!!: Make a copy of your original model before adding and executing this module. After running the transformation, be sure to use File → Save As... to save the transformed model under a different filename, so you don't clobber your original model.
Spreadsheet Helper Library
Download: Spreadsheet Helper lib.ana
Includes functions that return the list of worksheet names and the Excel filename of the workbook. It also contains a SpreadsheetOpenEx function that can be used in place of SpreadsheetOpen, but which remembers the filename selected by the user so the next time they don't have to select the file again.
Data Standardization Library
Download: Data Standardization Library.ana
Imported data is often inconsistent. This library allows you to choose what the "standard" values should be in a column of data. You can then map any non-standard value to one of the standard values. The result is a column of consistent data.
Additional probability distributions
Laplacian distribution
Download: Laplacian distribution library.ana
Description: The Laplacian distribution (or Laplace distribution) is a continuous, unbounded distribution that is essentially a double-sided Exponential distribution with a «mean» parameter. The library contains the distribution function, and the analytica functions for density, cumulative density and inverse cumulative density (the quantile function).
The HDR pseudo-random number generator
Download: Hubbard HDR Library.ana
Authors: Doug Hubbard, Hubbard Decision Research, and Lonnie Chrisman, Lumina Decision Systems
Description: The HDR is a simple, open-source pseudo-random number generation algorithm. It has been embraced by organizations such as ProbabilityManagement.org as a standard for efficiently exchanging exact Monte Carlo samples. Given 4 integer seed values, the sequence is deterministic, so two parties with these same 4 values can reproduce precisely the same sequence up to a length of 100M samples, even from Excel. Select a different combination of seeds to prevent any two independent simulations from inadvertently using the same random number stream. This ensures that independent simulation results can be combined without unintended correlations. Or use the same combination of seeds to intentionally produce identical simulations of the same stream. This allows entire Monte Carlo simulation samples to be communicated in just a few numbers.
This library provides the functions for using HDR in an Analytica model. The Hubbard_HDR(...)
function enables you to obtain the nth random number in a sequence, while the HDR_U(...)
function acts as a Uniform(0,1)
distribution as is convenient to use in any Inverse Cumulative Probability Function (e.g., CumKeelinInv, CumNormalInv, CumBetaInv, etc) to encode a specific distribution inside a model.
- Douglas Hubbard (Aug 2019), "A Multi-Dimensional, Counter-Based Pseudo Random Number Generator as a Standard for Monte Carlo Simulations", Winter Simulation Conference, Washington DC, DOI: 10.1109/WSC40007.2019.9004773.
Individual functions with examples
Download: Recumulate example.ana : Like Cumulate, but resets to zero at selected points.
Download: Apportion.ana: Aggregates or disaggregates an array of values from one index to another index, where the second index may be larger or smaller. Does not require the indexes to be index multiples of each other. For example, if you map from a 47-element index to a 13-element index, each 3.62 elements of the original map to an element in the destination, so for example, the first 3 items map to the first item, then the fourth item is shared, with 0.62 apportioned to the first element and 0.38 apportioned to the second element. Supports aggregation types 'SUM'
, 'AVERAGE'
, 'MIN'
and 'MAX'
. Contributed by Paul Sanford of EPRI.
Download: Sequential dispatch library.ana : The function SequentialDispatch generalizes the Dispatch function by adding a time-like index to carry over unsatisfied demand or unallocated capacity. Sequential dispatch test.ana is an example of its use.
The Legendre Library
The Legendre Library includes functions for:
- Gauss-Legendre Quadrature
- Numerically stable, accurate and efficient calculation of an order n Legendre Polynomial at values -1<=x<=1
- Numerically stable calculation of the derivative of an order n Legendre Polynomial at x.
- Calculation of the zeros of Legendre polynomials.
- Calculation of the Legendre polynomial coefficients.
Author: Lonnie Chrisman, Lumina Decision Systems
Download: Legendre library.ana
The library has its own reference page on this wiki.
Cell Icon Set Library
Provides pre-curated icon sets for use as cell icons in tables. The functions automatically select which icon in a set to use to depict the value that you want the icon to depict. Each icon set uses a consistent color scheme and consistent icon shapes having a consistent theme. Icon sets include shape collections, directional indicators, indicator styles and rating styles.
Without this library, you can use cell icons in table cells by using the CellIcon function in a Computed cell format attribute. But this requires you to find suitable icon images and write logic to map from your values to these images. This library takes care of these pain points for you.
Documentation: Cell Icon Set Library
Download: Cell_Icon_Set_Library.ana
Author: Lonnie Chrisman, Lumina Decision Systems
See Also
- Standard libraries: Installed with Analytica
- User Libraries: How to create your own Libraries
- Example Models
- Large Sample Library: User Guide
- Modules and Libraries
- Filed modules and libraries
- User-defined Functions and Libraries
- Example Models and Libraries
- Financial library functions
- The Sensitivity Analysis Library
- Distribution Densities Library
- Linked list library
- Base Conversion Function Library
- Performance Profiler library
- List of libraries
Enable comment auto-refresher