Difference between revisions of "Weighted statistics and w parameter"

m
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
 
<breadcrumbs>Analytica User Guide > Statistics, Sensitivity, and Uncertainty Analysis > {{PAGENAME}}</breadcrumbs>
 
<breadcrumbs>Analytica User Guide > Statistics, Sensitivity, and Uncertainty Analysis > {{PAGENAME}}</breadcrumbs>
  
Normally, each statistical function gives an equal weight to each sample value in its parameters. You can use the optional parameter «w» for any statistical function to specify unequal weights for its samples. This lets you estimate conditional statistics. For example:
+
 
 +
Normally, each [[Statistical functions|statistical function]] gives an equal weight to each sample value in its parameters. In any statistical function, you can use the optional parameter «w» to specify unequal weights for its samples. This lets you estimate conditional statistics. For example:
  
 
:<code>Mean(X, w: X > 0)</code>
 
:<code>Mean(X, w: X > 0)</code>
  
This computes the mean of <code>X</code> for those samples of <code>X</code> that are positive. In this case, the weight vector contains only zeros and ones. The expression <code>X > 0</code> gives a weight of ''1'' (<code>True</code>) for each sample that satisfies the relationship and ''0'' (False) to those that do not.
+
computes the mean of <code>X</code> for those samples of <code>X</code> that are positive. In this case, the weight vector contains only zeros and ones. The expression <code>X > 0</code> gives a weight of ''1'' (<code>True</code>) for each sample that satisfies the relationship and ''0'' (False) to those that do not.
  
By default, this method works over uncertain samples, indexed by <code>Run</code>. You can also use it to compute weighted statistics over other indexes. For example, if <code>Y</code> is an array indexed by <code>J</code>, you could compute:
+
By default, this method works over uncertain samples, indexed by [[Run]]. You can also use it to compute weighted statistics over other indexes. For example, if <code>Y</code> is an array indexed by <code>J</code>, you could compute:
  
:<code>Mean(Y, I, W: Y > 0)</code>
+
:<code>Mean(Y, I, w: Y > 0)</code>
  
If you set the system variable <code>SampleWeighting</code> to something other than ''1'' (see [[Importance weights]], all statistical functions use <code>SampleWeighting</code> as the default weights, unless you specify parameter «w» with some other weighting array. So, when using importance weighting, all statistics (and uncertainty views) automatically use the correct weighting.
+
If you set the system variable [[SampleWeighting]] to something other than ''1'' (see [[Importance weights]], all statistical functions use [[SampleWeighting]] as the default weights, unless you specify parameter «w» with some other weighting array. So, when using importance weighting, all statistics (and uncertainty views) automatically use the correct weighting.
  
 
==See Also==
 
==See Also==
 
* [[Mean]]()
 
* [[Mean]]()
* [[SampleWeighting]]()
+
* [[SampleWeighting]]
* [[Importance weights]]()
+
* [[Importance weights]]
 
* [[Statistical Functions and Importance Weighting]]
 
* [[Statistical Functions and Importance Weighting]]
  
  
 
<footer>Statistical functions / {{PAGENAME}} / Importance analysis</footer>
 
<footer>Statistical functions / {{PAGENAME}} / Importance analysis</footer>

Latest revision as of 00:39, 22 May 2018


Normally, each statistical function gives an equal weight to each sample value in its parameters. In any statistical function, you can use the optional parameter «w» to specify unequal weights for its samples. This lets you estimate conditional statistics. For example:

Mean(X, w: X > 0)

computes the mean of X for those samples of X that are positive. In this case, the weight vector contains only zeros and ones. The expression X > 0 gives a weight of 1 (True) for each sample that satisfies the relationship and 0 (False) to those that do not.

By default, this method works over uncertain samples, indexed by Run. You can also use it to compute weighted statistics over other indexes. For example, if Y is an array indexed by J, you could compute:

Mean(Y, I, w: Y > 0)

If you set the system variable SampleWeighting to something other than 1 (see Importance weights, all statistical functions use SampleWeighting as the default weights, unless you specify parameter «w» with some other weighting array. So, when using importance weighting, all statistics (and uncertainty views) automatically use the correct weighting.

See Also


Comments


You are not allowed to post comments.