Difference between revisions of "Example Models"

m (added link to other example model page)
(Re-organized the models, according to general type (which matches the types from our Analytica Example Models and Libraries).)
Line 1: Line 1:
 
[[Category: Models]]
 
[[Category: Models]]
 
[[category:Doc Status D]]
 
[[category:Doc Status D]]
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
__TOC__
 
</div>
 
  
 
You may find these example Analytica models useful to see what Analytica can do, and as inspiration or a starting point for your own models. They cover a wide variety of topics and techniques.   
 
You may find these example Analytica models useful to see what Analytica can do, and as inspiration or a starting point for your own models. They cover a wide variety of topics and techniques.   
Line 12: Line 8:
 
You can are also invited to contribute your own models as examples. For how to do that, see [[Uploading Example Models]].
 
You can are also invited to contribute your own models as examples. For how to do that, see [[Uploading Example Models]].
  
----
+
__TOC__
 
 
==Foxes and Hares==
 
  
:[[Image:Populations end.jpg]]
+
==Business Examples==
  
'''Description''': This model describes the dynamics of a predator/prey relationship. See [[Tutorial: Dynamic system model]] for details.
+
=== Marginal Abatement Graph ===
 
 
'''Keywords''': Dynamic systems, dynamic simulation, feedback loops, cycles, ecosystem, predator prey models.
 
 
 
'''Play''': [https://www.analyticacloud.com/acp/Client/AcpClient.aspx?inviteId=5&inviteCode=730213&subName=acp%20demos Foxes and Hares model] in [[Analytica Cloud Player]]
 
 
 
'''Author''': Analytica team at Lumina
 
 
 
'''Download''':  Part of Desktop Analytica (Example Models > Tutorial Models)
 
 
 
----
 
 
 
==Party Problem==
 
 
 
:[[File:Chapter_9.2-updated.png]]
 
 
 
'''Description''': This model shows how to model a decision tree to decide what is the best location to hold a party, depending on (uncertain) weather. See [[Tutorial: Decision trees]] for details.
 
 
 
'''Keywords''': Decision analysis, decision tree, expected value, discrete probability distribution.
 
 
 
'''Author''': Analytica team at Lumina
 
 
 
'''Download:''' Part of Desktop Analytica (Example Models > Decision Analysis > Party With Forecast.ana )
 
----
 
 
 
==Rent vs. Buy==
 
 
 
:[[File:Chapter 1.7.png]]
 
 
 
'''Description''': This model analyzes the costs and benefits of renting a home vs buying a home. See more at [[Tutorial: Open a model to browse]], [[Tutorial: Reviewing a model]] and [[Tutorial: Analyzing a model]]
 
 
 
'''Keywords''': Uncertainty, Monte Carlo simulation, appreciation, present value, finance.
 
 
 
'''Play''':  [https://www.analyticacloud.com/acp/Client/AcpClient.aspx?inviteId=3&inviteCode=221703&subName=acp%20demos Rent vs. Buy model] in [[Analytica Cloud Player]]
 
 
 
'''Author''': Analytica team at Lumina
 
 
 
'''Download''':  Part of Desktop Analytica (Example Models > Tutorial Models)
 
----
 
 
 
== Marginal Abatement Graph ==
 
  
 
:[[image:Marginal abatement heating energy.png]]
 
:[[image:Marginal abatement heating energy.png]]
Line 70: Line 24:
 
'''Download:''' [[media:Marginal abatement home heating.ana|Marginal abatement home heating.ana]]
 
'''Download:''' [[media:Marginal abatement home heating.ana|Marginal abatement home heating.ana]]
  
----
+
=== Solar Panel Analysis ===
 
 
== Solar Panel Analysis ==
 
  
 
:[[image:Solar Panel Analysis.png]]
 
:[[image:Solar Panel Analysis.png]]
Line 86: Line 38:
 
'''Download:''' [[media:Solar Panel Analysis.ana|Solar Panel Analysis.ana]]
 
'''Download:''' [[media:Solar Panel Analysis.ana|Solar Panel Analysis.ana]]
  
----
+
=== Items within Budget function ===
  
== Timber Post Compression Load Capacity ==
+
'''Description:''' Given a set of items, with a priority and a cost for each, the function Items_within_budget function selects out the highest priority items that fit within the fixed budget.  
 
 
'''Description:''' Here is a calculator for computing the maximum load that can be handled by a Douglas Fir - Larch post of a given size, grade, and composition in a construction setting.
 
  
 
'''Keywords:'''
 
'''Keywords:'''
  
'''Author:''' Lonnie Chrisman
+
'''Author:''' Max Henrion
  
'''Download:''' [[Media:PostCompression.ana|Post Compression Model]]
+
'''Download''': [[Media:Items_within_budget.ana|Items within budget.ana]]
----
 
  
== Transforming Dimensions by transform matrix, month to quarter ==
+
=== Grant Exclusion Model ===
  
'''Description:''' The model shows how to transform an array from a finer-grain index (e.g., Month) onto a coarser index (e.g., Quarter)We generally refer to this as [[Aggregate|aggregation]].  The model illustrates the direct use of [[Aggregate]], as well as a method to do this used before Aggregate was added to Analytica in release 4.2.
+
'''Description:''' This model tests a hypothesis about the distribution of an attribute of the marginal rejectee of a grant program, given the relevance of that attribute to award of the grantIt could be used by an organization to make decisions as to whether to fiscally-sponsor another organization that will use that fiscal sponsorship to apply for grants, by looking at the effect on the pool of grant recipients overall.
  
'''Webinar:''' [[Analytica_User_Group/Past_Topics#The_Aggregate_Function|the Aggregate function]].
+
'''Keywords:''' Business analysis
  
'''Keywords''': Aggregation, level of detail, days, weeks, months, quarters, years.
+
'''Download''': [[Media:Grant_exclusion.ANA|Grant exclusion.ana]]
  
'''Author:''' Lonnie Chrisman
+
=== Project Planner ===
  
'''Download:''' [[Media:Month to quarter.ana|Month to quarter.ana]]
+
:[[Image: Project planner model.png |500px]]
  
----
+
'''Description:''' This is a demo model that shows how to:
 +
* Evaluate a set of R&D projects, including uncertain R&D costs, and uncertain revenues if it leads to release of a commercial product.
 +
* Use multiattribute analysis to compare projects, including a hard attribute -- expected net present value -- and soft attributes -- strategic fit, staff development, and public good will.
 +
* Compare cost, [[NPV]], and multiattribute value for a selected portfolio of projects.
 +
* Generate the best portfolio (ratio of NPV or multiattribute merit to cost) given a R&D budget.
  
== Items within Budget function ==
+
The model linked here is only a test, and to an older version: [[File:Project_priorities_2007_4.0.ANA]]
  
'''Description:''' Given a set of items, with a priority and a cost for each, the function Items_within_budget function selects out the highest priority items that fit within the fixed budget.
+
'''Keywords:''' Business models, cost analysis, net present value (NPV), uncertainty analysis
  
'''Keywords:'''
+
'''Download:''' [[Media:Project Priorities 5 0.ana|Project Priorities 5 0.ana]]
  
'''Author:''' Max Henrion
+
=== Steel and Aluminum import tariff impact on US trade deficit ===
  
'''Download''': [[Media:Items_within_budget.ana]]
+
<center>[[Image:Steel and aluminum tariff model diagram.png|400px]]</center>
  
----
+
'''Description:''' On 2-March-2018, President Trump proposed new import tariffs on steel and aluminum. It seems as if the projected net impacts of these tariffs on the total US trade deficit and US economy depends largely on which news outlets you get your news from. We thought it would be helpful to put together a simple and easy to understand model to estimate of the net impact of these tariffs on the US trade deficit, assuming that no other factors change (e.g., no retaliatory tariffs are enacted by other countries). We wanted something that allows you to understand how its estimates are being derived, with assumptions that can be easily replaced with your own, so that the model itself would be impartial to any particular viewpoint. We want the uncertainties that are inherent in such a simple model to be explicit, so you can see the range of possibilities and not just a single guess. Finally, we wanted the model to be easy to understand fully for non-economists (a group to which we belong, too).
  
== Convolution ==
+
This model accompanied a current event blog post on the Lumina blog: [http://lumina.com/blog/impact-of-trumps-proposed-steel-aluminum-tariffs-on-us-trade-deficit Impact of Trump’s proposed Steel & Aluminum tariffs on US trade deficit]
  
'''Description:''' Convolution is used mostly for signal and systems analysis. It is a way to combine two time series.  This model contains function Convolve(Y, Z, T, I), that computes the convolution of two time series.  The model contains several examples of convolved functions.
+
'''Authors:''' Kimberley Mullins and Lonnie Chrisman, Lumina Decision Systems
  
A time series is a set of points, <code>(Y, T)</code>, where <code>T</code> is the ascending X-axis, and the set of points is indexed by <code>I</code>. The values of <code>T</code> do not have to be equally spaced. The function treats <code>Y</code> and <code>Z</code> as being equal to 0 outside the range of <code>T</code>. The two time series here are the set of points <code>(Y, T)</code> and the set of points <code>(Z, T)</code>, where both sets of points are indexed by <code>I</code>.
+
'''Download:''' [[Media:Steel and aluminum tariff model.ana|Steel and aluminum tariff model.ana]]
 
 
The mathematical definition of the convolution of two time series is the function given by:
 
 
 
:<math>h(t) = \int y(u) z(t-u) dt</math>
 
 
 
'''Keywords:''' Signal analysis, systems analysis
 
 
 
'''Author:''' Lonnie Chrisman
 
  
'''Download''': [[Media:Convolution.ana|Convolution]]
+
==Data Analysis==
  
----
+
=== Sampling from only feasible points ===
 
 
== Sampling from only feasible points ==
 
  
 
'''Description:''' Consider this scenario. You have a bunch of chance variables, each defined by a distribution. They joint sample generated, however, contains some combinations of points that are (for one reason or another) physically impossible. We'll call those infeasible points. You'd like to eliminate those points from the sample and keep only the feasible points.  
 
'''Description:''' Consider this scenario. You have a bunch of chance variables, each defined by a distribution. They joint sample generated, however, contains some combinations of points that are (for one reason or another) physically impossible. We'll call those infeasible points. You'd like to eliminate those points from the sample and keep only the feasible points.  
Line 157: Line 100:
 
'''Author:''' Lonnie Chrisman
 
'''Author:''' Lonnie Chrisman
  
'''Download''':  [[Media:Feasible_Sampler.ana]]  
+
'''Download''':  [[Media:Feasible_Sampler.ana|Feasible Sampler.ana]]  
  
----
+
=== Cross-Validation / Fitting Kernel Functions to Data ===
  
== Grant Exclusion Model ==
+
:[[image:Cross-validated data fit.jpg]]
  
'''Description:''' This model tests a hypothesis about the distribution of an attribute of the marginal rejectee of a grant program, given the relevance of that attribute to award of the grant.  It could be used by an organization to make decisions as to whether to fiscally-sponsor another organization that will use that fiscal sponsorship to apply for grants, by looking at the effect on the pool of grant recipients overall.
+
'''Description:''' When fitting a function to data, if you have too many free parameters relative to the number of points in your data set, you may "overfit" the data.  When this happens, the fit to your training data may be very good, but the fit to new data points (beyond those used for training) may be very poor.
  
'''Keywords:''' Business analysis
+
Cross-validation is a common technique to deal with this problem.  With this technique, we set aside a fraction of the available data as a cross-validation set.  Then we begin by fitting very simple functions to the data (with very few free parameters), successively increasing the number of free parameters, and seeing how the predictive performance changes on the cross-validation set.  It is typical to see improvement on the cross-validation set for a while, followed by a deterioration of predictive performance on the cross-validation set once overfitting starts occurring. 
  
'''Download''': [[Media:Grant_exclusion.ANA]]
+
This example model successively fits a non-linear kernel function to the residual error, and uses cross-validation to determine how many kernel functions should be used.
----
 
  
== Donor/Presenter Dashboard ==
+
Requires Analytica Optimizer: The kernel fitting function (Kern_Fit) uses [[NlpDefine]].
  
 +
'''Keywords:'''  Cross-validation, overfitting, non-linear kernel functions
  
'''Description:''' This model implements a continuous-time Markov chain in Analytica's discrete-time dynamic simulation environment.  It supports immigration to, and emigration from, every node.
+
'''Author:''' Lonnie Chrisman
  
It can be used by an arts organization to probabilistically forecast future audience evolution, in both the short and the long (steady state) term. It also allows for uncertainty in the input parameters.
+
'''Download:''' [[media:Cross-validation example.ana|Cross-validation example.ana]]
  
'''Keywords:''' Dynamic models, Markov processes
+
=== Statistical Bootstrapping ===
  
'''Download:''' [[Media:Donor_Presenter_Dashboard_II.ANA|Donor-Presenter Dashboard]]
+
'''Description:''' Bootstrapping is a technique from statistics for estimating the sampling error present in a statistical estimator.  The simplest version estimates sampling error by resampling the original data.  This model demonstrates how this is accomplished in Analytica.
  
----
+
'''Keywords:''' Bootstrapping, sampling error, re-sampling
  
== Project Planner ==
+
'''Download:''' [[media:Bootstrapping.ana|Bootstrapping.ana]]
  
:[[Image: Project planner model.png |500px]]
+
=== Smooth PDF plots using Kernel Density Estimation ===
  
'''Description:''' This is a demo model that shows how to:
+
:{| border="0"
* Evaluate a set of R&D projects, including uncertain R&D costs, and uncertain revenues if it leads to release of a commercial product.
+
| [[image:Dens_Est_builtin_pdf.png|frame|Analytica's built-in PDF plot with default settings]]
* Use multiattribute analysis to compare projects, including a hard attribute -- expected net present value -- and soft attributes -- strategic fit, staff development, and public good will.
+
|
* Compare cost, [[NPV]], and multiattribute value for a selected portfolio of projects.
+
[[image:Dens_Est_Kernel_pdf.png|frame|PDF computed from Kernel Density estimation]]
* Generate the best portfolio (ratio of NPV or multiattribute merit to cost) given a R&D budget.
+
|}
  
The model linked here is only a test, and to an older version: [[File:Project_priorities_2007_4.0.ANA]]
+
'''Description:''' This example demonstrates a very simple fixed-width kernel density estimator to estimate a "smooth" probability density.  The built-in PDF function in Analytica often has a choppy appearance due to the nature of histogramming -- it sets up a set of bins and counts how many points land in each bin. A kernel density estimator smooths this out, producing a less choppy PDF plot.
  
'''Keywords:''' Business models, cost analysis, net present value (NPV), uncertainty analysis
+
This smoothing is built into [[Analytica 4.4]].  You can select [[Kernel Density Smoothing|smoothing]] from the [[Uncertainty Setup dialog]].
  
'''Download:''' [[Media:Project Priorities 5 0.ana|Project Priorities 5 0.ana]]
+
'''Keywords:''' Kernel density estimation, kernel density smoothing
----
 
  
== California Power Plants ==
+
'''Author:''' D. Rice, Lumina Decision Systems
  
'''Description:''' An example showing how to use Choice menus and Checkbox inside an Edit table. It also shows how to use the Cell default attribute to specify default values (including Choice menu and Checkbox with default selections) specified in "Default Plant Data" to be used when user creates a new row in the Edit table.  This model shows how to demonstrates the use of [[Choice|choice pulldowns]] in edit tables. The model is created during a mini-tutorial on [[Inserting Choice Controls in Edit Table Cells]] elsewhere on this Wiki.
+
'''Download:''' [[media:Kernel_Density_Estimation.ana|Kernel Density Estimation.ana]]
 
 
'''Keywords:''' Edit table, Choice menu, pulldown menu, checkbox, Power plants.
 
  
'''Download:''' [[Media:California_Power_Plants.ANA|California Power Plants.ana ]]
+
=== Output and Input Columns in Same Table ===
  
----
+
:[[image:Output and input columns.png]]
  
== Dependency Tracker Module ==
+
'''Description:''' Presents an input table to a user, where one column is populated with computed output data, the other column with checkboxes for the user to select.  Although the '''Output Data''' column isn't read only, as would be desired, a [[Check Attribute]] has been configured to complain if he does try to change values in that column.  The model that uses these inputs would ignore any changes he makes to data in the '''Output Data''' column.
  
:[[image:Dependency tracker.jpg]]
+
Populating the '''Output Data''' column requires the user to press a button, which runs a button script to populate that column.  This button is presented on the top-level panel.  If you change the input value, the output data will change, and then the button needs to be pressed to refresh the output data column.
  
'''Description:''' This module tracks dependencies through your model, updating the visual appearance of nodes so that you can quickly visualize the paths by which one variable influences another.  You can also use it to provide a visual indication of which nodes are downstream (or upstream) from an indicated variable.
+
'''Keywords:''' Data analysis
  
The module contains button scripts that change the bevel appearance of nodes in your model. To see how Variable <code>X</code> influences Variable <code>Y</code>, the script will bevel the nodes for all variables that are influenced by <code>X</code> and influence <code>Y</code>.  Alternatively, you can bevel all nodes that are influenced by <code>X</code>, or you can bevel all nodes that influence <code>Y</code>.
+
'''Author:''' D. Rice, Lumina Decision Systems
  
In the image above, the path from <code>dp_ex_2</code> through <code>dp_ex_4</code> has been highlighted using the bevel style of the nodes. (The result of pressing the "Bevel all from Ancestor to Descendant" button)
+
'''Download:''' [[media:Output and input columns.ana|Output and input columns.ana]]
  
'''Keywords:''' Dependency analysis
+
==Decision Analysis==
  
'''Download:''' [[media:Dependency_Tracker.ANA | Dependency Tracker.ana]]
+
=== Plane Catching Decision with Expected Value of Including Uncertainty ===
  
----
+
'''Description:''' A simple model to assess what time I should leave my home to catch a plane, with uncertain driving time, walking from parking to gate (including security), and how long I need to be at the gate ahead of scheduled departure time. It uses a loss model based on minutes, assuming I value each extra minute snoozing in bed and set the loss if I miss the plane to 400 of those minutes.
  
== Total Allowable Harvest ==
+
It illustrates the EVIU (expected value of including uncertainty) i.e. the difference in expected value if I make a decision to minimize expected loss instead of decision to minimize time ignoring uncertainty (assuming each distribution is fixed at its mid value). For more details see "The Value of Knowing How Little You Know", Max Henrion, PhD Dissertation, Carnegie Mellon University, 1982.
  
'''Description:''' The problem applies to any population of fish or animal whose dynamics are poorly known but can be summarized in a simple model:
+
'''Keywords''': Decision theory, decision analysis, uncertainty, Monte Carlo simulation, value of information, EVPI, EVIU.
  
:<code>N_t + 1 = N_t*Lambda - landed catch*(1 + loss rate)</code>
+
'''Author:''' Max Henrion
  
where «N_t» is the population size (number of individuals) at time ''t'', «N_t+1» is the population size at time ''t + 1'', «Lambda» is the intrinsic rate of increase and the «loss rate» is the percentage of fish or animals killed but not retrieved relative to the «landed catch», or catch secured.
+
'''Download:''' [[media:Plane catching decision with EVIU.ana|Plane catching decision with EVIU.ana]]
  
The question here is to determine how many fish or animals can be caught (landed) annually so that the probability of the population declining X%  in Y years (decline threshold) is less than Z% (risk tolerance). 
+
=== Marginal Analysis for Control of SO<sub>2</sub> emissions ===
  
Two models are available for downloadOne uses the Optimizer ([[NlpDefine]]) to find the maximum landed catch at the risk tolerance level for the given decline threshold. The other (for those using a version of Analytica without Optimizer) uses [[StepInterp]] in an iterative way to get that maximum landed catch.  
+
'''Description:''' Acid rain in eastern US and Canada caused by sulfur dioxide is emitted primarily by coal-burning electric-generating plants in the Midwestern U.SThis model demonstrates a marginal analysis a.k.a. benefit/cost analysis to determine the policy alternative that leads us to the most economically efficient level of cleanup.
  
'''Keywords:''' Population analysis, dynamic models, optimization analysis
+
'''Keywords:''' Environmental engineering, cost-benefit analysis, marginal analysis  
  
'''Author:''' Models contributed by Pierre Richard
+
'''Author:''' Surya Swamy
  
'''Download:'''
+
'''Download:''' [[media:Marginal Analysis for Control of SO2 Emissions.ana|Marginal Analysis for Control of SO2 Emissions.ana]]
* [[media:Total Allowable Removal model with Optimizer.ana | Total Allowable w Optimizer.ana]]
 
* [[media:Total Allowable Removal model w StepInterp.ana|Total Allowable w StepInterp.ana]]
 
  
----
+
==Dynamic Models==
  
== Earthquake Expenses ==
+
=== Donor/Presenter Dashboard ===
  
'''Description:''' An example of risk analysis with time-dependence and costs shifted over time.
+
'''Description:''' This model implements a continuous-time Markov chain in Analytica's discrete-time dynamic simulation environment.  It supports immigration to, and emigration from, every node.
  
Certain organizations (insurance companies, large companies, governments) incur expenses following earthquakes.  This simplified demo model can be used to answer questions such as:
+
It can be used by an arts organization to probabilistically forecast future audience evolution, in both the short and the long (steady state) term.  It also allows for uncertainty in the input parameters.
* What is the probability of more than one quake in a specific 10 year period.
 
* What is the probability that in my time window my costs exceed $X?
 
  
Assumptions in this model: 
+
'''Keywords:''' Dynamic models, Markov processes
* Earthquakes are Poisson events with mean rate of once every 10 years.
 
* Damage caused by such quake is lognormally distributed, with mean $10M adn stddev of $6M.
 
* Cost of damage gets incurred over the period of a year from the date of the quake as equipment is replaced and buildings are repaired over time:  20% in 1st quarter after quake, 50% in 2nd quarter, 20% in 3rd quarter, 10% in 4th quarter.
 
 
 
'''Keywords:''' Risk analysis, cost analysis
 
 
 
'''Download''': [[media:Earthquake expenses.ana|Earthquake expenses.ana]]
 
  
----
+
'''Download:''' [[Media:Donor_Presenter_Dashboard_II.ANA|Donor-Presenter Dashboard.ana]]
  
== Regulation of Photosynthesis ==
+
=== Regulation of Photosynthesis ===
  
 
:[[image:Photosynthesis fluorescence.jpg]]
 
:[[image:Photosynthesis fluorescence.jpg]]
  
A model of how photosynthesis is regulated inside a cyanobacteria.  As light exposure varies over time (and you can experiment with various light intensity waveforms), it simulates the concentration levels of key transport molecules along the chain, through the PSII complex, plasto-quinone pool, PSI complex, down to metabolic oxidation.  The dynamic response to light levels, or changes in light levels, over time becomes evident, and the impact of changes to metabolic demand can also be observed.  In the graph of fluorescence above, we can see an indicator of how much energy is being absorbed, in three different cases (different light intensities).  In the two higher intensity cases, photoinhibition is observed -- a protective mechanism of the cell that engages when more energy is coming in than can be utilized by the cell.  Excess incoming energy, in the absense of photoinhibition, causes damage, particularly to the PSII complex.
+
A model of how photosynthesis is regulated inside a cyanobacteria.  As light exposure varies over time (and you can experiment with various light intensity waveforms), it simulates the concentration levels of key transport molecules along the chain, through the PSII complex, plasto-quinone pool, PSI complex, down to metabolic oxidation.  The dynamic response to light levels, or changes in light levels, over time becomes evident, and the impact of changes to metabolic demand can also be observed.  In the graph of fluorescence above, we can see an indicator of how much energy is being absorbed, in three different cases (different light intensities).  In the two higher intensity cases, photoinhibition is observed -- a protective mechanism of the cell that engages when more energy is coming in than can be utilized by the cell.  Excess incoming energy, in the absence of photoinhibition, causes damage, particularly to the PSII complex.
  
 
This model uses node shapes for a different purpose than is normally seen in decision analysis models.  In this model, ovals, instead of depicting chance variables, depict chemical reactions, where the value depicts the reaction rate, and rounded rectangles depict chemical concentrations.
 
This model uses node shapes for a different purpose than is normally seen in decision analysis models.  In this model, ovals, instead of depicting chance variables, depict chemical reactions, where the value depicts the reaction rate, and rounded rectangles depict chemical concentrations.
Line 285: Line 214:
 
* [[media:Photosystem.ana | Photosystem.ana]] - rough sketch of genetic regulation.
 
* [[media:Photosystem.ana | Photosystem.ana]] - rough sketch of genetic regulation.
  
----
+
=== Time-series re-indexing ===
  
== Cross-Validation / Fitting Kernel Functions to Data ==
+
:[[image:Weekly_data_graph_ex.png]]
  
:[[image:Cross-validated data fit.jpg]]
+
'''Description:''' This model contains some examples of time-series re-indexing.  It is intended to demonstrate some of these basic techniques.
  
'''Description:''' When fitting a function to data, if you have too many free parameters relative to the number of points in your data set, you may "overfit" the data.  When this happens, the fit to your training data may be very good, but the fit to new data points (beyond those used for training) may be very poor.
+
In this example, actual measurements were collected at non-uniform time increments.  Before analyzing these, we map these to a uniformly spaced time index (<code>Week</code>), occurring on Monday of each week.  The mapping is done using an interpolation.  The evenly-spaced data is then used to forecast future behavior.  We first forecast over an index containing only future time points (<code>Future_weeks</code>), using a log-normal process model based on the historical weekly change.  We then combine the historical data with the forecast on a common index (<code>Week</code>)A prob-bands graph of the weekly_data result shows the range of uncertainty projected by the process model (you'll notice the uncertainty exists only for future forecasted values, not historical ones).
  
Cross-validation is a common technique to deal with this problem.  With this technique, we set aside a fraction of the available data as a cross-validation set.  Then we begin by fitting very simple functions to the data (with very few free parameters), successively increasing the number of free parameters, and seeing how the predictive performance changes on the cross-validation set.  It is typical to see improvement on the cross-validation set for a while, followed by a deterioration of predictive performance on the cross-validation set once overfitting starts occurring. 
+
'''Keywords:''' Dynamic models, forecasting, time-series re-indexing
  
This example model successively fits a non-linear kernel function to the residual error, and uses cross-validation to determine how many kernel functions should be used.
+
'''Author:''' Lonnie Chrisman
  
Requires Analytica Optimizer: The kernel fitting function (Kern_Fit) uses [[NlpDefine]].
+
'''Download:''' [[media:Time-series-reindexing.ana|Time-series-reindexing.ana]]
 
 
'''Keywords:''' Cross-validation, overfitting, non-linear kernel functions
 
  
'''Author:''' Lonnie Chrisman
+
==Engineering Examples==
  
'''Download:''' [[media:Cross-validation example.ana|Cross-validation example.ana]]
+
=== Timber Post Compression Load Capacity ===
  
----
+
'''Description:''' Here is a calculator for computing the maximum load that can be handled by a Douglas Fir - Larch post of a given size, grade, and composition in a construction setting.
  
== Statistical Bootstrapping ==
+
'''Keywords:'''
  
'''Description:''' Bootstrapping is a technique from statistics for estimating the sampling error present in a statistical estimator.  The simplest version estimates sampling error by resampling the original data.  This model demonstrates how this is accomplished in Analytica.
+
'''Author:''' Lonnie Chrisman
  
'''Keywords:''' Bootstrapping, sampling error, re-sampling
+
'''Download:''' [[Media:PostCompression.ana|Post Compression Model]]
 
 
'''Download:''' [[media:Bootstrapping.ana|Bootstrapping.ana]]
 
----
 
  
 
== Compression Post Load Calculator ==
 
== Compression Post Load Calculator ==
Line 326: Line 250:
 
'''Download:''' [[media:Compression_Post_Load_Capacity.ana|Compression Post Load Capacity.ana]]
 
'''Download:''' [[media:Compression_Post_Load_Capacity.ana|Compression Post Load Capacity.ana]]
  
----
+
=== Daylighting Options in Building Design ===
 
 
== Daylighting Options in Building Design ==
 
  
 
:[[File:Chapter_9.7-updated.png]]
 
:[[File:Chapter_9.7-updated.png]]
Line 342: Line 264:
 
'''Download:''' [[media:Daylighting analyzer.ana|Daylighting analyzer.ana]]
 
'''Download:''' [[media:Daylighting analyzer.ana|Daylighting analyzer.ana]]
  
----
+
=== California Power Plants ===
  
== Plane Catching Decision with Expected Value of Including Uncertainty ==
+
'''Description:''' An example showing how to use Choice menus and Checkbox inside an Edit table. It also shows how to use the Cell default attribute to specify default values (including Choice menu and Checkbox with default selections) specified in "Default Plant Data" to be used when user creates a new row in the Edit table.  This model shows how to demonstrates the use of [[Choice|choice pulldowns]] in edit tables.  The model is created during a mini-tutorial on [[Inserting Choice Controls in Edit Table Cells]] elsewhere on this Wiki.
 +
 
 +
'''Keywords:''' Edit table, Choice menu, pulldown menu, checkbox, Power plants.
 +
 
 +
'''Download:''' [[Media:California_Power_Plants.ANA|California Power Plants.ana ]]
 +
 
 +
=== Electrical Generation and Transmission ===
  
'''Description:''' A simple model to assess what time I should leave my home to catch a plane, with uncertain driving time, walking from parking to gate (including security), and how long I need to be at the gate ahead of scheduled departure time. It uses a loss model based on minutes, assuming I value each extra minute snoozing in bed and set the loss if I miss the plane to 400 of those minutes.
+
'''Description:''' This model of an electrical network minimizes total cost of generation and transmission.  Each node in the network has power generators and consumers (demand).  Nodes are connected by transmission links. Each link has a maximum capacity in Watts and an admittance (the real part of impedance is assumed to be zero).  Each generator has a min and max power and a marginal cost in $/KWh. The model uses a linear program to determine how much power each generator should produce so as to minimize total cost of generation and transmission, while satisfying demand and remaining within link constraints.
 +
 
 +
''Requires Analytica Optimizer''
 +
 
 +
'''Keywords:''' Electrical engineering, power generation and transmission
  
It illustrates the EVIU (expected value of including uncertainty) i.e. the difference in expected value if I make a decision to minimize expected loss instead of decision to minimize time ignoring uncertainty (assuming each distribution is fixed at its mid value). For more details see "The  Value of Knowing How Little You Know", Max Henrion, PhD Dissertation, Carnegie Mellon University, 1982.
+
'''Author:''' Lonnie Chrisman
  
'''Keywords''': Decision theory, decision analysis, uncertainty, Monte Carlo simulation, value of information, EVPI, EVIU.
+
'''Download:''' [[media:Electrical Transmission.ana|Electrical Transmission.ana]]
  
'''Author:''' Max Henrion
+
==Fun and Games==
  
'''Download:''' [[media:Plane catching decision with EVIU.ana]]
+
=== Color Map ===
----
 
  
== Marginal Analysis for Control of SO<sub>2</sub> emissions ==
+
:[[File:Color_map.gif]]
  
'''Description:''' Acid rain in eastern US and Canada caused by sulfur dioxide is emitted primarily by coal-burning electric-generating plants in the Midwestern U.S.  This model demonstrates a marginal analysis a.k.a. benefit/cost analysis to determine the policy alternative that leads us to the most economically efficient level of cleanup.
+
'''Description:''' A model which highlights [[Cell Format Expression|Cell Formatting]] and [[Computed cell formats|Computed Cell Formats]]. Model result is a 'color map' wherein the cell fill color is computed based on three input variables (R, G, and B), the computed color is displayed in hexadecimal, and the font color of the hexadecimal color is determined by the cell fill color.
  
'''Keywords:''' Environmental engineering, cost-benefit analysis, marginal analysis
+
'''Keywords:''' Computed cell formatting
  
'''Author:''' Surya Swamy
+
'''Author:''' Kimberley Mullins, Lumina Decision Systems
  
'''Download:''' [[media:Marginal Analysis for Control of SO2 Emissions.ana|Marginal Analysis for Control of SO2 Emissions.ana]]
+
'''Download:''' [[media:color_map.ana|Color map.ana]]
  
----
+
==Function Examples==
  
== Electrical Generation and Transmission ==
+
=== Transforming Dimensions by transform matrix, month to quarter ===
  
'''Description:''' This model of an electrical network minimizes total cost of generation and transmission.  Each node in the network has power generators and consumers (demand). Nodes are connected by transmission links. Each link has a maximum capacity in Watts and an admittance (the real part of impedance is assumed to be zero).  Each generator has a min and max power and a marginal cost in $/KWh. The model uses a linear program to determine how much power each generator should produce so as to minimize total cost of generation and transmission, while satisfying demand and remaining within link constraints.
+
'''Description:''' The model shows how to transform an array from a finer-grain index (e.g., Month) onto a coarser index (e.g., Quarter).  We generally refer to this as [[Aggregate|aggregation]].   The model illustrates the direct use of [[Aggregate]], as well as a method to do this used before Aggregate was added to Analytica in release 4.2.
  
''Requires Analytica Optimizer''
+
'''Webinar:''' [[Analytica_User_Group/Past_Topics#The_Aggregate_Function|the Aggregate function]].
  
'''Keywords:''' Electrical engineering, power generation and transmission
+
'''Keywords''': Aggregation, level of detail, days, weeks, months, quarters, years.
  
 
'''Author:''' Lonnie Chrisman
 
'''Author:''' Lonnie Chrisman
  
'''Download:''' [[media:Electrical Transmission.ana|Electrical Transmission.ana]]
+
'''Download:''' [[Media:Month to quarter.ana|Month to quarter.ana]]
 +
 
 +
=== Convolution ===
  
----
+
'''Description:''' Convolution is used mostly for signal and systems analysis. It is a way to combine two time series.  This model contains function Convolve(Y, Z, T, I), that computes the convolution of two time series.  The model contains several examples of convolved functions.
  
== Loan Policy Selection ==
+
A time series is a set of points, <code>(Y, T)</code>, where <code>T</code> is the ascending X-axis, and the set of points is indexed by <code>I</code>. The values of <code>T</code> do not have to be equally spaced. The function treats <code>Y</code> and <code>Z</code> as being equal to 0 outside the range of <code>T</code>. The two time series here are the set of points <code>(Y, T)</code> and the set of points <code>(Z, T)</code>, where both sets of points are indexed by <code>I</code>.
  
'''Description:''' A lender has a large pool of money to loan, but needs to decide what credit rating threshold to require and what interest rate (above prime) to charge.  The optimal value is determined by market forces (competing lenders) and by the probability that the borrower defaults on the loan, which is a function of the economy and borrower's credit rating.  The model can be used without the Analytica optimizer, in which case you can explore the decision space manually or use a parametric analysis to find the near optimal solution.  Those with Analytica Optimizer can find the optimal solution (more quickly) using an [[NlpDefine|NLP]] search.
+
The mathematical definition of the convolution of two time series is the function given by:
  
'''Best used with Analytica Optimizer'''
+
:<math>h(t) = \int y(u) z(t-u) dt</math>
  
'''Keywords:''' Creditworthiness, credit rating, default risk, risk analysis
+
'''Keywords:''' Signal analysis, systems analysis
  
 
'''Author:''' Lonnie Chrisman
 
'''Author:''' Lonnie Chrisman
  
'''Download:''' [[media:Loan policy selection.ANA|Loan policy selection.ANA]]
+
'''Download''': [[Media:Convolution.ana|Convolution.ana]]
  
----
+
=== Dependency Tracker Module ===
  
== Time-series re-indexing ==
+
:[[image:Dependency tracker.jpg]]
  
:[[image:Weekly_data_graph_ex.png]]
+
'''Description:''' This module tracks dependencies through your model, updating the visual appearance of nodes so that you can quickly visualize the paths by which one variable influences another.  You can also use it to provide a visual indication of which nodes are downstream (or upstream) from an indicated variable.
  
'''Description:''' This model contains some examples of time-series re-indexingIt is intended to demonstrate some of these basic techniques.
+
The module contains button scripts that change the bevel appearance of nodes in your modelTo see how Variable <code>X</code> influences Variable <code>Y</code>, the script will bevel the nodes for all variables that are influenced by <code>X</code> and influence <code>Y</code>.  Alternatively, you can bevel all nodes that are influenced by <code>X</code>, or you can bevel all nodes that influence <code>Y</code>.
  
In this example, actual measurements were collected at non-uniform time increments.  Before analyzing these, we map these to a uniformly spaced time index (<code>Week</code>), occurring on Monday of each week.  The mapping is done using an interpolation.  The evenly-spaced data is then used to forecast future behavior.  We first forecast over an index containing only future time points (<code>Future_weeks</code>), using a log-normal process model based on the historical weekly changeWe then combine the historical data with the forecast on a common index (<code>Week</code>).  A prob-bands graph of the weekly_data result shows the range of uncertainty projected by the process model (you'll notice the uncertainty exists only for future forecasted values, not historical ones).
+
In the image above, the path from <code>dp_ex_2</code> through <code>dp_ex_4</code> has been highlighted using the bevel style of the nodes.  (The result of pressing the "Bevel all from Ancestor to Descendant" button)
  
'''Keywords:''' Dynamic models, forecasting, time-series re-indexing
+
'''Keywords:''' Dependency analysis
  
'''Author:''' Lonnie Chrisman
+
'''Download:''' [[media:Dependency_Tracker.ANA | Dependency Tracker.ana]]
 
 
'''Download:''' [[media:Time-series-reindexing.ana|Time-series-reindexing.ana]]
 
  
----
+
=== Multi-lingual Influence Diagram ===
 
 
== Multi-lingual Influence Diagram ==
 
  
 
:{| border="0"
 
:{| border="0"
Line 430: Line 359:
 
'''Download:''' [[media:French-English.ana|French-English.ana]]
 
'''Download:''' [[media:French-English.ana|French-English.ana]]
  
----
+
=== Extracting Data from an XML file ===
 +
 
 +
'''Description:''' Suppose you receive data in an XML format that you want to read into your model. This example demonstrates two methods for extracting data: Using a full XML DOM parser, or using regular expressions. The first method fully parses the XML structure, the second simply finds the data of interest by matching patterns, which can be easier for very simple data structures (as is often the case).
 +
 
 +
'''Keywords:''' Data extraction, xml, DOM parsing
  
== Smooth PDF plots using Kernel Density Estimation ==
+
'''Author:''' D. Rice, Lumina Decision Systems
  
:{| border="0"
+
'''Download:''' [[media:Parsing XML example.ana|Parsing XML example.ana]]
| [[image:Dens_Est_builtin_pdf.png|frame|Analytica's built-in PDF plot with default settings]]  
+
 
|
+
=== Vector Math ===
[[image:Dens_Est_Kernel_pdf.png|frame|PDF computed from Kernel Density estimation]]
 
|}
 
  
'''Description:''' This example demonstrates a very simple fixed-width kernel density estimator to estimate a "smooth" probability density.   The built-in PDF function in Analytica often has a choppy appearance due to the nature of histogramming -- it sets up a set of bins and counts how many points land in each bin.  A kernel density estimator smooths this out, producing a less choppy PDF plot.
+
'''Description:'''
 +
Functions used for computing geospatial coordinates and distances. Includes:
 +
* A cross product of vectors function
 +
* Functions to conversion between spherical and Cartesian coordinates in 3-D
 +
* Functions to compute bearings from one latitude-longitude point to another
 +
* Functions for finding distance between two latitude-longitude points along the great circle.
 +
* Functions for finding the intersection of two great circles
  
This smoothing is built into [[Analytica 4.4]].  You can select [[Kernel Density Smoothing|smoothing]] from the [[Uncertainty Setup dialog]].
+
'''Keywords:''' Geospatial analysis, GIS, vector analyisis
  
'''Keywords:''' Kernel density estimation, kernel density smoothing
+
'''Author:''' Robert D. Brown III, Incite Decision Technologies, LLC
  
'''Author:''' D. Rice, Lumina Decision Systems
+
'''Download:''' [[media:Vector Math.ana|Vector Math.ana]]
  
'''Download:''' [[media:Kernel_Density_Estimation.ana|Kernel Density Estimation.ana]]
+
==Optimizer Examples==
  
----
+
=== Total Allowable Harvest  ===
  
== Output and Input Columns in Same Table ==
+
'''Description:''' The problem applies to any population of fish or animal whose dynamics are poorly known but can be summarized in a simple model:
  
:[[image:Output and input columns.png]]
+
:<code>N_t + 1 = N_t*Lambda - landed catch*(1 + loss rate)</code>
  
'''Description:''' Presents an input table to a user, where one column is populated with computed output data, the other column with checkboxes for the user to select.  Although the '''Output Data''' column isn't read only, as would be desired, a [[Check Attribute]] has been configured to complain if he does try to change values in that column.  The model that uses these inputs would ignore any changes he makes to data in the '''Output Data''' column.
+
where «N_t» is the population size (number of individuals) at time ''t'', «N_t+1» is the population size at time ''t + 1'', «Lambda» is the intrinsic rate of increase and the «loss rate» is the percentage of fish or animals killed but not retrieved relative to the «landed catch», or catch secured.
  
Populating the '''Output Data''' column requires the user to press a button, which runs a button script to populate that column. This button is presented on the top-level panelIf you change the input value, the output data will change, and then the button needs to be pressed to refresh the output data column.
+
The question here is to determine how many fish or animals can be caught (landed) annually so that the probability of the population declining X% in Y years (decline threshold) is less than Z% (risk tolerance).   
  
'''Keywords:''' Data analysis
+
Two models are available for download.  One uses the Optimizer ([[NlpDefine]]) to find the maximum landed catch at the risk tolerance level for the given decline threshold. The other (for those using a version of Analytica without Optimizer) uses [[StepInterp]] in an iterative way to get that maximum landed catch.   
  
'''Author:''' D. Rice, Lumina Decision Systems
+
'''Keywords:''' Population analysis, dynamic models, optimization analysis
  
'''Download:''' [[media:Output and input columns.ana|Output and input columns.ana]]
+
'''Author:''' Models contributed by Pierre Richard
  
----
+
'''Download:'''
 +
* [[media:Total Allowable Removal model with Optimizer.ana | Total Allowable w Optimizer.ana]]
 +
* [[media:Total Allowable Removal model w StepInterp.ana|Total Allowable w StepInterp.ana]]
  
== Linearizing a discrete NSP ==
+
=== Linearizing a discrete NSP ===
  
 
'''Description:''' A cereal formulation model
 
'''Description:''' A cereal formulation model
Line 482: Line 421:
 
'''Download:''' [[media:Cereal Formulation1.ana|Cereal Formulation1.ana]]
 
'''Download:''' [[media:Cereal Formulation1.ana|Cereal Formulation1.ana]]
  
----
+
=== Neural Network ===
 
 
== Neural Network ==
 
  
 
'''Description:''' A feed-forward neural network can be trained (fit to training data) using the Analytica Optimizer.  This is essentially an example of non-linear regression.  This model contains four sample data sets, and is set up to train a 2-layer feedforward sigmoid network to "learn" the concept represented by the data set(s), and then test how well it does across examples not appearing in the training set.
 
'''Description:''' A feed-forward neural network can be trained (fit to training data) using the Analytica Optimizer.  This is essentially an example of non-linear regression.  This model contains four sample data sets, and is set up to train a 2-layer feedforward sigmoid network to "learn" the concept represented by the data set(s), and then test how well it does across examples not appearing in the training set.
Line 494: Line 431:
 
'''Author:''' Lonnie Chrisman, Lumina Decision Systems
 
'''Author:''' Lonnie Chrisman, Lumina Decision Systems
  
'''Download:''' [[media:Neural-Network.ana|Neural-Network.ana]]
+
'''Download:''' [[media:Neural-Network.ana|Neural Network.ana]]
  
----
+
==Risk Analysis==
  
== Extracting Data from an XML file ==
+
=== Earthquake Expenses ===
  
'''Description:''' Suppose you receive data in an XML format that you want to read into your model. This example demonstrates two methods for extracting data: Using a full XML DOM parser, or using regular expressions. The first method fully parses the XML structure, the second simply finds the data of interest by matching patterns, which can be easier for very simple data structures (as is often the case).
+
'''Description:''' An example of risk analysis with time-dependence and costs shifted over time.
  
'''Keywords:''' Data extraction, xml, DOM parsing
+
Certain organizations (insurance companies, large companies, governments) incur expenses following earthquakes.  This simplified demo model can be used to answer questions such as:
 +
* What is the probability of more than one quake in a specific 10 year period.
 +
* What is the probability that in my time window my costs exceed $X?
  
'''Author:''' D. Rice, Lumina Decision Systems
+
Assumptions in this model:
 +
* Earthquakes are Poisson events with mean rate of once every 10 years.
 +
* Damage caused by such quake is lognormally distributed, with mean $10M adn stddev of $6M.
 +
* Cost of damage gets incurred over the period of a year from the date of the quake as equipment is replaced and buildings are repaired over time:  20% in 1st quarter after quake, 50% in 2nd quarter, 20% in 3rd quarter, 10% in 4th quarter.
  
'''Download:''' [[media:Parsing XML example.ana|Parsing XML example.ana]]
+
'''Keywords:''' Risk analysis, cost analysis
  
----
+
'''Download''': [[media:Earthquake expenses.ana|Earthquake expenses.ana]]
  
== Vector Math ==
+
=== Loan Policy Selection ===
  
'''Description:'''
+
'''Description:''' A lender has a large pool of money to loan, but needs to decide what credit rating threshold to require and what interest rate (above prime) to charge. The optimal value is determined by market forces (competing lenders) and by the probability that the borrower defaults on the loan, which is a function of the economy and borrower's credit rating.  The model can be used without the Analytica optimizer, in which case you can explore the decision space manually or use a parametric analysis to find the near optimal solution. Those with Analytica Optimizer can find the optimal solution (more quickly) using an [[NlpDefine|NLP]] search.
Functions used for computing geospatial coordinates and distances. Includes:
 
* A cross product of vectors function
 
* Functions to conversion between spherical and Cartesian coordinates in 3-D
 
* Functions to compute bearings from one latitude-longitude point to another
 
* Functions for finding distance between two latitude-longitude points along the great circle.
 
* Functions for finding the intersection of two great circles
 
  
'''Keywords:''' Geospatial analysis, GIS, vector analyisis
+
'''Best used with Analytica Optimizer'''
  
'''Author:''' Robert D. Brown III, Incite Decision Technologies, LLC
+
'''Keywords:''' Creditworthiness, credit rating, default risk, risk analysis
  
'''Download:''' [[media:Vector Math.ana|Vector Math.ana]]
+
'''Author:''' Lonnie Chrisman
 
 
----
 
 
 
== Color Map ==
 
 
 
:[[File:Color_map.gif]]
 
 
 
'''Description:''' A model which highlights [[Cell Format Expression|Cell Formatting]] and [[Computed cell formats|Computed Cell Formats]]. Model result is a 'color map' wherein the cell fill color is computed based on three input variables (R, G, and B), the computed color is displayed in hexadecimal, and the font color of the hexadecimal color is determined by the cell fill color.
 
 
 
'''Keywords:''' Computed cell formatting
 
 
 
'''Author:''' Kimberley Mullins, Lumina Decision Systems
 
 
 
'''Download:''' [[media:color_map.ana|Color map.ana]]
 
 
 
----
 
== Steel and Aluminum import tariff impact on US trade deficit ==
 
 
 
<center>[[Image:Steel and aluminum tariff model diagram.png|400px]]</center>
 
 
 
'''Description:''' On 2-March-2018, President Trump proposed new import tariffs on steel and aluminum. It seems as if the projected net impacts of these tariffs on the total US trade deficit and US economy depends largely on which news outlets you get your news from. We thought it would be helpful to put together a simple and easy to understand model to estimate of the net impact of these tariffs on the US trade deficit, assuming that no other factors change (e.g., no retaliatory tariffs are enacted by other countries). We wanted something that allows you to understand how its estimates are being derived, with assumptions that can be easily replaced with your own, so that the model itself would be impartial to any particular viewpoint. We want the uncertainties that are inherent in such a simple model to be explicit, so you can see the range of possibilities and not just a single guess. Finally, we wanted the model to be easy to understand fully for non-economists (a group to which we belong, too).
 
  
This model accompanied a current event blog post on the Lumina blog: [http://lumina.com/blog/impact-of-trumps-proposed-steel-aluminum-tariffs-on-us-trade-deficit Impact of Trump’s proposed Steel & Aluminum tariffs on US trade deficit]
+
'''Download:''' [[media:Loan policy selection.ANA|Loan policy selection.ana]]
 
 
'''Authors:''' Kimberly Mullins and Lonnie Chrisman, Lumina Decision Systems
 
 
 
'''Download:''' [[Media:Steel and aluminum tariff model.ana|Steel and aluminum tariff model.ana]]
 
  
 
==See Also==
 
==See Also==

Revision as of 23:02, 14 March 2018


You may find these example Analytica models useful to see what Analytica can do, and as inspiration or a starting point for your own models. They cover a wide variety of topics and techniques.

These examples supplement the example models that are installed with Analytica into the Examples folder.

You can are also invited to contribute your own models as examples. For how to do that, see Uploading Example Models.

Business Examples

Marginal Abatement Graph

Marginal abatement heating energy.png

This model, along with the accompanying blog article, show how to set up a Marginal Abatement graph in Analytica.

Keywords: Graph methods, carbon price, energy efficiency, climate policy, optimal allocation, budget constraint.

Author: Lonnie Chrisman

Download: Marginal abatement home heating.ana

Solar Panel Analysis

Solar Panel Analysis.png

Description: Would it be cost effective to install solar panels on the roof of my house? This model explores this question for my situation in San Jose, California. An accompanying video documents the building of this model, and is a good example of the process one goes through when building any decision model.

The model explores how many panels I should install, and what the payoff is in terms of net present value, Internal rate of return and time to recoup cost. It also looks at whether I should postpone the start of the installation to take advantage of rapidly falling PV prices, or cash in on tax credits.

Keywords: Renewable energy, photovoltaics, net present value, internal rate of return, tax credits, agile modeling.

Author: Lonnie Chrisman

Download: Solar Panel Analysis.ana

Items within Budget function

Description: Given a set of items, with a priority and a cost for each, the function Items_within_budget function selects out the highest priority items that fit within the fixed budget.

Keywords:

Author: Max Henrion

Download: Items within budget.ana

Grant Exclusion Model

Description: This model tests a hypothesis about the distribution of an attribute of the marginal rejectee of a grant program, given the relevance of that attribute to award of the grant. It could be used by an organization to make decisions as to whether to fiscally-sponsor another organization that will use that fiscal sponsorship to apply for grants, by looking at the effect on the pool of grant recipients overall.

Keywords: Business analysis

Download: Grant exclusion.ana

Project Planner

Project planner model.png

Description: This is a demo model that shows how to:

  • Evaluate a set of R&D projects, including uncertain R&D costs, and uncertain revenues if it leads to release of a commercial product.
  • Use multiattribute analysis to compare projects, including a hard attribute -- expected net present value -- and soft attributes -- strategic fit, staff development, and public good will.
  • Compare cost, NPV, and multiattribute value for a selected portfolio of projects.
  • Generate the best portfolio (ratio of NPV or multiattribute merit to cost) given a R&D budget.

The model linked here is only a test, and to an older version: File:Project priorities 2007 4.0.ANA

Keywords: Business models, cost analysis, net present value (NPV), uncertainty analysis

Download: Project Priorities 5 0.ana

Steel and Aluminum import tariff impact on US trade deficit

Steel and aluminum tariff model diagram.png

Description: On 2-March-2018, President Trump proposed new import tariffs on steel and aluminum. It seems as if the projected net impacts of these tariffs on the total US trade deficit and US economy depends largely on which news outlets you get your news from. We thought it would be helpful to put together a simple and easy to understand model to estimate of the net impact of these tariffs on the US trade deficit, assuming that no other factors change (e.g., no retaliatory tariffs are enacted by other countries). We wanted something that allows you to understand how its estimates are being derived, with assumptions that can be easily replaced with your own, so that the model itself would be impartial to any particular viewpoint. We want the uncertainties that are inherent in such a simple model to be explicit, so you can see the range of possibilities and not just a single guess. Finally, we wanted the model to be easy to understand fully for non-economists (a group to which we belong, too).

This model accompanied a current event blog post on the Lumina blog: Impact of Trump’s proposed Steel & Aluminum tariffs on US trade deficit

Authors: Kimberley Mullins and Lonnie Chrisman, Lumina Decision Systems

Download: Steel and aluminum tariff model.ana

Data Analysis

Sampling from only feasible points

Description: Consider this scenario. You have a bunch of chance variables, each defined by a distribution. They joint sample generated, however, contains some combinations of points that are (for one reason or another) physically impossible. We'll call those infeasible points. You'd like to eliminate those points from the sample and keep only the feasible points.

This module implements a button that will sample a collection of chance variables, then reset the sample size and keep only those sample points that are "feasible".

Obviously, this approach will work best when most of your samples are feasible. If you can handle the "infeasible" points in your model directly, by conditioning certain chance variables on others, that is far preferable. But there are certainly cases where this solution (although a bit of a kludge) is more readily usable.

The instructions for how to use this are in the module description field.

Keywords: Statistics, sampling, Importance sampling, feasibility, Monte Carlo simulation

Author: Lonnie Chrisman

Download: Feasible Sampler.ana

Cross-Validation / Fitting Kernel Functions to Data

Cross-validated data fit.jpg

Description: When fitting a function to data, if you have too many free parameters relative to the number of points in your data set, you may "overfit" the data. When this happens, the fit to your training data may be very good, but the fit to new data points (beyond those used for training) may be very poor.

Cross-validation is a common technique to deal with this problem. With this technique, we set aside a fraction of the available data as a cross-validation set. Then we begin by fitting very simple functions to the data (with very few free parameters), successively increasing the number of free parameters, and seeing how the predictive performance changes on the cross-validation set. It is typical to see improvement on the cross-validation set for a while, followed by a deterioration of predictive performance on the cross-validation set once overfitting starts occurring.

This example model successively fits a non-linear kernel function to the residual error, and uses cross-validation to determine how many kernel functions should be used.

Requires Analytica Optimizer: The kernel fitting function (Kern_Fit) uses NlpDefine.

Keywords: Cross-validation, overfitting, non-linear kernel functions

Author: Lonnie Chrisman

Download: Cross-validation example.ana

Statistical Bootstrapping

Description: Bootstrapping is a technique from statistics for estimating the sampling error present in a statistical estimator. The simplest version estimates sampling error by resampling the original data. This model demonstrates how this is accomplished in Analytica.

Keywords: Bootstrapping, sampling error, re-sampling

Download: Bootstrapping.ana

Smooth PDF plots using Kernel Density Estimation

Analytica's built-in PDF plot with default settings
PDF computed from Kernel Density estimation

Description: This example demonstrates a very simple fixed-width kernel density estimator to estimate a "smooth" probability density. The built-in PDF function in Analytica often has a choppy appearance due to the nature of histogramming -- it sets up a set of bins and counts how many points land in each bin. A kernel density estimator smooths this out, producing a less choppy PDF plot.

This smoothing is built into Analytica 4.4. You can select smoothing from the Uncertainty Setup dialog.

Keywords: Kernel density estimation, kernel density smoothing

Author: D. Rice, Lumina Decision Systems

Download: Kernel Density Estimation.ana

Output and Input Columns in Same Table

Output and input columns.png

Description: Presents an input table to a user, where one column is populated with computed output data, the other column with checkboxes for the user to select. Although the Output Data column isn't read only, as would be desired, a Check Attribute has been configured to complain if he does try to change values in that column. The model that uses these inputs would ignore any changes he makes to data in the Output Data column.

Populating the Output Data column requires the user to press a button, which runs a button script to populate that column. This button is presented on the top-level panel. If you change the input value, the output data will change, and then the button needs to be pressed to refresh the output data column.

Keywords: Data analysis

Author: D. Rice, Lumina Decision Systems

Download: Output and input columns.ana

Decision Analysis

Plane Catching Decision with Expected Value of Including Uncertainty

Description: A simple model to assess what time I should leave my home to catch a plane, with uncertain driving time, walking from parking to gate (including security), and how long I need to be at the gate ahead of scheduled departure time. It uses a loss model based on minutes, assuming I value each extra minute snoozing in bed and set the loss if I miss the plane to 400 of those minutes.

It illustrates the EVIU (expected value of including uncertainty) i.e. the difference in expected value if I make a decision to minimize expected loss instead of decision to minimize time ignoring uncertainty (assuming each distribution is fixed at its mid value). For more details see "The Value of Knowing How Little You Know", Max Henrion, PhD Dissertation, Carnegie Mellon University, 1982.

Keywords: Decision theory, decision analysis, uncertainty, Monte Carlo simulation, value of information, EVPI, EVIU.

Author: Max Henrion

Download: Plane catching decision with EVIU.ana

Marginal Analysis for Control of SO2 emissions

Description: Acid rain in eastern US and Canada caused by sulfur dioxide is emitted primarily by coal-burning electric-generating plants in the Midwestern U.S. This model demonstrates a marginal analysis a.k.a. benefit/cost analysis to determine the policy alternative that leads us to the most economically efficient level of cleanup.

Keywords: Environmental engineering, cost-benefit analysis, marginal analysis

Author: Surya Swamy

Download: Marginal Analysis for Control of SO2 Emissions.ana

Dynamic Models

Donor/Presenter Dashboard

Description: This model implements a continuous-time Markov chain in Analytica's discrete-time dynamic simulation environment. It supports immigration to, and emigration from, every node.

It can be used by an arts organization to probabilistically forecast future audience evolution, in both the short and the long (steady state) term. It also allows for uncertainty in the input parameters.

Keywords: Dynamic models, Markov processes

Download: Donor-Presenter Dashboard.ana

Regulation of Photosynthesis

Photosynthesis fluorescence.jpg

A model of how photosynthesis is regulated inside a cyanobacteria. As light exposure varies over time (and you can experiment with various light intensity waveforms), it simulates the concentration levels of key transport molecules along the chain, through the PSII complex, plasto-quinone pool, PSI complex, down to metabolic oxidation. The dynamic response to light levels, or changes in light levels, over time becomes evident, and the impact of changes to metabolic demand can also be observed. In the graph of fluorescence above, we can see an indicator of how much energy is being absorbed, in three different cases (different light intensities). In the two higher intensity cases, photoinhibition is observed -- a protective mechanism of the cell that engages when more energy is coming in than can be utilized by the cell. Excess incoming energy, in the absence of photoinhibition, causes damage, particularly to the PSII complex.

This model uses node shapes for a different purpose than is normally seen in decision analysis models. In this model, ovals, instead of depicting chance variables, depict chemical reactions, where the value depicts the reaction rate, and rounded rectangles depict chemical concentrations.

Two models are attached. The first is a bit cleaner, and focused on the core transport chain, as described above. The second is less developed, but is focused more on genetic regulation processes.

Keywords: Photosynthesis, dynamic models

Author: Lonnie Chrisman

Download:

Time-series re-indexing

Weekly data graph ex.png

Description: This model contains some examples of time-series re-indexing. It is intended to demonstrate some of these basic techniques.

In this example, actual measurements were collected at non-uniform time increments. Before analyzing these, we map these to a uniformly spaced time index (Week), occurring on Monday of each week. The mapping is done using an interpolation. The evenly-spaced data is then used to forecast future behavior. We first forecast over an index containing only future time points (Future_weeks), using a log-normal process model based on the historical weekly change. We then combine the historical data with the forecast on a common index (Week). A prob-bands graph of the weekly_data result shows the range of uncertainty projected by the process model (you'll notice the uncertainty exists only for future forecasted values, not historical ones).

Keywords: Dynamic models, forecasting, time-series re-indexing

Author: Lonnie Chrisman

Download: Time-series-reindexing.ana

Engineering Examples

Timber Post Compression Load Capacity

Description: Here is a calculator for computing the maximum load that can be handled by a Douglas Fir - Larch post of a given size, grade, and composition in a construction setting.

Keywords:

Author: Lonnie Chrisman

Download: Post Compression Model

Compression Post Load Calculator

Description: Computes the load that a Douglas-Fir Larch post can support in compression. Works for different timber types and grades and post sizes.

Keywords: Compression analysis

Author: Lonnie Chrisman

Download: Compression Post Load Capacity.ana

Daylighting Options in Building Design

Chapter 9.7-updated.png

Description: A demonstration showing how to analyze lifecycle costs and savings from daylighting options in building design.

Analysis based on Nomograph Cost/Benefit Tool for Daylighting. adapted from S.E. Selkowitz and M. Gabel. 1984. "LBL Daylighting Nomographs," LBL-13534, Lawrence Berkeley Laboratory, Berkeley CA, 94704. (510) 486-6845.

Keywords: Engineering, cost-benefits analysis

Author: Max Henrion

Download: Daylighting analyzer.ana

California Power Plants

Description: An example showing how to use Choice menus and Checkbox inside an Edit table. It also shows how to use the Cell default attribute to specify default values (including Choice menu and Checkbox with default selections) specified in "Default Plant Data" to be used when user creates a new row in the Edit table. This model shows how to demonstrates the use of choice pulldowns in edit tables. The model is created during a mini-tutorial on Inserting Choice Controls in Edit Table Cells elsewhere on this Wiki.

Keywords: Edit table, Choice menu, pulldown menu, checkbox, Power plants.

Download: California Power Plants.ana

Electrical Generation and Transmission

Description: This model of an electrical network minimizes total cost of generation and transmission. Each node in the network has power generators and consumers (demand). Nodes are connected by transmission links. Each link has a maximum capacity in Watts and an admittance (the real part of impedance is assumed to be zero). Each generator has a min and max power and a marginal cost in $/KWh. The model uses a linear program to determine how much power each generator should produce so as to minimize total cost of generation and transmission, while satisfying demand and remaining within link constraints.

Requires Analytica Optimizer

Keywords: Electrical engineering, power generation and transmission

Author: Lonnie Chrisman

Download: Electrical Transmission.ana

Fun and Games

Color Map

Color map.gif

Description: A model which highlights Cell Formatting and Computed Cell Formats. Model result is a 'color map' wherein the cell fill color is computed based on three input variables (R, G, and B), the computed color is displayed in hexadecimal, and the font color of the hexadecimal color is determined by the cell fill color.

Keywords: Computed cell formatting

Author: Kimberley Mullins, Lumina Decision Systems

Download: Color map.ana

Function Examples

Transforming Dimensions by transform matrix, month to quarter

Description: The model shows how to transform an array from a finer-grain index (e.g., Month) onto a coarser index (e.g., Quarter). We generally refer to this as aggregation. The model illustrates the direct use of Aggregate, as well as a method to do this used before Aggregate was added to Analytica in release 4.2.

Webinar: the Aggregate function.

Keywords: Aggregation, level of detail, days, weeks, months, quarters, years.

Author: Lonnie Chrisman

Download: Month to quarter.ana

Convolution

Description: Convolution is used mostly for signal and systems analysis. It is a way to combine two time series. This model contains function Convolve(Y, Z, T, I), that computes the convolution of two time series. The model contains several examples of convolved functions.

A time series is a set of points, (Y, T), where T is the ascending X-axis, and the set of points is indexed by I. The values of T do not have to be equally spaced. The function treats Y and Z as being equal to 0 outside the range of T. The two time series here are the set of points (Y, T) and the set of points (Z, T), where both sets of points are indexed by I.

The mathematical definition of the convolution of two time series is the function given by:

[math]\displaystyle{ h(t) = \int y(u) z(t-u) dt }[/math]

Keywords: Signal analysis, systems analysis

Author: Lonnie Chrisman

Download: Convolution.ana

Dependency Tracker Module

Dependency tracker.jpg

Description: This module tracks dependencies through your model, updating the visual appearance of nodes so that you can quickly visualize the paths by which one variable influences another. You can also use it to provide a visual indication of which nodes are downstream (or upstream) from an indicated variable.

The module contains button scripts that change the bevel appearance of nodes in your model. To see how Variable X influences Variable Y, the script will bevel the nodes for all variables that are influenced by X and influence Y. Alternatively, you can bevel all nodes that are influenced by X, or you can bevel all nodes that influence Y.

In the image above, the path from dp_ex_2 through dp_ex_4 has been highlighted using the bevel style of the nodes. (The result of pressing the "Bevel all from Ancestor to Descendant" button)

Keywords: Dependency analysis

Download: Dependency Tracker.ana

Multi-lingual Influence Diagram

English-view.png French-view.png

Description: Maintains a single influence diagram with Title and Description attributes in both English and French. With the change of a pull-down, the influence diagram and all object descriptions are instantly reflected in the language of choice.

If you change a title or description while viewing English, and then change to French, the change you made will become the English-language version of the description. Similarly if you make a change while viewing French.

Keywords: Multi-lingual models

Author: D. Rice, Lumina Decision Systems

Download: French-English.ana

Extracting Data from an XML file

Description: Suppose you receive data in an XML format that you want to read into your model. This example demonstrates two methods for extracting data: Using a full XML DOM parser, or using regular expressions. The first method fully parses the XML structure, the second simply finds the data of interest by matching patterns, which can be easier for very simple data structures (as is often the case).

Keywords: Data extraction, xml, DOM parsing

Author: D. Rice, Lumina Decision Systems

Download: Parsing XML example.ana

Vector Math

Description: Functions used for computing geospatial coordinates and distances. Includes:

  • A cross product of vectors function
  • Functions to conversion between spherical and Cartesian coordinates in 3-D
  • Functions to compute bearings from one latitude-longitude point to another
  • Functions for finding distance between two latitude-longitude points along the great circle.
  • Functions for finding the intersection of two great circles

Keywords: Geospatial analysis, GIS, vector analyisis

Author: Robert D. Brown III, Incite Decision Technologies, LLC

Download: Vector Math.ana

Optimizer Examples

Total Allowable Harvest

Description: The problem applies to any population of fish or animal whose dynamics are poorly known but can be summarized in a simple model:

N_t + 1 = N_t*Lambda - landed catch*(1 + loss rate)

where «N_t» is the population size (number of individuals) at time t, «N_t+1» is the population size at time t + 1, «Lambda» is the intrinsic rate of increase and the «loss rate» is the percentage of fish or animals killed but not retrieved relative to the «landed catch», or catch secured.

The question here is to determine how many fish or animals can be caught (landed) annually so that the probability of the population declining X% in Y years (decline threshold) is less than Z% (risk tolerance).

Two models are available for download. One uses the Optimizer (NlpDefine) to find the maximum landed catch at the risk tolerance level for the given decline threshold. The other (for those using a version of Analytica without Optimizer) uses StepInterp in an iterative way to get that maximum landed catch.

Keywords: Population analysis, dynamic models, optimization analysis

Author: Models contributed by Pierre Richard

Download:

Linearizing a discrete NSP

Description: A cereal formulation model

A discrete mixed integer model that chooses product formulations to minimize total ingredient costs. This could be an NSP but it uses two methods to linearize: 1) Decision variable is constructed as a constrained Boolean array 2) Prices are defined as piecewise linear curves

Keywords: product formulation, cereal formulation

Author: P. Sanford, Lumina Decision Systems

Download: Cereal Formulation1.ana

Neural Network

Description: A feed-forward neural network can be trained (fit to training data) using the Analytica Optimizer. This is essentially an example of non-linear regression. This model contains four sample data sets, and is set up to train a 2-layer feedforward sigmoid network to "learn" the concept represented by the data set(s), and then test how well it does across examples not appearing in the training set.

Developed during the Analytica User Group Webinar of 21-Apr-2011 -- see the webinar recording.

Keywords: Feed-forward neural networks, optimization analysis

Author: Lonnie Chrisman, Lumina Decision Systems

Download: Neural Network.ana

Risk Analysis

Earthquake Expenses

Description: An example of risk analysis with time-dependence and costs shifted over time.

Certain organizations (insurance companies, large companies, governments) incur expenses following earthquakes. This simplified demo model can be used to answer questions such as:

  • What is the probability of more than one quake in a specific 10 year period.
  • What is the probability that in my time window my costs exceed $X?

Assumptions in this model:

  • Earthquakes are Poisson events with mean rate of once every 10 years.
  • Damage caused by such quake is lognormally distributed, with mean $10M adn stddev of $6M.
  • Cost of damage gets incurred over the period of a year from the date of the quake as equipment is replaced and buildings are repaired over time: 20% in 1st quarter after quake, 50% in 2nd quarter, 20% in 3rd quarter, 10% in 4th quarter.

Keywords: Risk analysis, cost analysis

Download: Earthquake expenses.ana

Loan Policy Selection

Description: A lender has a large pool of money to loan, but needs to decide what credit rating threshold to require and what interest rate (above prime) to charge. The optimal value is determined by market forces (competing lenders) and by the probability that the borrower defaults on the loan, which is a function of the economy and borrower's credit rating. The model can be used without the Analytica optimizer, in which case you can explore the decision space manually or use a parametric analysis to find the near optimal solution. Those with Analytica Optimizer can find the optimal solution (more quickly) using an NLP search.

Best used with Analytica Optimizer

Keywords: Creditworthiness, credit rating, default risk, risk analysis

Author: Lonnie Chrisman

Download: Loan policy selection.ana

See Also

Comments


You are not allowed to post comments.