Difference between revisions of "Tutorial: Create a model"
(79 intermediate revisions by 4 users not shown) | |||
Line 25: | Line 25: | ||
==Creating a new model== | ==Creating a new model== | ||
− | {{Release|5.0||When you start up a new Analytica session, it shows the [[ | + | {{Release|5.0||When you start up a new Analytica session, it shows the [[Intro screen]]. Click on '"Start a new model". |
− | [[image:ClickOnBlankModel.png]] | + | {{Release|5.0|6.3| |
+ | {{CalloutAnnotationBlock|[[image:ClickOnBlankModel.png]]| | ||
+ | {{CalloutAnnotation| | ||
+ | Click ''Blank Model'' to start a new model.|v=341|pt=87,367|path=r-}} | ||
+ | }}|}} | ||
+ | {{Release|6.4|| | ||
+ | {{CalloutAnnotationBlock|[[image:ClickOnBlankModel6_4.png]]| | ||
+ | {{CalloutAnnotation| | ||
+ | Click to ''Start a new model''.|v=310|pt=377,336|path=r-}} | ||
+ | }}|}} | ||
The blank model initially}}{{Release||4.6|When you start up a new Analytica session it}} shows an [[Object window]] for an untitled model. Behind the Object window you will see an empty [[Diagram window]]. | The blank model initially}}{{Release||4.6|When you start up a new Analytica session it}} shows an [[Object window]] for an untitled model. Behind the Object window you will see an empty [[Diagram window]]. | ||
− | |||
First you should enter a Title for your model: | First you should enter a Title for your model: | ||
Line 47: | Line 55: | ||
''Tab'' to the Description field (to the right of the label '''Description''') to enter description information.|v=295|pt=171,148|path=*|n=+}} | ''Tab'' to the Description field (to the right of the label '''Description''') to enter description information.|v=295|pt=171,148|path=*|n=+}} | ||
{{CalloutAnnotation| | {{CalloutAnnotation| | ||
− | ''Author'' and creation date are filled in automatically. You can also | + | ''Author'' and ''creation date'' are filled in automatically. You can also edit the Author if desired. Analytica automatically updates ''Last Saved'' and ''File info''.|v=440|pt=301,232|path=r-|n=+}} |
− | |||
− | |||
− | |||
− | |||
− | |||
− | Analytica automatically updates | ||
}} | }} | ||
− | |||
Line 88: | Line 89: | ||
In this chapter you will create variables in the ''Car Cost'' model. | In this chapter you will create variables in the ''Car Cost'' model. | ||
− | Each variable is represented in the [[Diagram window|influence diagram]] as a shape that depicts the [[Class]] of Variable. These shapes are generally referred to as '''''nodes'''''. Select the node shape based on what you know about the variable. If you are not sure what kind of variable to use, choose a General variable | + | Each variable is represented in the [[Diagram window|influence diagram]] as a shape that depicts the [[Class]] of Variable. These shapes are generally referred to as '''''nodes'''''. Select the node shape based on what you know about the variable. If you are not sure what kind of variable to use, choose a General variable [[File:Chapter_4.4a.png]]. |
See [[Tutorial: Reviewing a model#Recognizing_influence_diagrams|Tutorial: Recognizing influence diagrams]] for a description of the node shapes. | See [[Tutorial: Reviewing a model#Recognizing_influence_diagrams|Tutorial: Recognizing influence diagrams]] for a description of the node shapes. | ||
Line 107: | Line 108: | ||
{{CalloutAnnotationBlock|[[image:Chapter_4.7.png]]| | {{CalloutAnnotationBlock|[[image:Chapter_4.7.png]]| | ||
− | {{CalloutAnnotation|Type '''''Fuel | + | {{CalloutAnnotation|Type '''''Fuel Cost''''' for the variable title. |
Line 113: | Line 114: | ||
}} | }} | ||
− | <tip>''Fuel | + | <tip>''Fuel Cost'' is filled with a diagonal line pattern around its text, indicating that it does not yet have a valid definition.</tip> |
Repeat Steps 1 and 2 four times to create four more variables that affect fuel cost. Title these variables as follows: | Repeat Steps 1 and 2 four times to create four more variables that affect fuel cost. Title these variables as follows: | ||
− | * ''Fuel | + | * ''Fuel Price'' (price per gallon of gasoline) |
* ''Annual miles'' (number of miles driven each year) | * ''Annual miles'' (number of miles driven each year) | ||
* ''Mpg'' (miles per gallon of gasoline) | * ''Mpg'' (miles per gallon of gasoline) | ||
* ''Age'' (driver’s age) | * ''Age'' (driver’s age) | ||
− | + | {{CalloutAnnotationBlock|[[image:Chapter_4.9.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Drag the Variable Node icon to a position on the diagram.|v=15|pt=464,42|path=r-|n=+}} | ||
+ | }} | ||
Title text wraps to fit within the node as you type. You can manually create a new line in a title by pressing the ''Enter'' key at the desired break point(s). You can also expand the size of the node by dragging one of the corner handles. | Title text wraps to fit within the node as you type. You can manually create a new line in a title by pressing the ''Enter'' key at the desired break point(s). You can also expand the size of the node by dragging one of the corner handles. | ||
− | + | {{CalloutAnnotationBlock|[[image:Chapter_4.11.png]]| | |
+ | {{CalloutAnnotation|Type '''''Fuel''''' and press the ''Space'' key. | ||
+ | |||
+ | |||
+ | Type '''''Price''''' and press ''Alt+Enter'' to indicate that you are finished.|v=120|pt=351,144|path=r-|n=+}} | ||
+ | {{CalloutAnnotation|Repeat Steps 3 and 4 to create three more variables, as shown. | ||
+ | |||
+ | |||
+ | Title the variables '''''Annual Miles, Mpg,''''' and '''''Age'''''.|v=365|n=+}} | ||
+ | }} | ||
==Saving your model== | ==Saving your model== | ||
Line 132: | Line 145: | ||
# Click '''Save''' or press '''Enter''' to save the model in the selected folder. | # Click '''Save''' or press '''Enter''' to save the model in the selected folder. | ||
− | + | {{CalloutAnnotationBlock|[[image:Chapter_4.13-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Select '''Save As''' from the '''File''' menu.|v=65|pt=85,260|path=b!|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | Type the new file name here.|v=530|pt=297,1090|path=*|n=+}} | ||
+ | }} | ||
==Deleting a variable== | ==Deleting a variable== | ||
Line 139: | Line 157: | ||
In this example you realize that the driver’s age is not relevant to your understanding of the ''Fuel Cost'' variable. Therefore, you will delete the ''Age'' variable. | In this example you realize that the driver’s age is not relevant to your understanding of the ''Fuel Cost'' variable. Therefore, you will delete the ''Age'' variable. | ||
− | + | {{CalloutAnnotationBlock|[[image:Chapter_4.14-updated.png]]| | |
+ | {{CalloutAnnotation|Select the Age node if it is not already selected. | ||
+ | |||
+ | |||
+ | Handles surround the node to indicate that it is selected.|v=0|pt=271,246|path=*|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | Select '''Clear''' from the '''Edit''' menu, or press the '''Delete''' key.|v=200|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Handles⠀|Type=Bare|v=330|pt=280,317|path=r-}} | ||
+ | {{CalloutAnnotation| | ||
+ | Handles⠀|Type=Bare|v=330|pt=422,317|path=r-}} | ||
+ | }} | ||
+ | |||
+ | Analytica asks you to confirm that you want to delete. | ||
− | + | {{CalloutAnnotationBlock|[[image:Chapter_4.15-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Click '''OK''' to confirm that you want to delete the selected object.|v=65|pt=381,195|path=b!|n=+}} | ||
+ | }} | ||
− | + | <tip>You can select multiple nodes by holding down the ''Control'' or ''Shift'' keys, or by placing the cursor in a blank area and dragging diagonally to draw a rectangular frame across the nodes you want to select.</tip> | |
==Moving nodes== | ==Moving nodes== | ||
When you create a model you should try to structure the layout to make the [[Diagram window|influence diagram]] easy to understand. As you refine your model, however, you will undoubtedly want to group nodes in different ways to achieve this goal. | When you create a model you should try to structure the layout to make the [[Diagram window|influence diagram]] easy to understand. As you refine your model, however, you will undoubtedly want to group nodes in different ways to achieve this goal. | ||
− | In this case we anticipate that ''Fuel | + | In this case we anticipate that ''Fuel Cost ''will be derived from the other three variables. Therefore we want to place it apart. |
Moving nodes is a simple matter of dragging them to the desired position. Try moving the nodes into the new configuration below. | Moving nodes is a simple matter of dragging them to the desired position. Try moving the nodes into the new configuration below. | ||
− | + | {{CalloutAnnotationBlock|[[image:Chapter_4.16-updated.png]]| | |
− | + | {{CalloutAnnotation| | |
− | + | Draw the nodes to the new configuration.|v=65}} | |
+ | }} | ||
<tip>You can undo or redo a drag operation by selecting '''Undo/Redo''' from the [[Edit menu]], or by typing the keyboard shortcut, ''Control+Z''.</tip> | <tip>You can undo or redo a drag operation by selecting '''Undo/Redo''' from the [[Edit menu]], or by typing the keyboard shortcut, ''Control+Z''.</tip> | ||
Line 161: | Line 196: | ||
The name displayed inside each variable node is referred to as a '''''Title'''''. In this example you will expand the title ''Mpg'' to ''Miles per gallon'': | The name displayed inside each variable node is referred to as a '''''Title'''''. In this example you will expand the title ''Mpg'' to ''Miles per gallon'': | ||
− | + | {{CalloutAnnotationBlock|[[image:Chapter_4.17-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Select the ''Mpg'' node.|v=65|pt=109,243|path=*|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | Click again inside the node's title to select its text for editing.|v=365|pt=41,625|path=b!|n=+}} | ||
+ | }} | ||
<tip> | <tip> | ||
Line 169: | Line 209: | ||
</tip> | </tip> | ||
− | + | {{CalloutAnnotationBlock|[[image:Chapter_4.19-updated.png]]| | |
+ | {{CalloutAnnotation|Type '''''Miles per gallon''''' and press ''Alt+Enter.'' | ||
+ | |||
+ | |||
+ | The new title is displayed.|v=15|pt=34,50|path=*|n=+}} | ||
+ | {{CalloutAnnotation|Type '''''Miles per gallon''''' and press ''Alt+Enter.'' | ||
+ | |||
+ | |||
+ | The new title is displayed.|v=15|pt=95,372|path=*|n=3}} | ||
+ | }} | ||
When you change the title of a node, Analytica asks you if you want the Identifier to be automatically changed as well. | When you change the title of a node, Analytica asks you if you want the Identifier to be automatically changed as well. | ||
− | + | {{CalloutAnnotationBlock|[[image:Chapter_4.20-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Click '''No''' to close this dialog box and keep the identifier as ''Mpg.''|v=200|pt=535,209|path=r-|n=+}} | ||
+ | }} | ||
+ | |||
+ | |||
+ | |||
+ | |||
<tip> | <tip> | ||
Line 182: | Line 238: | ||
One of Analytica’s most powerful features is its ability to show relationships between variables in the influence diagram. '''''Influence arrows''''' are used to specify the dependencies between variables. | One of Analytica’s most powerful features is its ability to show relationships between variables in the influence diagram. '''''Influence arrows''''' are used to specify the dependencies between variables. | ||
− | Because the ''Miles per gallon'' variable influences the ''Fuel | + | Because the ''Miles per gallon'' variable influences the ''Fuel Cost'' variable, you will [[Draw arrows|draw an arrow]] connecting the two nodes. |
{{Release||4.6| | {{Release||4.6| | ||
Line 191: | Line 247: | ||
{{Release|5.0|| | {{Release|5.0|| | ||
{{CalloutAnnotationBlock|[[File:StartArrowDraw.png]]| | {{CalloutAnnotationBlock|[[File:StartArrowDraw.png]]| | ||
− | {{CalloutAnnotation | + | {{CalloutAnnotation| |
− | + | Position the cursor over ''Miles per gallon'' until the hover icons appear. Mouse down on the [[image:HoverDrawArrowIcon.png]] icon.|v=35|pt=250,264|path=r-|n=1}} | |
− | |||
− | Mouse down on the [[image:HoverDrawArrowIcon.png]] icon.| | ||
}} | }} | ||
{{CalloutAnnotationBlock|[[File:DrawArrowDrag.png]]| | {{CalloutAnnotationBlock|[[File:DrawArrowDrag.png]]| | ||
− | {{CalloutAnnotation|Drag from the ''Miles per gallon'' | + | {{CalloutAnnotation| |
+ | Drag from the ''Miles per gallon'' node to the ''Fuel Cost'' node.|v=30|n=+}} | ||
}} | }} | ||
{{CalloutAnnotationBlock|[[File:DrawArrowRelease.png]]| | {{CalloutAnnotationBlock|[[File:DrawArrowRelease.png]]| | ||
− | {{CalloutAnnotation|Release the mouse button when ''Fuel | + | {{CalloutAnnotation| |
− | + | Release the mouse button when ''Fuel Cost'' is highlighted. The two nodes are now connected by an arrow, indicating that ''Miles per gallon'' affects ''Fuel Cost''.|v=30|n=+}} | |
− | The two nodes are now connected by an arrow, indicating that ''Miles per gallon'' affects ''Fuel | ||
}} | }} | ||
<!--5.0-->}} | <!--5.0-->}} | ||
Line 211: | Line 265: | ||
==Deleting an arrow== | ==Deleting an arrow== | ||
− | Occasionally, you might need to delete an arrow because of an earlier mistake or a change in your understanding of the model. This section shows you how to delete the arrow that connects ''Miles per gallon'' to ''Fuel | + | Occasionally, you might need to delete an arrow because of an earlier mistake or a change in your understanding of the model. This section shows you how to delete the arrow that connects ''Miles per gallon'' to ''Fuel Cost''. |
{{Release||4.6|You can delete an arrow using either the edit tool or the arrow tool. | {{Release||4.6|You can delete an arrow using either the edit tool or the arrow tool. | ||
Line 224: | Line 278: | ||
{{Release|5.0||First, make sure you have the edit tool selected. | {{Release|5.0||First, make sure you have the edit tool selected. | ||
− | {{CalloutAnnotationBlock|[[Image: | + | {{CalloutAnnotationBlock|[[Image:EditToolOnToolbar5.0.png]] |
− | |{{CalloutAnnotation|Make sure the edit tool is selected.| | + | |{{CalloutAnnotation| |
+ | Make sure the edit tool is selected.|v=65|pt=466,43|path=-|n=1}} | ||
+ | }} | ||
{{CalloutAnnotationBlock|[[Image:DeleteArrow-ArrowSelected.png]]| | {{CalloutAnnotationBlock|[[Image:DeleteArrow-ArrowSelected.png]]| | ||
− | {{CalloutAnnotation|Select the arrow by clicking on it. | + | {{CalloutAnnotation| |
− | + | Select the arrow by clicking on it. Handles appear when the arrow is selected.|v=60|pt=278,269|path=r-|n=+}} | |
− | Handles appear when the arrow is selected.| | + | {{CalloutAnnotation| |
− | {{CalloutAnnotation|Press the ''Delete'' key to delete the arrow. | + | Press the ''Delete'' key to delete the arrow. The arrow disappears.|v=170|n=+}} |
− | + | {{CalloutAnnotation| | |
− | The arrow disappears.|n=+ | + | Handles⠀|Type=Bare|v=450|pt=231,270|path=r-}} |
− | {{CalloutAnnotation| | + | {{CalloutAnnotation| |
+ | Handles⠀|Type=Bare|v=450|pt=327,270|path=r-}} | ||
}} | }} | ||
<!--5.0-->}} | <!--5.0-->}} | ||
==Connecting multiple arrows== | ==Connecting multiple arrows== | ||
− | When one variable is influenced by several other variables, you can draw multiple arrows at once. This example shows you how to connect the three variables contributing to the ''Fuel | + | When one variable is influenced by several other variables, you can draw multiple arrows at once. This example shows you how to connect the three variables contributing to the ''Fuel Cost'' variable. |
{{Release||4.6|First make sure the arrow tool is selected. | {{Release||4.6|First make sure the arrow tool is selected. | ||
Line 254: | Line 311: | ||
First make sure the edit tool is selected. | First make sure the edit tool is selected. | ||
− | :[[Image: | + | :[[Image:EditToolOnToolbar5.0.png]] |
{{CalloutAnnotationBlock|[[Image:Tutorial_SelectThreeNodes.png]]| | {{CalloutAnnotationBlock|[[Image:Tutorial_SelectThreeNodes.png]]| | ||
− | {{CalloutAnnotation|Select ''Annual miles'', ''Miles per gallon'', and ''Fuel | + | {{CalloutAnnotation|Select ''Annual miles'', ''Miles per gallon'', and ''Fuel Price'' nodes simultaneously. |
<br>(Hold down ''Control'' or ''Shift'' while selecting or drag diagonally across the group.) | <br>(Hold down ''Control'' or ''Shift'' while selecting or drag diagonally across the group.) | ||
− | |v= | + | |v=75|pt=67,126|path=r(251,416)r|n=1}} |
}} | }} | ||
{{CalloutAnnotationBlock|[[Image:StartArrowDraw3.png]]| | {{CalloutAnnotationBlock|[[Image:StartArrowDraw3.png]]| | ||
− | {{CalloutAnnotation|Hover over any of the selected nodes until the hover icons appear. Start dragging from the [[image:HoverDrawArrowIcon.png]] icon.|pt= | + | {{CalloutAnnotation|Hover over any of the selected nodes until the hover icons appear. Start dragging from the [[image:HoverDrawArrowIcon.png]] icon.|v=150|pt=248,178|n=+}} |
}} | }} | ||
{{CalloutAnnotationBlock|[[Image:DragArrowDraw3.png]]| | {{CalloutAnnotationBlock|[[Image:DragArrowDraw3.png]]| | ||
− | {{CalloutAnnotation|Release the mouse button when the ''Fuel | + | {{CalloutAnnotation|Release the mouse button when the ''Fuel Cost'' node is highlighted.}} |
}} | }} | ||
{{CalloutAnnotationBlock|[[Image:ThreeArrowsToFuelCost.png]]| | {{CalloutAnnotationBlock|[[Image:ThreeArrowsToFuelCost.png]]| | ||
− | {{CalloutAnnotation|Three arrows now point to the ''Fuel | + | {{CalloutAnnotation|Three arrows now point to the ''Fuel Cost'' node.|v=20}} |
{{CalloutAnnotation|Deselect all of the nodes by clicking in any location in the diagram that is not on a node.|pt=30,200|n=+|v=170}} | {{CalloutAnnotation|Deselect all of the nodes by clicking in any location in the diagram that is not on a node.|pt=30,200|n=+|v=170}} | ||
}} | }} | ||
<!--5.0-->}} | <!--5.0-->}} | ||
+ | |||
+ | {{Release|6.0|| | ||
+ | == Bending arrows == | ||
+ | |||
+ | As your diagrams become more complex, you may sometimes need to bend your arrows around nodes for clarity. Bent arrows can be either curved or crisp. Bent arrows contain ''way points'', which define where the arrow changes directions. . You can insert or remove way points to alter the number of segments in an arrow, and drag the way points to route the arrow as you like. | ||
+ | |||
+ | When you first select an arrow without a bend, two handles appear near the midpoint -- one is a circle, the other is a square. Drag the circle to create a curved arrow initially, or drag the square to create a crisp bend. As you drag it, you introduce the first way point. | ||
+ | |||
+ | {{CalloutAnnotationBlock|[[Image:UnbentArrowReadyToBend.png]]| | ||
+ | {{CalloutAnnotation|Select the arrow, then drag the square handle|pt=282,162|path=(100,162)|n=1}} | ||
+ | {{CalloutAnnotation|Release the drag here|pt=392,117|path=(282,*)|v=300|n=+}} | ||
+ | }} | ||
+ | |||
+ | {{CalloutAnnotationBlock|[[Image:UnbentArrowReadyToBend2.png]]| | ||
+ | {{CalloutAnnotation|Repeat for the second arrow|pt=278,248|v=210|n=+}} | ||
+ | }} | ||
+ | |||
+ | And we have two arrows with crisp bends: | ||
+ | |||
+ | {{CalloutAnnotationBlock|[[Image:BentArrows.png]]| | ||
+ | {{CalloutAnnotation|Right click on the arrow|pt=392,248|v=210|n=+}} | ||
+ | }} | ||
+ | |||
+ | To remove the bends, right-click on the arrow and select '''Remove all way points'''. | ||
+ | {{CalloutAnnotationBlock|[[Image:Remove all waypoints.png]]| | ||
+ | {{CalloutAnnotation|Repeat to remove bend in this arrow|pt=390,130|n=+}} | ||
+ | }} | ||
+ | |||
+ | |||
+ | }} | ||
==Entering attributes into the Object window== | ==Entering attributes into the Object window== | ||
Line 279: | Line 366: | ||
In this section we will use the '''Object''' window to enter attributes for the ''Annual Miles'' variable. | In this section we will use the '''Object''' window to enter attributes for the ''Annual Miles'' variable. | ||
− | {{Release||4.6|Make sure to select the edit button | + | {{Release||4.6|Make sure to select the edit button [[File:Chapter_3.10a.png]] before continuing. |
:[[File:Chapter 4.29-updated.png]] | :[[File:Chapter 4.29-updated.png]] | ||
Line 287: | Line 374: | ||
{{CalloutAnnotationBlock|[[Image:SelectingHoverObjectWindow.png]]| | {{CalloutAnnotationBlock|[[Image:SelectingHoverObjectWindow.png]]| | ||
{{CalloutAnnotation | {{CalloutAnnotation | ||
− | |Click the ''Object window'' hover icon to open its [[Object window]].|pt= | + | |Click the ''Object window'' hover icon to open its [[Object window]].|pt=111,229|n=1}} |
}} | }} | ||
<!--5.0-->}} | <!--5.0-->}} | ||
Line 295: | Line 382: | ||
</tip> | </tip> | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.30-updated.png]]| | |
+ | {{CalloutAnnotation | ||
+ | |Identifier⠀|Type=Bare|v=5|pt=253,51|path=r-}} | ||
+ | {{CalloutAnnotation | ||
+ | |Title⠀|Type=Bare|v=87|pt=104,97|path=r-}} | ||
+ | }} | ||
− | The identifier in the [[Object window]] shown above is ''Annual_miles''. Analytica assigns the identifier when the title is created. It uses the first 20 characters of the title except for spaces or punctuation, which are replaced by underscores (_). Analytica does not differentiate between uppercase and lowercase letters in identifiers. | + | The identifier in the [[Object window]] shown above is ''Annual_miles''. Analytica assigns the identifier when the title is created. It uses the first 20 characters of the title except for spaces or punctuation, which are replaced by underscores ( _ ). Analytica does not differentiate between uppercase and lowercase letters in identifiers. |
You can directly edit both the identifier and the title. | You can directly edit both the identifier and the title. | ||
Line 308: | Line 400: | ||
{{Release|5.0|| | {{Release|5.0|| | ||
{{CalloutAnnotationBlock|[[image:EnteringIntoObjectWindow.png]]| | {{CalloutAnnotationBlock|[[image:EnteringIntoObjectWindow.png]]| | ||
− | {{CalloutAnnotation|Select the contents of the [[Identifier]] field.|n=+|pt= | + | {{CalloutAnnotation|Select the contents of the [[Identifier]] field.|n=+|pt=173,75|path=/|v=85}} |
− | {{CalloutAnnotation|Type '''Mpy''' and press ''Alt+Enter''.|n=+|pt= | + | {{CalloutAnnotation|Type '''Mpy''' and press ''Alt+Enter''.|n=+|pt=173,270|path=/|v=290}} |
− | {{CalloutAnnotation|Click the [[Units]] field. Type '''miles/year''' and press ''Alt+Enter''.|n=+|pt= | + | {{CalloutAnnotation|Click the [[Units]] field. Type '''miles/year''' and press ''Alt+Enter''.|n=+|pt=468,460|path=/|v=470}} |
}} | }} | ||
<!--5.0-->}} | <!--5.0-->}} | ||
Line 322: | Line 414: | ||
}}{{Release|5.0|| | }}{{Release|5.0|| | ||
{{CalloutAnnotationBlock|[[image:EditingTitleInObjectWindow.png]]| | {{CalloutAnnotationBlock|[[image:EditingTitleInObjectWindow.png]]| | ||
− | {{CalloutAnnotation|Select the contents of the [[Title]] field and press the ''Delete'' key to erase '''Annual miles'''.|n=+|pt= | + | {{CalloutAnnotation|Select the contents of the [[Title]] field and press the ''Delete'' key to erase '''Annual miles'''.|n=+|pt=172,107|v=80}} |
− | {{CalloutAnnotation|Type '''Miles per year''' and press ''Alt+Enter''.|n=+|pt= | + | {{CalloutAnnotation|Type '''Miles per year''' and press ''Alt+Enter''.|n=+|pt=172,294|v=300}} |
}} | }} | ||
<!--5.0-->}} | <!--5.0-->}} | ||
Line 335: | Line 427: | ||
}}{{Release|5.0|| | }}{{Release|5.0|| | ||
{{CalloutAnnotationBlock|[[image:ChangeMpgIdentQuestion.png]]<br><br>| | {{CalloutAnnotationBlock|[[image:ChangeMpgIdentQuestion.png]]<br><br>| | ||
− | {{CalloutAnnotation|Click '''No''' to keep the [[Identifier]] as '''Mpy'''.|n=+|pt= | + | {{CalloutAnnotation|Click '''No''' to keep the [[Identifier]] as '''Mpy'''.|v=150|n=+|pt=513,208|path=bD30-}} |
}}{{CalloutAnnotationBlock|[[image:AverageMilesDrivenPerYear.png]]| | }}{{CalloutAnnotationBlock|[[image:AverageMilesDrivenPerYear.png]]| | ||
− | {{CalloutAnnotation|Click in the [[Description]] field, type '''Average miles driven per year.''', and press ''Alt+Enter''.|n=+|pt= | + | {{CalloutAnnotation|Click in the [[Description]] field, type '''Average miles driven per year.''', and press ''Alt+Enter''.|n=+|pt=313,125|path=-|v=25}} |
}} | }} | ||
<!--5.0-->}} | <!--5.0-->}} | ||
Line 354: | Line 446: | ||
First let’s define ''Miles per year'' as 12,000. | First let’s define ''Miles per year'' as 12,000. | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.34-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Click in the Definition field to center a mathematical expression for the variable; type '''''12K.'''''|v=35|pt=174,198|path=*|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | A warning icon indicates that this variable's definition has not yet been accepted.|v=187|pt=38,209|path=r-}} | ||
+ | }} | ||
<tip> | <tip> | ||
Line 360: | Line 457: | ||
</tip> | </tip> | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.35-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Click the check button or press ''Alt+Enter'' to accept the new definition.|v=35|pt=286,170|path=r-|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | The warning icon disappears because the variable now has valid definition.|v=187|pt=38,209|path=r-}} | ||
+ | {{CalloutAnnotation| | ||
+ | If you want to cancel what you entered, click the cancel button. |v=339|pt=260,185|path=r-}} | ||
+ | }} | ||
Whenever another variable’s definition includes the '''''identifier''' (Mpy) of Miles per year'', this defined value, '''12K''', is used as its value. | Whenever another variable’s definition includes the '''''identifier''' (Mpy) of Miles per year'', this defined value, '''12K''', is used as its value. | ||
− | + | {{CalloutAnnotationBlock|[[image:EditToolOnToolbar5.0_ActiveResult.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Click the '''Diagram''' button to return to the influence diagram. |v=0|pt=5,35|path=*|n=+}} | ||
+ | }} | ||
+ | |||
+ | |||
''Miles per year'' is no longer filled with a diagonal line pattern around its title, as shown in the figure below. The clear node indicates that ''Miles per year'' now has a valid definition. | ''Miles per year'' is no longer filled with a diagonal line pattern around its title, as shown in the figure below. The clear node indicates that ''Miles per year'' now has a valid definition. | ||
Line 371: | Line 480: | ||
==Defining a variable as a function of other variables== | ==Defining a variable as a function of other variables== | ||
− | When one variable is dependent upon another variable, you must provide an expression that describes the relationship between the variables. Influence arrows connecting other nodes to ''Fuel | + | When one variable is dependent upon another variable, you must provide an expression that describes the relationship between the variables. Influence arrows connecting other nodes to ''Fuel Cost'' show the direction of this dependency. |
− | In this section, you will enter a definition for ''Fuel | + | In this section, you will enter a definition for ''Fuel Cost'' in terms of the values of ''Miles per year, Miles per gallon,'' and ''Fuel Price''. |
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.40-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Enter the variable's units as '''''$/year''''', and description as '''''Annual cost of fuel.'''''|v=35|pt=495,74|path=r-|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | Enter the variable's units as '''''$/year''''', and description as '''''Annual cost of fuel.'''''|v=35|pt=209,130|path=*|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | Click in the Definition field to enter a mathematical expression.|v=187|pt=209,212|path=r-|n=+}} | ||
+ | }} | ||
− | Because Fuel | + | Because Fuel Cost is equal to Fuel Price times miles driven, divided by miles per gallon, you will enter the following expression into the Definition field: |
− | :<code> | + | :<code>Fuel_Price*Mpy/Mpg</code> |
An asterisk (<code>*</code>) represents multiplication; a slash (<code>/</code>) represents division. | An asterisk (<code>*</code>) represents multiplication; a slash (<code>/</code>) represents division. | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.41-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | From the Inputs popup menu select the name of the variable that you want to add, in this case, ''Fuel Price. Fuel_Price'' appears in the Definition field.|v=35|pt=362,166|path=r-|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Type an asterisk (*).|v=237|n=+}} | ||
+ | }} | ||
− | Based on the definition you just entered, the value of ''Fuel | + | Based on the definition you just entered, the value of ''Fuel Cost'' is calculated by multiplying the values of ''Fuel Price'' and ''Miles per year'', and then dividing the result by the value of ''Miles per gallon''. |
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.42-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Select ''Miles per year'' from the Inputs popup menu.|v=35|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Type a slash (/).|v=137|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Select ''Miles per gallon'' from the Inputs popup menu.|v=189|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Press ''Alt+Enter'' or click the check button to accept the definition. The Definition field should look like this (spaces between terms and operators are optional).|v=291|pt=208,177|path=r-|n=+}} | ||
+ | }} | ||
+ | |||
+ | {{CalloutAnnotationBlock|[[image:EditToolOnToolbar5.0_ActiveResult.png]]| | ||
+ | {{CalloutAnnotation| Click the '''Diagram''' button to return to the influence diagram. | ||
− | + | ||
+ | Note that ''Fuel Cost'' is no longer diagonally shaded, indicating that it has a valid definition.|v=0|pt=5,35|path=*|n=+}} | ||
+ | }} | ||
+ | {{CalloutAnnotationBlock|[[image:Chapter 4.43-updated.png]]|}} | ||
==Entering attributes using the Attribute panel== | ==Entering attributes using the Attribute panel== | ||
Sometimes you may find it more convenient to view or edit attributes of a variable in the [[Attribute panel]] as part of the [[Diagram window|Diagram view]] instead of using a separate [[Object window]]. | Sometimes you may find it more convenient to view or edit attributes of a variable in the [[Attribute panel]] as part of the [[Diagram window|Diagram view]] instead of using a separate [[Object window]]. | ||
− | In this section, you will enter data for the ''Fuel | + | In this section, you will enter data for the ''Fuel Price'' variable in the '''Attribute''' panel. |
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.44-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Select the ''Fuel Price'' node.|v=35|pt=101,343|path=*|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | Click the arrow icon to display the '''Attribute''' panel.|v=137|pt=17,523|path=b!|n=+}} | ||
+ | }} | ||
The [[Attribute panel]] appears below the diagram. You can use this view to enter or edit data for the currently selected variable in the influence diagram. | The [[Attribute panel]] appears below the diagram. You can use this view to enter or edit data for the currently selected variable in the influence diagram. | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.45-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Click on the Attribute popup menu and select '''Description.'''|v=35|pt=370,30|path=rR15U65-|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Enter the description as shown, then press ''Alt-Enter.''|v=137|pt=39,76|path=r-|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Select '''Units''' from the Attribute popup menu.|v=689|pt=308,438|path=r-|n=+}} | ||
+ | }} | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.46-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Type '''''US Dollars,''''' then press ''Alt+Enter.''|v=38|pt=16,65|path=r-|n=+}} | ||
+ | }} | ||
− | Now that you have entered attributes for the ''Fuel | + | Now that you have entered attributes for the ''Fuel Price'' variable, you will enter its definition in the [[Attribute panel]]. |
− | In this example we will assume that Fuel | + | In this example we will assume that Fuel Price has a fixed value of $3 per gallon. |
Select '''''Definition''''' from the [[Attribute dropdown menu]] and enter '''3'''. | Select '''''Definition''''' from the [[Attribute dropdown menu]] and enter '''3'''. | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.47-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Select '''Definition''' from the Attribute popup menu.|v=45|pt=352,43|path=r-|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | The warning icon is there to remind you that the variable is not yet defined.|v=135|pt=250,43|path=r-}} | ||
+ | {{CalloutAnnotation|Enter '''''3''''' in the Attribute field. | ||
+ | |||
+ | The ''Fuel Price'' variable is now defined as an explicit value.|v=250}} | ||
+ | }} | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.48-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Note that ''Fuel Price'' is no longer diagonally shaded, indicating that it has a valid definition. |v=296|pt=93,342|path=r-}} | ||
+ | }} | ||
==Defining a variable as a list== | ==Defining a variable as a list== | ||
− | In this section you will enter [[attributes]] for the ''Miles per gallon'' variable and define it as a sequence of numbers. You will use this sequence later to perform a [[Parametric analysis]] to show how the ''Fuel | + | In this section you will enter [[attributes]] for the ''Miles per gallon'' variable and define it as a sequence of numbers. You will use this sequence later to perform a [[Parametric analysis]] to show how the ''Fuel Cost'' is affected by ''Miles per gallon''. |
Using the [[Attribute panel]], enter '''''Average number of miles per gallon''''' for the description and '''''miles/gallon''''' for the units. | Using the [[Attribute panel]], enter '''''Average number of miles per gallon''''' for the description and '''''miles/gallon''''' for the units. | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.49-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Choose '''Description''' from the Attribute popup menu and enter: '''''Average number of miles per gallon.'''''|v=5|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | Choose '''Units''' from the popup menu and enter: '''''miles/gallon''''' |v=275|n=+}} | ||
+ | }} | ||
Now that you have entered attributes for the ''Miles per gallon'' variable, you will define it as a sequence of integers between 20 and 50, by increments of 10. | Now that you have entered attributes for the ''Miles per gallon'' variable, you will define it as a sequence of integers between 20 and 50, by increments of 10. | ||
Line 425: | Line 592: | ||
Select '''Definition''' from the [[Attribute dropdown menu]]. You will notice a second popup menu appears to the right. This is [[the Expression popup menu]]. Open the [[Expression popup menu]] and select '''list'''. | Select '''Definition''' from the [[Attribute dropdown menu]]. You will notice a second popup menu appears to the right. This is [[the Expression popup menu]]. Open the [[Expression popup menu]] and select '''list'''. | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.50-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Select '''Definition''' from the Attribute popup menu.|v=30|pt=352,43|path=r-|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | The Expression popup menu appears next to the Attribute menu.|v=105|pt=510,43|path=r-}} | ||
+ | }} | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.51-updated.png]]| | |
− | + | {{CalloutAnnotation| | |
− | + | Choose '''list''' from the Expression popup menu.|v=5|n=+}} | |
+ | {{CalloutAnnotation| | ||
+ | Type '''''20''''' in the first cell and press ''Enter.''|v=235|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Analytica automatically sets the next value using the default increment of 1.|v=295|pt=60,330|path=r-}} | ||
+ | {{CalloutAnnotation| | ||
+ | Change the second cell to '''''30''''' and press ''Enter.''|v=430|pt=60,551|path=b!|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Analytica automatically sets the next value using the increment of 10 (the same as between the previous 2 values).|v=560|pt=60,583|path=r-}} | ||
+ | }} | ||
+ | {{CalloutAnnotationBlock|[[Image:Chapter 4.52-updated.png]]| | ||
+ | {{CalloutAnnotation| | ||
+ | Simply press ''Enter'' one more time to complete the sequence.|v=5|n=+}} | ||
+ | }} | ||
Although the auto-fill feature makes it convenient to enter a simple linear sequence, you are free to edit the values as you please. | Although the auto-fill feature makes it convenient to enter a simple linear sequence, you are free to edit the values as you please. | ||
Line 435: | Line 620: | ||
Now you will use the '''''Expression view''''' to see the variable’s definition in a different form. The Expression view shows the full syntax of the definition regardless of the type of variable. | Now you will use the '''''Expression view''''' to see the variable’s definition in a different form. The Expression view shows the full syntax of the definition regardless of the type of variable. | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter 4.53-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Select '''Expression''' from the Expression popup menu.|v=55|pt=510,45|path=r-|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | As an alternative to the list view, a list variable can be entered directly using square brackets as shown:|v=135|pt=67,78|path=r-}} | ||
+ | }} | ||
+ | |||
+ | |||
==Viewing results in the Result window== | ==Viewing results in the Result window== | ||
Now that you have entered attributes and definitions for all variables it is time to see the result. The '''Results button''' calculates values for all selected variables. | Now that you have entered attributes and definitions for all variables it is time to see the result. The '''Results button''' calculates values for all selected variables. | ||
− | Select the Fuel | + | Select the Fuel Cost node and click the Results button [[File:Chapter_4.54-updated.png]]. |
+ | |||
+ | {{CalloutAnnotationBlock|[[Image:EditToolOnToolbar5.0_ActiveDefinition.png]]| | ||
+ | {{CalloutAnnotation| | ||
+ | Select the ''Fuel Cost'' variable.|v=5|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | Click the Results button.|v=95|pt=215,37|path=r-|n=+}} | ||
+ | }} | ||
+ | {{CalloutAnnotationBlock|[[Image:Chapter_4.55-updated.png]]}} | ||
− | |||
− | The | + | The Result window appears. Icons in the upper left corner of the Result window control the view mode. [[Table view of a result|Tabular form]] [[File:Chapter_4.58-updated.png]] is the default. |
− | + | {{CalloutAnnotationBlock|[[Image:Chapter_4.59-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | The Result window appears in tabular form when the Table icon is selected.|v=43|pt=18,89|path=r-}} | ||
+ | }} | ||
<tip> | <tip> | ||
Line 452: | Line 654: | ||
</tip> | </tip> | ||
− | |||
− | :[[ | + | Click the graph button [[File:Chapter_4.56-updated.png]] to view the results in [[Graph view of a result|graph view]]. |
+ | |||
+ | {{CalloutAnnotationBlock|[[Image:Chapter_4.57-updated.png]]| | ||
+ | {{CalloutAnnotation| | ||
+ | The Result window appears in graph mode when the Graph icon is selected.|v=74|pt=18,121|path=r-}} | ||
+ | }} | ||
==Defining a variable using a built-in function== | ==Defining a variable using a built-in function== | ||
Line 463: | Line 669: | ||
Select the ''Miles per gallon'' variable. Make sure that the Attribute window is open and '''Definition''' is selected. | Select the ''Miles per gallon'' variable. Make sure that the Attribute window is open and '''Definition''' is selected. | ||
− | Next, open [[the Expression popup menu]] and select '''Other''' at the bottom of the list. This opens the [[Object finder]] where you will find a large collection of built-in functions. Analytica will prompt to confirm that you want to replace the current definition of the variable. Click '''OK'''. | + | Next, open [[the Expression popup menu]] and select '''Other''' at the bottom of the list. This opens the [[Object_Finder_dialog|Object finder]] where you will find a large collection of built-in functions. Analytica will prompt to confirm that you want to replace the current definition of the variable. Click '''OK'''. |
− | + | {{CalloutAnnotationBlock|[[Image:Chapter_4.60-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Select '''Other''' from the Expression popup menu.|v=248|pt=488,284|path=r-|n=1}} | ||
+ | {{CalloutAnnotation| | ||
+ | Confirm that you are replacing the current definition by clicking '''OK.'''|v=475|pt=107,522|path=r-|n=+}} | ||
+ | }} | ||
− | The [[Sequence]] function is contained in the [[:Category:Array Library|Array library]]. Choose '''Array | + | The [[Sequence]] function is contained in the [[:Category:Array Library|Array library]], under Creating lists. Choose '''Creating Lists'" under the Array library from the Library popup menu. |
Scroll down the list and select '''Sequence'''. | Scroll down the list and select '''Sequence'''. | ||
Line 473: | Line 684: | ||
Enter '''''20''''' for the start value, '''''50''''' for the end value, and '''''5''''' for the step. (Leave the ''strict'' field blank.) Click '''OK'''. | Enter '''''20''''' for the start value, '''''50''''' for the end value, and '''''5''''' for the step. (Leave the ''strict'' field blank.) Click '''OK'''. | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter_4.61-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Select '''— Creating lists''' under '''Array''' from the Library popup menu.|v=88|pt=219,75|path=r-|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Scroll down and choose the '''Sequence''' function.|v=219|pt=136,206|path=r-|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Enter start value '''''20,''''' end value '''''50''''' and step value '''''5.'''''|v=329|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Click '''OK''' to finish.|v=439|n=+}} | ||
+ | }} | ||
The new definition is displayed in the [[Attribute panel]]. | The new definition is displayed in the [[Attribute panel]]. | ||
Line 479: | Line 699: | ||
:[[File:Chapter_4.62-updated.png]] | :[[File:Chapter_4.62-updated.png]] | ||
− | Select the ''Fuel | + | Select the ''Fuel Cost'' variable and click the Results button [[File:Chapter_4.54-updated.png]]. The result shows improved precision with the smaller ''Miles per gallon'' intervals. |
− | :[[File:Chapter_4. | + | {{CalloutAnnotationBlock|[[Image:Chapter_4.63-updated.png]]| |
+ | {{CalloutAnnotation| | ||
+ | Select Fuel Cost and click the Results button [[File:Chapter_4.54-updated.png]].|v=88|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Toggle between table and graph views.|v=219|pt=18,91|path=rR10!|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Toggle between table and graph views.|v=219|pt=18,122|path=rR10!|n=+}} | ||
+ | }} | ||
==Expression Assist== | ==Expression Assist== | ||
As you type textual expressions into definitions, [[Expression Assist]] provides continual context sensitive identifier completion and help on functions and their parameters. Next you will erase and re-enter the definition for ''miles per gallons'', typing it textually this time rather than using the [[Object Finder dialog|Object Finder]], in order to acquaint you with Expression Assist. | As you type textual expressions into definitions, [[Expression Assist]] provides continual context sensitive identifier completion and help on functions and their parameters. Next you will erase and re-enter the definition for ''miles per gallons'', typing it textually this time rather than using the [[Object Finder dialog|Object Finder]], in order to acquaint you with Expression Assist. | ||
− | On the diagram, select ''Miles per gallon'' and press the Object Window button | + | On the diagram, select ''Miles per gallon'' and press the Object Window button [[File:Chapter_4.64-updated.png]] on the tool bar. |
− | + | {{CalloutAnnotationBlock|[[Image:Chapter_4.65-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Highlight the existing definition and press the ''Delete'' key.|v=188|pt=253,217|path=r-|n=1}} | ||
+ | }} | ||
Now you are ready to begin typing the definition anew. Press the ’S’ character and notice the identifier completion popup showing a list of identifiers starting with ’S’. Continue with the ’e’ character, and identifiers beginning with "Se" display: | Now you are ready to begin typing the definition anew. Press the ’S’ character and notice the identifier completion popup showing a list of identifiers starting with ’S’. Continue with the ’e’ character, and identifiers beginning with "Se" display: | ||
Line 496: | Line 726: | ||
Now, to save typing, press down-arrow three times to select [[Sequence]] and press ''Tab''. The function name is inserted into the definition, saving you keystrokes. Now a popup shows you the parameters of the Sequence function and its description. The parameter that you are currently typing appears in bold, with optional parameter in italics. | Now, to save typing, press down-arrow three times to select [[Sequence]] and press ''Tab''. The function name is inserted into the definition, saving you keystrokes. Now a popup shows you the parameters of the Sequence function and its description. The parameter that you are currently typing appears in bold, with optional parameter in italics. | ||
− | + | {{CalloutAnnotationBlock|[[Image:Chapter_4.67-updated.png]]| | |
+ | {{CalloutAnnotation| | ||
+ | Finish typing: Sequence(20,50,5)|v=25|pt=265,46|path=tU10-|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | As you type, watch the bolding progress.|v=95|pt=335,111|path=r-|n=+}} | ||
+ | {{CalloutAnnotation| | ||
+ | Press the green check.|v=165|pt=238,37|path=*|n=+}} | ||
+ | }} | ||
==Saving your model== | ==Saving your model== | ||
Line 546: | Line 783: | ||
* [[The Expression popup menu]] | * [[The Expression popup menu]] | ||
* [[Tutorial videos]] | * [[Tutorial videos]] | ||
− | |||
</div> | </div> | ||
<footer>Tutorial: Analyzing a model/ {{PAGENAME}} / Tutorial: Arrays</footer> | <footer>Tutorial: Analyzing a model/ {{PAGENAME}} / Tutorial: Arrays</footer> |
Latest revision as of 20:27, 1 May 2024
Release: |
4.6 • 5.0 • 5.1 • 5.2 • 5.3 • 5.4 • 6.0 • 6.1 • 6.2 • 6.3 • 6.4 • 6.5 |
---|
This chapter shows you how to:
- Create a new model
- Create new variable nodes and enter attributes
- Move and delete variable nodes
- Draw influence arrows to define dependencies between variables
- Define variables as explicit values, functions and lists
- Invoke a built-in function to define a variable
- Do a simple Parametric Analysis
This chapter shows you how to create a new Analytica model.
In the process of building a model to analyze the costs of owning and operating an automobile, you will create variables, define dependencies, add documentary text, and compute results.
If Analytica is not open, start it by double-clicking its icon. If Analytica is already open with an active model go to the File menu, select New Model.
Creating a new model
When you start up a new Analytica session, it shows the Intro screen. Click on '"Start a new model".
The blank model initially shows an Object window for an untitled model. Behind the Object window you will see an empty Diagram window.
First you should enter a Title for your model:
- Click in the Title attribute field (to the right of Title). Type in Car cost model and press Alt- enter. In the space just above the Title you entered, you will see that the Identifier field automatically changes to Car_cost_model.
- Press Tab to go to the Description attribute and type in: A demonstration model to show how to calculate the cost of running a car
Editing a diagram
In most of the three previous chapters you were in the browse mode, with the browse tool highlighted in the tool palette. In browse mode you can view an existing model without changing its structure. When you create a new model the edit tool
is selected by default. You use the edit tool to create or change a model.
Be sure to note which tool is selected throughout the remainder of this tutorial.
When the edit tool is selected, a menu of icons is displayed in the node palette. These icons represent the different node types and allow you to add nodes to the diagram.
Creating variable nodes
In this chapter you will create variables in the Car Cost model.
Each variable is represented in the influence diagram as a shape that depicts the Class of Variable. These shapes are generally referred to as nodes. Select the node shape based on what you know about the variable. If you are not sure what kind of variable to use, choose a General variable .
See Tutorial: Recognizing influence diagrams for a description of the node shapes.
Repeat Steps 1 and 2 four times to create four more variables that affect fuel cost. Title these variables as follows:
- Fuel Price (price per gallon of gasoline)
- Annual miles (number of miles driven each year)
- Mpg (miles per gallon of gasoline)
- Age (driver’s age)
Title text wraps to fit within the node as you type. You can manually create a new line in a title by pressing the Enter key at the desired break point(s). You can also expand the size of the node by dragging one of the corner handles.
Saving your model
Analytica automatically saves each change you make to a backup file. If your computer (or Analytica) should terminate unexpectedly, it will offer to recover your changes the next time you start Analytica. Even so, it’s a good idea to save your changes periodically.
- Select Save from the File menu (or press Control-s). The first time you try to save a model, it shows a Save As dialog, offering to save the model in the My Documents folder using the model Title as the default file name. You can select another folder and modify the file name.
- Click Save or press Enter to save the model in the selected folder.
Deleting a variable
Sometimes you might want to delete a variable that you previously created.
In this example you realize that the driver’s age is not relevant to your understanding of the Fuel Cost variable. Therefore, you will delete the Age variable.
Analytica asks you to confirm that you want to delete.
Moving nodes
When you create a model you should try to structure the layout to make the influence diagram easy to understand. As you refine your model, however, you will undoubtedly want to group nodes in different ways to achieve this goal.
In this case we anticipate that Fuel Cost will be derived from the other three variables. Therefore we want to place it apart.
Moving nodes is a simple matter of dragging them to the desired position. Try moving the nodes into the new configuration below.
Editing variable titles
The name displayed inside each variable node is referred to as a Title. In this example you will expand the title Mpg to Miles per gallon:
Pause briefly between the click to select the node and the click to select the text within it. If you complete two single-clicks too quickly, Analytica interprets your actions as a double-click and opens an Object window.
If you accidentally open the Object window, return to the Diagram window by clicking the Diagram button .
When you change the title of a node, Analytica asks you if you want the Identifier to be automatically changed as well.
You can change this behavior, to either turn off automatic updating of the identifier or to make it fully automatic, so that you are not asked. See Preferences dialog in the Analytica User Guide for details.
Drawing arrows between nodes
One of Analytica’s most powerful features is its ability to show relationships between variables in the influence diagram. Influence arrows are used to specify the dependencies between variables.
Because the Miles per gallon variable influences the Fuel Cost variable, you will draw an arrow connecting the two nodes.
If the nodes are not connected by an arrow, repeat Steps #1 through #3.
Deleting an arrow
Occasionally, you might need to delete an arrow because of an earlier mistake or a change in your understanding of the model. This section shows you how to delete the arrow that connects Miles per gallon to Fuel Cost.
First, make sure you have the edit tool selected.
Connecting multiple arrows
When one variable is influenced by several other variables, you can draw multiple arrows at once. This example shows you how to connect the three variables contributing to the Fuel Cost variable.
First make sure the edit tool is selected.
(Hold down Control or Shift while selecting or drag diagonally across the group.)
Bending arrows
As your diagrams become more complex, you may sometimes need to bend your arrows around nodes for clarity. Bent arrows can be either curved or crisp. Bent arrows contain way points, which define where the arrow changes directions. . You can insert or remove way points to alter the number of segments in an arrow, and drag the way points to route the arrow as you like.
When you first select an arrow without a bend, two handles appear near the midpoint -- one is a circle, the other is a square. Drag the circle to create a curved arrow initially, or drag the square to create a crisp bend. As you drag it, you introduce the first way point.
And we have two arrows with crisp bends:
To remove the bends, right-click on the arrow and select Remove all way points.
Entering attributes into the Object window
Each variable (or other Object) has an Object window that lets you see and edit its Attributes - including its Identifier, Title, Units, Description and Definition.
In this section we will use the Object window to enter attributes for the Annual Miles variable.
You can also open a variable’s Object window by double-clicking the node using the browse or arrow tools. If you are using the browse tool, you will not be able to enter or change documentation.
The identifier in the Object window shown above is Annual_miles. Analytica assigns the identifier when the title is created. It uses the first 20 characters of the title except for spaces or punctuation, which are replaced by underscores ( _ ). Analytica does not differentiate between uppercase and lowercase letters in identifiers.
You can directly edit both the identifier and the title.
First, you will change the variable’s identifier to a short abbreviation so that it can easily be used later in the definitions of other variables. You will then document the variable more fully.
Analytica uses the information from the Units field to label graphs or tables that use the Miles per year variable; Analytica does not use it in any mathematical computations.
When you change the title of a node, Analytica asks you if you want it to automatically change the identifier to match the new title.
Defining a variable as an explicit value
Analytica uses a wide range of variable types. In this section we simply enter an explicit value for the variable. Functional expressions and lists are described later in this chapter. Other variable types are addressed in later chapters.
For variables as functional expressions see Defining a variable as a function of other variables.
For variables as lists see Defining a variable as a list.
For variable as tables see Tutorial: Arrays.
For a demonstration of built-in functions see Defining a variable using a built-in function.
First let’s define Miles per year as 12,000.
Numerical suffixes like μ and K are used extensively throughout Analytica. A quick reference for these suffixes is given in Number formats.
Whenever another variable’s definition includes the identifier (Mpy) of Miles per year, this defined value, 12K, is used as its value.
Miles per year is no longer filled with a diagonal line pattern around its title, as shown in the figure below. The clear node indicates that Miles per year now has a valid definition.
Defining a variable as a function of other variables
When one variable is dependent upon another variable, you must provide an expression that describes the relationship between the variables. Influence arrows connecting other nodes to Fuel Cost show the direction of this dependency.
In this section, you will enter a definition for Fuel Cost in terms of the values of Miles per year, Miles per gallon, and Fuel Price.
Because Fuel Cost is equal to Fuel Price times miles driven, divided by miles per gallon, you will enter the following expression into the Definition field:
Fuel_Price*Mpy/Mpg
An asterisk (*
) represents multiplication; a slash (/
) represents division.
Based on the definition you just entered, the value of Fuel Cost is calculated by multiplying the values of Fuel Price and Miles per year, and then dividing the result by the value of Miles per gallon.
Entering attributes using the Attribute panel
Sometimes you may find it more convenient to view or edit attributes of a variable in the Attribute panel as part of the Diagram view instead of using a separate Object window.
In this section, you will enter data for the Fuel Price variable in the Attribute panel.
The Attribute panel appears below the diagram. You can use this view to enter or edit data for the currently selected variable in the influence diagram.
Now that you have entered attributes for the Fuel Price variable, you will enter its definition in the Attribute panel.
In this example we will assume that Fuel Price has a fixed value of $3 per gallon.
Select Definition from the Attribute dropdown menu and enter 3.
Defining a variable as a list
In this section you will enter attributes for the Miles per gallon variable and define it as a sequence of numbers. You will use this sequence later to perform a Parametric analysis to show how the Fuel Cost is affected by Miles per gallon.
Using the Attribute panel, enter Average number of miles per gallon for the description and miles/gallon for the units.
Now that you have entered attributes for the Miles per gallon variable, you will define it as a sequence of integers between 20 and 50, by increments of 10.
Select Definition from the Attribute dropdown menu. You will notice a second popup menu appears to the right. This is the Expression popup menu. Open the Expression popup menu and select list.
Although the auto-fill feature makes it convenient to enter a simple linear sequence, you are free to edit the values as you please.
Now you will use the Expression view to see the variable’s definition in a different form. The Expression view shows the full syntax of the definition regardless of the type of variable.
Viewing results in the Result window
Now that you have entered attributes and definitions for all variables it is time to see the result. The Results button calculates values for all selected variables.
Select the Fuel Cost node and click the Results button .
The Result window appears. Icons in the upper left corner of the Result window control the view mode. Tabular form is the default.
The default view for the Results window can be changed. See the Preferences dialog in the Analytica User Guide for details.
Click the graph button to view the results in graph view.
Defining a variable using a built-in function
Analytica offers a wide array of built-in functions to simplify the process of defining variables. In this example we will take advantage of the Sequence function to re-define the Miles per gallon variable.
Let’s suppose you want to change the sequence such that the interval between Miles per gallon values is 5 instead of 10.
Select the Miles per gallon variable. Make sure that the Attribute window is open and Definition is selected.
Next, open the Expression popup menu and select Other at the bottom of the list. This opens the Object finder where you will find a large collection of built-in functions. Analytica will prompt to confirm that you want to replace the current definition of the variable. Click OK.
The Sequence function is contained in the Array library, under Creating lists. Choose Creating Lists'" under the Array library from the Library popup menu.
Scroll down the list and select Sequence.
Enter 20 for the start value, 50 for the end value, and 5 for the step. (Leave the strict field blank.) Click OK.
The new definition is displayed in the Attribute panel.
Select the Fuel Cost variable and click the Results button . The result shows improved precision with the smaller Miles per gallon intervals.
Expression Assist
As you type textual expressions into definitions, Expression Assist provides continual context sensitive identifier completion and help on functions and their parameters. Next you will erase and re-enter the definition for miles per gallons, typing it textually this time rather than using the Object Finder, in order to acquaint you with Expression Assist.
On the diagram, select Miles per gallon and press the Object Window button on the tool bar.
Now you are ready to begin typing the definition anew. Press the ’S’ character and notice the identifier completion popup showing a list of identifiers starting with ’S’. Continue with the ’e’ character, and identifiers beginning with "Se" display:
Now, to save typing, press down-arrow three times to select Sequence and press Tab. The function name is inserted into the definition, saving you keystrokes. Now a popup shows you the parameters of the Sequence function and its description. The parameter that you are currently typing appears in bold, with optional parameter in italics.
Saving your model
After you have created part or all of a model, you should save it. Select Save from the File menu (or press control-s). Because you previously saved your model, it is saved with the original name. You can quit Analytica by choosing exit from the File menu or closing the Analytica window.
Summary
In this chapter you have:
- Started a new model
- Created new variables
- Entered attributes for variables in two different ways: using the Objects window and the Attributes window
- Re-arranged variable nodes to improve the appearance of your influence diagram
- Drawn arrows to establish relationships between variables
- Defined variables as explicit values, functions and lists
- Used a built-in function to define a variable
- Displayed the result of a simple parametric analysis
In the next chapter, you will extend the Car Cost model to include tables of data.
See Also
- Create a model
- Create and edit a model
- Create and save a model
- Create and edit nodes
- To open or exit a model
- Combining models into an integrated model
- Test and debug your model
- Tutorial: Sharing a model with ACP
- Example Models
- Example Models and Libraries
- Analytica User FAQs/Modeling issues
- Working with Large Models
- Object Window
- Definition menu
- Local Values
- Tutorial: Defining a variable as a table
- Attributes
- Manage attributes
- To edit an attribute
- Attribute panel
- Draw arrows
- Tutorial: Drawing arrows between variables
- Draw arrows between modules
- Parametric analysis
- Result window
- Graph view of a result
- Table view of a result
- Expression Assist
- The Expression popup menu
- Tutorial videos
Enable comment auto-refresher