Difference between revisions of "CorrespondenceMethod"
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
[[category:Attributes]] | [[category:Attributes]] | ||
− | + | == Attribute CorrespondenceMethod == | |
− | |||
− | = Attribute CorrespondenceMethod = | ||
− | |||
Used as an attribute on an object that serves as an index for an edit [[Table]], [[DetermTable]] or [[ProbTable]]. Controls how correspondence between previous and new index values is determined when the index value changes. | Used as an attribute on an object that serves as an index for an edit [[Table]], [[DetermTable]] or [[ProbTable]]. Controls how correspondence between previous and new index values is determined when the index value changes. | ||
− | Possible Values: | + | ===Possible Values=== |
− | + | :<code>1</code> : Positional | |
− | 1 : Positional | + | :<code>2</code> : Associative |
− | + | :<code>3</code> : Flexible Associative (current default) | |
− | 2 : Associative | ||
− | |||
− | 3 : Flexible Associative (current default) | ||
− | |||
− | |||
+ | == Description == | ||
When an index definition changes, where some elements might be removed, others added, some existing elements renamed, and some existing elements potentially re-ordered, edit tables that use that index need to be re-adjusted. In some cases, the correspondence between the old index elements and new index elements may be ambiguous. This is particularly the case when when the index value is computed. | When an index definition changes, where some elements might be removed, others added, some existing elements renamed, and some existing elements potentially re-ordered, edit tables that use that index need to be re-adjusted. In some cases, the correspondence between the old index elements and new index elements may be ambiguous. This is particularly the case when when the index value is computed. | ||
− | The CorrespondenceMethod attribute determines the method Analytica uses to determine this correspondence. Consider the following example | + | The [[CorrespondenceMethod]] attribute determines the method Analytica uses to determine this correspondence. Consider the following example of an 1D edit table indexed by <code>Year</code>. |
− | {| | + | Let |
− | ! Year | + | :<code>Index Year := 2007..2010</code>. |
− | + | :<code>Variable Contribution :=</code> | |
− | + | :{| class="wikitable" | |
+ | ! colspan="4" | Year ▶ | ||
|- | |- | ||
− | ! 2008 | + | ! 2007 |
+ | ! 2008 | ||
+ | ! 2009 | ||
+ | ! 2010 | ||
|- | |- | ||
− | + | | $2500 | |
− | | | + | | $3000 |
− | + | | $3200 | |
+ | | $3400 | ||
|} | |} | ||
− | |||
− | Now, Year is changed to 2006..2011 | + | Now, <code>Year</code> is changed to <code>2006..2011</code>. |
− | + | The two most basic correspondence methods, '''pure positional''' and '''pure associative''', would result in the following respective adjustments to the '''Contribution''' edit table. | |
− | + | ||
− | {| | + | :<code>Variable Contribution →</code> |
+ | :{| class="wikitable" | ||
|+ '''Pure Positional Correspondence''' | |+ '''Pure Positional Correspondence''' | ||
+ | ! colspan="6" | Year ▶ | ||
|- | |- | ||
− | ! 2006 | + | ! 2006 |
+ | ! 2007 | ||
+ | ! 2008 | ||
+ | ! 2009 | ||
+ | ! 2010 | ||
+ | ! 2011 | ||
|- | |- | ||
− | + | | $2500 | |
+ | | $3000 | ||
+ | | $3200 | ||
+ | | $3400 | ||
+ | | | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | |||
+ | :<code>Variable Contribution →</code> | ||
+ | :{| class="wikitable" | ||
+ | |+ '''Pure Associative Correspondence''' | ||
+ | ! colspan="6" | Year ▶ | ||
|- | |- | ||
− | ! 2008 | + | ! 2006 |
+ | ! 2007 | ||
+ | ! 2008 | ||
+ | ! 2009 | ||
+ | ! 2010 | ||
+ | ! 2011 | ||
|- | |- | ||
− | + | | | |
− | + | | $2500 | |
− | + | | $3000 | |
− | + | | $3200 | |
− | + | | $3400 | |
− | + | | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
|} | |} | ||
Line 76: | Line 81: | ||
Flex associational, the default used, corresponds by association when it can (i.e., when the same element appears in both old and new), but draws on positional correspondence between paired elements, which helps to preserve data when an element is basically renamed. Thus, flex associational preserves more data than pure associational. | Flex associational, the default used, corresponds by association when it can (i.e., when the same element appears in both old and new), but draws on positional correspondence between paired elements, which helps to preserve data when an element is basically renamed. Thus, flex associational preserves more data than pure associational. | ||
− | To change the CorrespondenceMethod attribute for an index, use typescript, e.g.: | + | To change the [[CorrespondenceMethod]] attribute for an index, use [[typescript]], e.g.: |
− | + | :<code>CorrespondenceMethod In1 : 1</code> | |
+ | Note: In build 4.0.0.34, if the number of elements does not change, pure associational reverts to positional. However, this will be changed. Flex Associational will revert to positional if the number of elements is not changed, but Pure Positional (1) will not. | ||
− | Note | + | <tip title="Note">Remember that [[CorrespondenceMethod]] is a property of the Index, not of the table. |
+ | </tip> | ||
+ | |||
+ | == See Also == | ||
+ | * [[Associative vs. Positional Indexing]] | ||
+ | * [[Table Splicing]] |
Latest revision as of 02:51, 13 January 2016
Attribute CorrespondenceMethod
Used as an attribute on an object that serves as an index for an edit Table, DetermTable or ProbTable. Controls how correspondence between previous and new index values is determined when the index value changes.
Possible Values
1
: Positional2
: Associative3
: Flexible Associative (current default)
Description
When an index definition changes, where some elements might be removed, others added, some existing elements renamed, and some existing elements potentially re-ordered, edit tables that use that index need to be re-adjusted. In some cases, the correspondence between the old index elements and new index elements may be ambiguous. This is particularly the case when when the index value is computed.
The CorrespondenceMethod attribute determines the method Analytica uses to determine this correspondence. Consider the following example of an 1D edit table indexed by Year
.
Let
Index Year := 2007..2010
.Variable Contribution :=
Year ▶ 2007 2008 2009 2010 $2500 $3000 $3200 $3400
Now, Year
is changed to 2006..2011
.
The two most basic correspondence methods, pure positional and pure associative, would result in the following respective adjustments to the Contribution edit table.
Variable Contribution →
Pure Positional Correspondence Year ▶ 2006 2007 2008 2009 2010 2011 $2500 $3000 $3200 $3400
Variable Contribution →
Pure Associative Correspondence Year ▶ 2006 2007 2008 2009 2010 2011 $2500 $3000 $3200 $3400
There are cases where either form of correspondence may be more desirable. In general, pure associational correspondence may lose more data than positional, since if the original element is removed, the data for that row may be lost.
Flex associational, the default used, corresponds by association when it can (i.e., when the same element appears in both old and new), but draws on positional correspondence between paired elements, which helps to preserve data when an element is basically renamed. Thus, flex associational preserves more data than pure associational.
To change the CorrespondenceMethod attribute for an index, use typescript, e.g.:
CorrespondenceMethod In1 : 1
Note: In build 4.0.0.34, if the number of elements does not change, pure associational reverts to positional. However, this will be changed. Flex Associational will revert to positional if the number of elements is not changed, but Pure Positional (1) will not.
Enable comment auto-refresher