Difference between revisions of "CorrespondenceMethod"

 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[category:Attributes]]
 
[[category:Attributes]]
  
(new to 4.0)  Avail as of 4.0.0.34.
+
== 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 =
 
  
 +
== 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.  Here we have a one-D edit table indexed by ''Year''.
+
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>.
  
{| border="1"
+
Let
! Year !! Contribution
+
:<code>Index Year :=  2007..2010</code>.
|-
+
:<code>Variable Contribution :=</code>
! 2007 || $2500
+
:{| class="wikitable"
|-
+
! colspan="4" | Year &#9654;
! 2008 || $3000
 
 
|-
 
|-
! 2009 || $3200
+
! 2007
 +
! 2008
 +
! 2009  
 +
! 2010
 
|-
 
|-
! 2010 || $3400
+
| $2500
 +
| $3000
 +
| $3200
 +
| $3400
 
|}
 
|}
  
Suppose the index '''Year''' is defined as 2007..2010.
 
  
Now, Year is changed to 2006..2011. The two most basic correspondence methods are '''pure positional''' and '''pure associative''', and would result in the following respective adjustments to the ''Contribution'' edit table.
+
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.
  
{| border="0"
+
:<code>Variable Contribution &rarr;</code>
|
+
:{| class="wikitable"
{| border="1"
 
 
|+ '''Pure Positional Correspondence'''
 
|+ '''Pure Positional Correspondence'''
 +
! colspan="6" | Year &#9654;
 
|-
 
|-
! 2006 || $2500
+
! 2006
 +
! 2007
 +
! 2008
 +
! 2009
 +
! 2010
 +
! 2011
 
|-
 
|-
! 2007 || $3000
+
| $2500
 +
| $3000
 +
| $3200
 +
| $3400
 +
|
 +
|
 +
|}
 +
 
 +
 
 +
:<code>Variable Contribution &rarr;</code>
 +
:{| class="wikitable"
 +
|+ '''Pure Associative Correspondence'''
 +
! colspan="6" | Year &#9654;
 
|-
 
|-
! 2008 || $3200
+
! 2006
 +
! 2007
 +
! 2008  
 +
! 2009
 +
! 2010
 +
! 2011
 
|-
 
|-
! 2009 || $3400
+
|
|-
+
| $2500
! 2010 || &nbsp;
+
| $3000
|-
+
| $3200
! 2011 || &nbsp;
+
| $3400
|}
+
|
| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ||
 
{| border="1"
 
|+ '''Pure Positional Correspondence'''
 
|-
 
! 2006 || &nbsp;
 
|-
 
! 2007 || $2500
 
|-
 
! 2008 || $3000
 
|-
 
! 2009 || $3200
 
|-
 
! 2010 || $3400
 
|-
 
! 2011 || &nbsp;
 
|}
 
 
|}
 
|}
  
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.:
  CorrespondenceMethod In1 : 1
+
:<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: 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.
  
= Notes =
+
<tip title="Note">Remember that [[CorrespondenceMethod]] is a property of the Index, not of the table.
 +
</tip>
  
''Remember that CorrespondenceMethod is a property of the Index, not of the table.''
+
== 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 : Positional
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.

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.

Note
Remember that CorrespondenceMethod is a property of the Index, not of the table.

See Also

Comments


You are not allowed to post comments.