Difference between revisions of "Additional libraries"

m (appearance of download hyperlink)
(33 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[category:Function libraries]]
+
[[Category:Function libraries]]
(Up to [[Analytica Wiki]])
 
  
== Individual functions with examples ==
+
__TOC__
 +
 
 +
 
 +
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
 +
:<code>c: Lumina/Analytica 4.6/Libraries</code>
 +
 
 +
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.
  
* [[media:Recumulate example.ana|Recumulate example.ana]] : Like [[Cumulate]], but resets to zero at selected points.
+
__TOC__
  
== Libraries Not Included with the Analytica Installer ==
 
 
=== Large Sample Library ===
 
=== Large Sample Library ===
 +
'''Download:''' [[media:Large_Sample_Library_v10.ana|Large sample library v10.ana]]
  
 
:[[image:Large sample library.png]]
 
:[[image:Large sample library.png]]
Line 22: Line 29:
 
=== Model Documentation Library ===
 
=== Model Documentation Library ===
 
'''Download: ''' [[media:Model Documentation Library.ana|Model Documentation Library.ana]]
 
'''Download: ''' [[media:Model Documentation Library.ana|Model Documentation Library.ana]]
 +
 +
'''Prerequisites:''' [[Analytica 5.0]] or later. The [[Preferences_dialog|Domain acts as self index]] legacy preference must be OFF. You must be using [[Diagram_Style_dialog|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.
 
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.
Line 27: Line 36:
 
To use this library, load your model and then select '''File &rarr; Add Module...'''.  Add the [[media:Model Documentation Library.ana|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.
 
To use this library, load your model and then select '''File &rarr; Add Module...'''.  Add the [[media:Model Documentation Library.ana|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 ===
+
=== [[Units Conversion Library]] ===
'''Download: ''' [[media:Units conversion library.ana|Units conversion library.ana]]
+
'''Download: ''' [[media:Units conversion library.ANA|Units conversion library.ana]]
  
The functions in this library provide conversions between different units -- for example, from feet to kilometers, or from Btu (British thermal units) to gigajoules of energy.  Using this library relieves you from having to look up conversion factors. It also makes the 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.  
+
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.  
  
Use '''Conversion_Factor'''(oldUnits, newUnits) to give a conversion factor between two units.
+
[[File:Units conversion library.png|600px]]
  
If you omit «newUnits», it will assume the standard units for that type (dimensions).
+
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.
  
When specifying units , you must use a symbol (abbreviation) from the Units table.
+
====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.
 
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.
  
Use '''Nom_to_real_dollars'''(yr, baseYr) to convert from nominal dollars for year «yr» to "real dollars" for specified «baseYr». If you omit «baseYr», it defaults to the Standard base year, initially 2000.
+
'''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.
  
These conversion factors were provided on October 20, 2007 by Chris Marnay of the Lawrence Berkeley Laboratory, as part of his work on the SEDS project.
+
'''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 ===
 
=== Greatest Common Divisor functions ===
Line 63: Line 77:
 
'''Download: ''' [[media:Spreadsheet Helper lib.ana|Spreadsheet Helper lib.ana]]
 
'''Download: ''' [[media:Spreadsheet Helper lib.ana|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 he doesn't have to select the file again.
+
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 ===
 
=== Data Standardization Library ===
Line 70: Line 84:
 
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.
 
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.
  
== Libraries included with Analytica ==
+
== Additional probability distributions ==
These libraries are copied onto your computer when you install any edition of Analytica (including Free 101).  You can conveniently add them into a model within Analyica by selecting '''Add Library...''' from the '''File''' menu. 
 
  
===ACP style library===
+
=== Laplacian distribution ===
This library file helps modelers customize the display of their model in [[Analytica Cloud Player]] (ACP). Most of the ACP styles attributes can be applied using this library, and It simplifies the process by using a GUI rather than by having to enter the attributes by typing them out.
 
  
Download: [[media:ACP style library.ana]]
+
'''Download: ''' [[media:Laplacian distribution library.ana|Laplacian distribution library.ana]]
  
See [[ACP Style Library]] for documentation on how to use this library
+
'''Description: ''' The Laplacian distribution (or [https://en.wikipedia.org/wiki/Laplace_distribution 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).
  
=== Bayes Function ===
+
== The HDR pseudo-random number generator ==
Functions for a simple application of Bayes' rule to a complete discrete joint array of prior probabilities.
 
  
Download: [[media:Bayes Function.ana]]
+
'''Download:''' [[media:Hubbard HDR Library.ana|Hubbard HDR Library.ana]]
  
=== Complex Numbers ===
+
'''Authors:''' [https://en.wikipedia.org/wiki/Douglas_W._Hubbard Doug Hubbard], [https://hubbardresearch.com/ Hubbard Decision Research], and Lonnie Chrisman, [https://lumina.com Lumina Decision Systems]
Functions for computing with complex numbers.
 
  
Download: [[media:Complex Library.ana]]
+
'''Description:''' [https://www.researchgate.net/publication/338824184_A_Multi-Dimensional_Counter-Based_Pseudo_Random_Number_Generator_as_a_Standard_for_Monte_Carlo_Simulations The HDR] is a simple, open-source pseudo-random number generation algorithm. It has been embraced by organizations such as [https://ProbabilityManagement.org 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.
  
=== Concatenation ===
+
This library provides the functions for using HDR in an Analytica model. The <code>Hubbard_HDR(...)</code> function enables you to obtain the nth random number in a sequence, while the <code>HDR_U(...)</code> function acts as a <code>[[Uniform|Uniform(0,1)]]</code> 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.
Functions for concatenation of arrays. Several [[ConcatN]] functions allow N arrays to be concatenated in a single call, as an alternative to calling the built-in [[Concat]] function N times in sequence.  [[ConcatRows]] joins the rows of an array .
 
  
Download: [[media:Concatenation.ana]]
+
* Douglas Hubbard (Aug 2019), "[https://www.researchgate.net/publication/338824184_A_Multi-Dimensional_Counter-Based_Pseudo_Random_Number_Generator_as_a_Standard_for_Monte_Carlo_Simulations 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.
  
=== Data Statistics ===
+
== Individual functions with examples ==
This library is deprecated (obsolete) in Analytica 4.0, but is still included for backward compatibility for models that used these functions in earlier versions of Analytica.  Functions allow statistics, such as [[SDeviation]], to be applied across indexes other than [[Run]].  The built-in statistical functions now allow the running index to be optionally specified.
 
 
 
Download: [[media:Data Statistics Library.ana]]
 
 
 
===Distribution Densities ===
 
Functions that return the analytic density function for continuous distributions.  These densities can be used when using importance sampling, for example.  The library is described in detail at [[Distribution Densities Library]].
 
 
 
A new version (after the 4.1.1 release) is now available that includes density functions for all built-in continuous and discrete distributions, as well as for a few other distributions (F-dist, [[Wishart]], [[Gaussian]],...).  This version also include cumulative distribution functions and inverse cumulative distribution functions for many distributions.  See [[Distribution Densities Library]] for more details.  To get the newest version, download the library below, then replace the one in your Libraries directory. 
 
 
 
Download: [[media:Distribution Densities.ana|Distribution Densities.ana]]
 
 
 
=== Distribution Variations ===
 
A variety of alternative parametrizations of built-in univariate distributions, and other common parametric univariate distributions that are simple transformations of built-in distributions.
 
 
 
Download: [[media:Distribution Variations.ana]]
 
 
 
=== Expand Index ===
 
Download: [[media:Expand Index.ana]]
 
 
 
=== Financial Functions ===
 
Includes functions for derivative valuations, bond pricing, etc.
 
 
 
''Note'': Standard financial functions (equivalent to those found in Excel) are built into Analytica and are found in the built-in Financial Functions library.
 
 
 
Download: [[media:Financial Library.ana]]
 
 
 
=== Flat File Library ===
 
Functions for reading data from a comma-separated flat file format (.CSV) into Analytica arrays.
 
 
 
Download: [[media:Flat File Library.ana]]
 
 
 
=== Garbage Bin ===
 
Provides a garbage bin icon.  Instead of deleting nodes, you can drag them to the garbage bin.  The "deletion" can then be undone if necessary.  Also, if the node you delete has dependents or dependencies, this is immediately evident by the arrows emanating to or from the garbage bin.
 
 
 
To empty the garbage bin, double click on it to open it, select all and delete.  Emptying the garbage bin in this fashion is not undoable.  You must delete an object (permanently) from the garbage bin before you can reuse its identifier.
 
  
Download: [[media:Garbage Bin.ana]]
+
'''Download: '''  [[media:Recumulate example.ana|Recumulate example.ana]] : Like [[Cumulate]], but resets to zero at selected points.
  
=== Generalized Regression ===
+
'''Download:''' [[media:Apportion.ana|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 <code>'SUM'</code>, <code>'AVERAGE'</code>, <code>'MIN'</code> and <code>'MAX'</code>. Contributed by Paul Sanford of EPRI.
(Requires Analytica Optimizer )
 
  
[[Logistic]] and [[Probit_Regression|Probit]] regressionThese functions are used to fit a function that predicts the probability of an outcome based on a set of continuous independent variables, from a data set where each data point is classified as either 0 or 1.
+
<div name="SequentialDispatch">
 +
'''Download: ''' [[media:Sequential dispatch library.ana|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[[media:Sequential dispatch test.ana|Sequential dispatch test.ana]] is an example of its use.
 +
</div>
  
Download: [[media:Generalized Regression.ana]]
+
== The [[Legendre Library]] ==
 +
The [[Legendre Library]] includes functions for:
  
=== Linked Lists ===
+
* Gauss-Legendre Quadrature
Download: [[media:Linked List Library.ana]]
+
* 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.
  
=== Multivariate Distributions ===
+
'''Author:''' Lonnie Chrisman, Lumina Decision Systems
Various multi-dimensional distributions, and the ability to generated correlated distributions.
 
  
Download: [[media:Multivariate Distributions.ana]]
+
'''Download:''' [[media:Legendre library.ana|Legendre library.ana]]
  
=== ODBC Database Functions ===
+
The library has [[Legendre Library|its own reference page]] on this wiki.
* [[media:ODBC-Library.ana]]
 
  
=== Optimization Functions ===
+
== Cell Icon Set Library ==
Provides some elementary optimization functions:
+
:[[image:CellIconSetExample1.png|600px]]
* [[GoalSeek]]
 
* [[Solve]]
 
* [[Gradient]]
 
  
These are usable even without Analytica Optimizer; however they are based on a rudimentary gradient-descent algorithm and don't have anything near the power of the Frontline solver functions provided by Analytica Optimizer functions.
+
Provides pre-curated icon sets for use as [[CellIcon|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.  
  
Download: [[media:Optimization Functions.ana]]
+
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.
  
=== Performance Profiler ===
+
'''Documentation:''' [[Cell Icon Set Library]]
(Required Analytica Enterprise)
 
  
Used to determine where a model is consuming time and memory resources.
+
'''Download:''' [[media:Cell_Icon_Set_Library.ana|Cell_Icon_Set_Library.ana]]
  
Download: [[media:Performance Profiler.ana]]
+
'''Author:''' Lonnie Chrisman, Lumina Decision Systems
  
 
==See Also==
 
==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]]  
 
* [[The Sensitivity Analysis Library]]  
 
* [[Distribution Densities Library]]
 
* [[Distribution Densities Library]]
 
* [[Linked list library]]
 
* [[Linked list library]]
 
* [[Base Conversion Function Library]]
 
* [[Base Conversion Function Library]]
 +
* [[Performance Profiler library]]
 +
* [[List of libraries]]

Revision as of 00:58, 7 January 2022



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: Lumina/Analytica 4.6/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.


Large Sample Library

Download: Large sample library v10.ana

Large sample library.png

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.

Units conversion library.png

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.

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.

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

CellIconSetExample1.png

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

Comments


You are not allowed to post comments.