# What's New in Analytica 4.5?

(Redirected from Analytica 4.5)

Here are the key enhancements in Analytica 4.5 added since Analytica 4.4, not including improved robustness and bug fixes too numerous to list.

## Free Analytica 101 Edition

To minimize the barriers to using Analytica, the Free 101 edition makes the features of Analytica Professional available at zero cost.

• The only limit is that you can build models with up to 101 variables, modules, and other user-created objects.
• If you use it to open a model with more than 101 objects, or expand a model to 101 objects, it reverts to the Analytica Player: You can open and review the model, change inputs, and generate results as tables and graphs. But it's locked in Browse mode, so you can't edit the model or add more objects. But, you can save the model with changed inputs.
• The Analytica Free 101 edition replaces the previous Analytica Trial and Analytica Player editions.
• Analytica Free 101 lets you use and distribute models for review or use by others using the Analytica Cloud Player (ACP). Others can also run your models using Free Analytica 101.
• Free Analytica 101 offers all features for Analytica Professional but not features of Analytica Enterprise or Optimizer: So, it doesn't offer spreadsheet and database access.
• Watermarks appear on diagrams, graphs, copied images, and printouts mentioning that they were generated with the Analytica Free 101.

## 64-bit Editions

• There is no longer a price difference between 32-bit and 64-bit editions: You can install either if you are running 64-bit version of Windows.

If you are upgrading from an earlier release and have active support, the Analytica 4.5 64-bit installer will automatically upgrade you to a 64-bit license.

## Unicode and International Alphabets

You can now use Chinese, Greek, Japanese, Russian, or almost any characters or alphabet in creating models. Analytica now users Unicode (instead of Asci), so it supports just about any language with letters or characters from extended Unicode characters (Chr(1) to Chr. You can also include accents, mathematical symbols and numerous icons. This applies to object identifiers, titles, units, descriptions, and any other attribute that accepts text, including file names. Here's part of the Bond Model in Chinese:

Arabic and Hebrew are available, but text doesn't display right-to-left.

The Analytica user interface is not internationalized: Text in menus, dialogs, help, software documentation, and so on are still in English. The PDF guides (Tutorial, User Guide, Optimizer Guide) are also available in Chinese.

### Collation Order

Analytica's comparison operators (e.g., < and >) and sorting functions (e.g., SortIndex, Rank, Sort) now compare text using language-specific collation order. Formerly, they compared text using the ascii values of each character. For non-English text, ascii order (also known as ansi order) doesn't always correspond to the natural ordering of text. For example, an accented é does not come between the letters d and f in ansi order.

A new system variable, TextLocale, specifies the collation order. The value usually indicates a language, or language and region (e.g., "English", "English_US", "Spanish"). You can still use the old-style ansi-order, by setting it to "Ansi". See Collation Order.

### Accent awareness

It treats accented characters more consistently. For example, functions TextUpperCase and TextLowerCase, and making an identifier from a title, do what you expect on letters with accents.

### Model file format

To accommodate Unicode text fields, Analytica stores model files using the UTF-8 character encoding instead of ANSI encoding.

UTF-8 encoding is the same as ANSI for basic characters (i.e. English alphabet letters, digits, standard punctuation, and others with ascii values below 128) So, there is no change for models that only use these basic characters. This ensures forward compatibility of existing model files. Extended characters -- the most common being letters with accents and some non-US currency symbols -- each use two bytes in the model file.

### Remapped characters

The ascii value of some extended characters is now different. If these appear in your legacy model, they'll be converted and you'll never know it. But if you use the Chr or Asc functions, you might notice this difference.

The characters with ascii values from 128 thru 160 are not the same in ANSI (aka ISO-8859-1) and Unicode. So these characters are remapped. For example, ≠, ≤ and ≥, previously with ascii values of 173, 178 and 179, now have the standard unicode values of 8800, 8804 and 8805.

### Month and weekday names

Month and weekday names in date formats display those in the regional language even when they include characters outside of the ascii range. Previously names with non-ascii characters would revert to their English equivalent.

## Editing expressions

### Enumerated parameter assist

When typing a definition and at a parameter with an enumerated set of possible values, Expression Assist now shows you the list of possible values and what they mean:

### Indentation and Tabs

While editing a definition (or other text attribute), the TAB key will indent the line (inserting a Tab character) to make it easier to write indented text. When writing nested multiline expressions, indenting lets you make them much easier to read.

Here's how it works when you are editing a Definition or other attribute in the Attribute pane or Object window:

• If Expression Assist is suggesting an identifier or word completion, TAB inserts the selected item.
• If you have selected text in one or more lines in edit mode, press TAB to indent the line(s).
• Or press Shift+TAB to remove one level of indent for the selected line(s).
• If you are typing in an attribute field, Tab inserts a tab character, which lines up the next character at a fixed pixel position, spaced approximately 4 typical characters widths apart.
• In the Object Window, pressing TAB selects the next attribute in the window -- except if you are editing the attribute (if you have clicked in it or move the cursor in it) it indents the selected line(s), as described above.

## Exporting and importing data

### Refinements to the Export-Import data format specification

The Export-Import data format is used by the File → Export and File → Import menu commands, and by Copy Table, as a representation for exchanging multidimensional arrays. It is described in Using the Import and Export Commands of the Analytica User Guide.

• There were ambiguities in the original specification, largely relating to differentiating between text that wasn't quoted and expressions or identifiers. The original specification also did not address how multiline cell values should be represented, or values containing the tab character. A more precise specification of the format has been created. The user guide description has been updated, the Wiki specification has the more formal and precise specification.
• Multidimensional tables and arrays containing distribution functions, multiline cell values, identifiers, expressions, and tab characters can now be successfully exported and imported. (these cases did not work previously due to ambiguities).
• A new built-in function, ReadExportFile, has been added which can be used to read in a file in the Export-Import data format. (we are aware of the obvious omission of WriteExportFile that isn't yet available).
• The old typescript commands Export and Import work with the updated format. (prior to 4.5, Import was not there but didn't work).

### Index Correspondence

• When you import a saved or copied multidimensional array into an edit table, the indexes of the saved array need to be matched (or corresponded) with the indexes of the table. That correspondence can be quite confusing since the tables may be pivoted differently, or may be based on different indexes having either the same length or same elements. The logic for making this correspondence has been greatly enhanced, so that it is now much smarter about recognizing intended correspondences across a variety of cases. The details are described in Index Correspondence. What this means for you:
• When copying a table to another that uses the same indexes, it'll work even if you don't get the pivot the same.
• When source and destination tables have different indexes, but of the same lengths, you can remove any ambiguities by making the pivot the same.

## Engine and language enhancements

### Complex Numbers

Analytica 4.5 supports Complex numbers. There are several new built-in functions for working with complex numbers, including: RealPart, ImPart, ComplexRadians, ComplexDegrees (use Abs for magnitude), FFT and FFTInv (fast Fourier transform and its inverse). Existing built-in functions handle complex numbers where needed.

To type a complex number, use an i or j suffix, for example: -2j or 4+3i. Complex numbers display in 3-4j format in result table cells. Graphs display only the RealPart(x).

If you try to evaluate Sqrt(-4), the result depends on whether you have enabled complex numbers. If not, it'll warn that you are taking the square root of a negative number and, if you ignore the warning, the result will be NaN. If you enable complex numbers, the result will be 2j. To enable complex numbers, select Definition → System Variables → EnableComplexNumbers from the menus (with no object selected). You can then change its value from 0 to 1.

See Complex Numbers for more details.

### Fixed real precision arithmetic

Analytica now uses fixed-precision (also known as fixed-point) to represent numbers when it can, instead of floating point. Fixed-precision is an exact representation, so this avoids occasional issues of round-off error that occur with floating point.

For example, the number 0.07 has no exact binary floating point representation. The closest floating-point value is roughly 0.07000000000000001. This tiny error can become magnified by certain arithmetic operations, such as

(0.07 * 10 - .7) * 1e+16

With floating point arithmetic, this gives a result slightly greater than 1, even though the result should be zero. In Analytica 4.5, the use of fixed point arithmetic produces the exact result of 0.

Fixed precision uses an exact representation for numbers with up 6 decimal digits with absolute value less than 9 trillion -- more precisely, for x where Abs(x) <= 9,223,372,036,854.775807. Fixed-precision arithmetic preserves fixed-precision for results when possible. Operations that cannot guarantee a fixed-point result fall back to floating point precision.

### Repeated parameter forwarding

Have you ever needed to Sum over all the indexes of an array, without necessarily knowing what indexes are present in advance? A new language extension called Repeated Parameter Forwarding allows you to do this using

Sum(A,...indexesOf(A))

In general, this extension allows you to compute a list of values and pass them to a repeated function parameter. For more details, see Repeated Parameter Forwarding.

### Subscript warning

When you use Slice or Subscript to re-index to a larger index, a warning is no longer issued about elements that are not found in the source index. For example, suppose

Index I := 1..10
Index J := 1..100

Then A[I=J] will not issue a warning that 11 is not an element of I. In the result, the elements corresponding to J = 11..100 will be Null. This saves you from having to write A[I=J,default:Null] as was previous necessary to avoid the warning in this case. We have found this case of re-indexing to a larger index to be common enough that we felt it better without the warning.

## Assignment to controls and tables

When you use the assignment operator, := to set the value of a variable that is currently defined as a Choice, if the value you are assigning is a possible value on the list of choices, the choice control is now retained and the value that you are assigning is selected. The same applied when the definition is a Checkbox and you assign 0 or 1 to the variable.

This same treatment of controls applied when you use the assignment operator, := to change the definition of a table. If a cell in the new value happens to be a possible value for a Choice control in the same cell, the cell remains a control and the new value is selected in the choice control.

If you assign an array value to a variable that is currently defined as a DetermTable, the definition now remains a DetermTable rather that being changed to a Table. The same applies to other table types: Table, IntraTable, and ProbTable.

## Built-in functions

### Logistic regression

LogisticRegression, ProbitRegression and PoissonRegression are now built-in and available from all editions of Analytica. These functions include a Bayesian prior, which tends to work much better than maximum likelihood approaches in practice.

This class of functions is used to predict the probability of an outcome from known input variables (as compared to straight Regression which is usually thought of as predicting an outcome, rather than a distribution, from known input variables). You use training data that known input values paired with the outcome that actually occurred.

### Fast Fourier Transform

The Fast Fourier Transform has many uses, including the identification of seasonality or oscillations in time series, efficient convolution and de-convolution of data series, and the characteristic function representation of probability distributions in Bayesian inference. The FFT and FFTInv functions provide efficient transformations between a time or spatial domain and the frequency domain. These functions make use of Complex Numbers.

### User interface functions

The new AskMsgChoice function displays a dialog (in desktop Analytica) asking for a selection from a list of values, as in a Choice pulldown. The combo box is a variant, which lets you type in a value other than one of those listed.

requires Analytica Enterprise

New functions, SpreadsheetInfo and SpreadsheetSetInfo, allow you to query or set various properties of the workbook object. You can use these to find out the file name and path, toggle automatic or manual computation modes, and obtain a list of names ranges, among other things.

### Reading or writing data files

• The ReadExportFile is now available for reading in a file in Analytica's multi-dimensional export format.
• The ReadTextFile function can now be used to read in data from files in ANSI, UTF-8 or UTF-16 formats, including file containing extended Unicode characters.

### Array Functions

• The index parameters to MdArrayToTable are now optional. A single parameter call, MdArrayToTable(A), converts multidimensional array A to a relational table.

### Probability Distributions

Two new distributions are now included as built-in functions.

## Graphs

There have been several small fixes to result graphs (plots), some of which are notable.

• On an axis containing date-time values, labels on tick mark other than whole day boundaries did not show up, but now will.
• When a graph window is does not have sufficient height or width, some axis labels sometimes need to be dropped to avoid overlapping text. An enhanced layout algorithm now selects which labels to drop to maximize the regularity in spacing between the labels that are shown. The more even spacing usually looks more natural than before.

## Tables

• When you view a table with controls (Choice pulldowns or Checkboxes), these now display as active controls in edit mode. A control appears in the bottom right corner of the header area which allows you to view and edit the textual expressions instead, which is visible in the following screenshot. With this feature, it is no longer necessary to switch back and forth between browse and edit mode to use controls in tables.
• This release contains an experimental feature called a MultiTable, which makes it possible to display multiple tables within a single edit table, including both editable and non-editable sources, and computed results. This is not officially part of the 4.5 release, and hence is not overtly exposed and may be subject to change before it becomes a supported feature.

## Graphical User Interface

• You can compare the results from two or more nodes by selecting the nodes (by shift-click or dragging a rectangle around them) and pressing the Result button (or ctrl-R). Previously, this would add a new variable that contains the comparison. Now it can show the comparison result without adding a variable. In edit mode, it first asks if you want to add a new variable, but you don't have to.
• A new menu option, Close All But Active in the Windows menu closes all windows, except for the frontmost one. This is useful if you have been working for a while and have dozens of open windows, which can slow down your interactions with Analytica.
• When you terminate a computation, e.g., by pressing Ctrl+Break or clicking on the stop sign on the tool bar, it sometimes takes a while for Analytica to back out of the computation and clean up. Now, the cursor changes to to let you know that it is handling your that it has noticed your termination request. When in this state, it usually can't respond to other requests -- so you need to wait until it's done.
• Double clicking on a Checkbox input node no longer brings up the Object Window, even if you are double clicking on the node label. This behaves a little different to other input/output node, where double clicking on the label jumps you to the Object Window. The change is made to match people's natural intuition for a checkbox.
• Alias nodes, input/output form nodes, text, and picture objects each have their own identifier, which you usually don't see or care about. Except that, previously, if you renamed an object that happened to duplicate one of these identifiers, it wouldn't let you do it. Now, it will let you, and quietly rename the previous object to something else to prevent a duplicate name.
• The Cell Default attribute is now shown in the Attribute Panel or Object Window when the definition is blank or unparsed, whereas previously it was hidden. This lets you configure the default before creating a table, so that the default applies to the initial cells when they are created.

## Libraries

• The Libraries folder now has a subfolder named Old. It contains libraries that are obsolete, usually because their functions are now built into Analytica. We continue to include them for the sake of older models that may still use them.

### Example Models

• New example model, Mean Reversion Trading.ana, located in the Dynamic Models folder, illustrates the encoding of a Markov Decision Process.
• New example models, Logistic regression prior selection.ana and Poisson regression ad exposures.ana, in the Data Analysis folder illustrate the use of new logistic regression functions.

## Backward Compatibility

We always strive to make each release of Analytica backward compatible, so that models created with an earlier Analytica release will still work fine with the new release. But there is a remote chance that a change will impact an existing model. For example, if your model took advantage of a "bug" that is fixed in the new release. The situations that could possibly affect backward compatibility are quite rare, but we list them for completeness:

• The sort order for text has changed to be consistent for letters with accents, etc. Previously, sort order was determined by the ascii value of each character; now it is based on the language collation order. For example, é will now sort to be between the letters d and f, even thought the ascii value of é is not between d and f. If your model relies on the old ascii sort order, you can retain the old behavior with the new system variable, TextLocale. Open the typescript window (press F12) and type: TextLocale:ansi. You should then save and re-open your model, since results already computed won't automatically invalidate.
• It now detects some errors in definitions with index parameters when the model is loaded or definition edited, which it previously would not detect until the expression was evaluated. These nodes will now appear cross-hatched when the model is loaded. When the bad expression is in an IF-THEN clause, and the IF part was false, your node might evaluate OK in 4.4 but will now give an error. An example is this expression
If false Then Sum(A, Sum(B, J)) Else 0
Here the second parameter to Sum is not an index, so this is an error. This error would not have been detected in 4.4, even at evaluation, because the IF is always false. If you find one of these cases when you run your model in Analytica 4.5, you should fix the expression -- it is an error regardless of which release you are running in.
• Ascii values of extended characters: The conversion of the representation of characters from ANSI ISO-9952-1 to Unicode has changed the ascii value of a few extended characters. This is only an issue if your model relies on the numerical ascii value for these characters, which would be very rare. It is no problem if you've simply used these characters in descriptions, definitions, or other attributes, since they are converted automatically when you load the model. The characters affected are Chr(128)..Chr(160), Chr(173), Chr(178) and Chr(179), which appear as: "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ≠≤≥".
• If your model contains any extended (Unicode) characters, Analytica 4.5 will save the model file in UTF-8 format. So, if you try to open it in Analytica 4.4 or an earlier release that doesn't understand Unicode, it will convert these extended characters into two or three garbage characters. See Model File Character Encoding for more information on this and on how to change encoding.
• When you use the assignment operator in a button script to assign an array to a global variable, it preserves the existing type of the table, whereas formerly it would change a DetermTable into a Table. This would only affect a model in the unlikely event that such as assignment is being used to convert a DetermTable to a Table.
• When you use the assignment operator to change a definition or edit table cell that contains a control (Choice or Checkbox), it now preserves the control and the new value is selected (assuming the value is 0 or 1 for the Checkbox or one of the valid options for Choice. Previously it would replace the control by the literal value. This change will have no effect on computed results, but could change the appearance of an edit table in the unlikely event that the assignment operator from a button script is being used to remove controls from a table.