Skip to main content
Skip table of contents

formulas.xml - SuperCROSS

The formulas XML file is used to define the formulas used for weighting. A single formulas file can be shared by multiple weighted databases.

SuperCROSS uses the settings in this file to automatically create temporary recodes containing derivations and User Defined Fields (UDFs). These are used to calculate the weightings.

File NameDefined in the weightings file.
LocationDefined in the weightings file (typically located in the same directory as the weightings file).

Example

XML
<WEIGHTFORMULAS id="type1"> 
	<TAGS measure="measure" weight="weight" level="level" all="all"/> 
	<LABELTEMPLATE expression="%FUNCTION of %MEASURE, by %WEIGHT"/> 

	<!-- Sum --> 
	<FORMULA id="WSUM" name="Weighted Sum" type="SMSWND"> 
		<!-- Single Measure Single Weight No Derivation --> 
		<UDF id="wx_udf"/> 
	</FORMULA> 
	<FORMULA id="WRSEDC" name="Standard Error of Sum" type="SMSW" level="true"> 
		<!-- Single Measure Single Weight --> 
		<UDF id="wx_udf"/> 
		<UDF id="wxx_udf"/> 
		<COEFF>n</COEFF> 
		<COEFF>N</COEFF> 
		<DER_EXPRESSION>(Sqrt(("wxx_udf" - ("wx_udf"*"wx_udf"/"weight"))/(("weight" - 1) * "level")*"weight"*"weight" + ("N"-"weight")*(1-"n"/"N")*"weight"/"n")) </DER_EXPRESSION> 
	</FORMULA> 
	<FORMULA id="RSEJK1" name="Standard Error of Sum (JK) of Sum" type="SMRW">

		<!-- Single Measure Replicate Weight -->
		<UDF id="wx_udf"/>
		<COEFF>G</COEFF>
		<WEIGHT/>
		<SIGMA id="Sigma">
			<UDF id="wx_udf"/>
			<SIGMA_EXPR>(("wx_udf_i"-"wx_udf")*("wx_udf_i"-"wx_udf"))</SIGMA_EXPR>
		</SIGMA>

		<DER_EXPRESSION>(Sqrt((("G"-1)/"G") * "Sigma"))</DER_EXPRESSION>

	</FORMULA>

	<!-- /Sum --> 

	<!-- percentages --> 
	<FORMULA id="WMEAN" name="%" type="SMSW" dp="1"> 
		<!-- Single Measure Single Weight --> 
		<UDF id="wx_udf"/> 
		<DER_EXPRESSION>("wx_udf"%refF("wx_udf")) </DER_EXPRESSION> 
	</FORMULA> 
	<FORMULA id="WMEAN" name="Standard Error of %" type="SMSW" dp="1"> 
		<!-- Single Measure Single Weight --> 
		<UDF id="wx_udf"/> 
		<UDF id="wxx_udf"/> 
		<COEFF>n</COEFF> 
		<COEFF>N</COEFF> 
		<DER_EXPRESSION>("wx_udf"%refF("wx_udf")) * (Sqrt(("N"/("N"-1)) * (1 - "n"/"N") * ("N"/"n") * ("wx_udf"/"wx_udf" - "wx_udf"/refF("wx_udf"))/"wx_udf")) </DER_EXPRESSION> 
	</FORMULA> 
	<!-- /percentages -->

	<!-- means --> 
	<!-- Statistical Function "Mean"--> 
	<FORMULA id="MEAN" name="Mean" type="SMSF"> 
		<UDF id="x_udf"/> 
		<UDF id="w_udf"/> 
		<MEASURE_FIELD>x_udf</MEASURE_FIELD> 
		<WEIGHT_FIELD>w_udf</WEIGHT_FIELD> 
	</FORMULA> 

	<!-- Statistical Function "Standard Error of Mean"--> 
	<FORMULA id="STANDSEM" name="Standard Error of Mean" type="SMSF"> 
		<UDF id="x_udf"/> 
		<UDF id="w_udf"/>
		<MEASURE_FIELD>x_udf</MEASURE_FIELD> 
		<WEIGHT_FIELD>w_udf</WEIGHT_FIELD> 
	</FORMULA> 

	<!-- Statistical Function "Standard Deviation"--> 
	<FORMULA id="STANDDEV" name="Standard Deviation" type="SMSF"> 
		<UDF id="x_udf"/> 
		<UDF id="w_udf"/> 
		<MEASURE_FIELD>x_udf</MEASURE_FIELD> 
		<WEIGHT_FIELD>w_udf</WEIGHT_FIELD> 
	</FORMULA>

	<!-- Statistical Function "Variance"--> 
	<FORMULA id="VARIANCE" name="Variance" type="SMSF"> 
		<UDF id="x_udf"/>
		<UDF id="w_udf"/> 
		<MEASURE_FIELD>x_udf</MEASURE_FIELD> 
		<WEIGHT_FIELD>w_udf</WEIGHT_FIELD> 
	</FORMULA> 

	<!-- \means --> 

	<!-- GINI --> 
	<!-- Statistical Function "Gini"--> 
	<FORMULA id="GINI" name="Gini" type="SMSF">
		<UDF id="x_udf"/>
		<UDF id="w_udf"/>
		<MEASURE_FIELD>x_udf</MEASURE_FIELD> 
		<WEIGHT_FIELD>w_udf</WEIGHT_FIELD> 
	</FORMULA> 
	<!-- /GINI --> 

	<!-- Unweighted Sum --> 
	<FORMULA id="UWSUM" name="Unweighted Sum" type="UNW"> 
		<!-- Single Measure Single Weight --> 
	</FORMULA>
	<!-- /Unweighted Sum --> 

	<UDF_DEFINITION id="x_udf">
		<UDF_FORMULA>("measure")</UDF_FORMULA> 
	</UDF_DEFINITION> 
	<UDF_DEFINITION id="w_udf"> 
		<UDF_FORMULA>("weight")</UDF_FORMULA> 
	</UDF_DEFINITION> 
	<UDF_DEFINITION id="wx_udf"> 
		<UDF_FORMULA>("measure"*"weight")</UDF_FORMULA> 
	</UDF_DEFINITION>
	<UDF_DEFINITION id="wxx_udf"> 
		<UDF_FORMULA>("measure"*"measure"*"weight")</UDF_FORMULA> 
	</UDF_DEFINITION> 
	<UDF_DEFINITION id="ww_udf">
		<UDF_FORMULA>("weight"*"weight")</UDF_FORMULA>
	</UDF_DEFINITION> 
</WEIGHTFORMULAS> 

Structure

<WEIGHTFORMULAS>
The root node.
<TAGS>
Tags that are used in the temporary derivations and UDFs.
<LABELTEMPLATE>

Defines a template text string (in the expression attribute) that describes the weighted sum of a record type.

  • As shown in the above, the template string can include the placeholders %FUNCTION%MEASURE and %WEIGHT, which will be replaced with the appropriate values when the label is displayed.
  • If the template string does not contain %MEASURE, then the template is used as a prefix for the display name of the Main Weight.
  • If the template string is empty, the Main Weight name will not change.
<FORMULA>

A statistical formula defining the weighting. Each formula has the following attributes:

  • id - a unique ID that identifies this formula.
  • name - the formula name. This will be displayed in the list of available Functions in the Define Recode window in SuperCROSS.
  • type - the formula type. See the Supported Formula Types section below for more details on supported formula types.
<UDF>
Identifies a UDF that will be used in the calculation.
<COEFF>
Identifies a coefficient (defined in the weightings file) that is being used in the calculation.
<WEIGHT>
Identifies a weight that will be used in the calculation.
<SIGMA>

For formulae with replicate weights only. Defines an expression that will be repetitively generated for each replicate weight.

All of these generated expressions will be added together into one expression and substituted into the derivation expression. Use the id attribute of the <SIGMA> node to specify a string identifying the expression. This can then be used in the derivation expression and will be replaced with the result of the sigma expression.

<DER_EXPRESSION>
An expression used to calculate a derivation. Derivations are calculated based on the aggregated results of the fields in the table.
<UDF_DEFINITION>
An expression used to calculate a user defined field. User defined fields are calculated based off the unit records.

Supported Formula Types

The type element of the <FORMULA> tag indicates the type of formula:

SMSW
Single Measure Single Weight

These formulas can be expressed as:

  • A derivation that can be dependent upon any of the following:
    • measure
    • weight
    • level count (need to specify if required)
    • math UDF (possibly more than one)
    • constant coefficients
  • A math UDF, expressed in terms of measure and/or weight. The UDF itself is dependent on measure and weight (only Math UDFs are supported).
SMRW
Single Measure Replicate Weight

These types of formulae are expressed as a derivation that is dependent upon any of the following:

  • measure
  • main weight
  • level count (need to specify if required)
  • UDF (possibly more than one)
  • constant coefficients
  • sigma expression (if required); this defines an expression that will be repetitively generated for each replicate weight. All of these generated expressions will be added together into one expression and substituted into the derivation expression instead of the "id" attribute of the Sigma node (usually "Sigma").

    The Sigma expression is dependent upon any of the following:

      • measure
      • replicate weight and main weight (need to specify if not required)
      • main UDF and replicate UDFs. More than one type of UDF can be used in a Sigma expression.
UNW
Unweighted

This is a dummy formula that will take no effect on the measure (the original result will be displayed). This is required in the XML file.

If you are have configured Perturbation for confidentiality, then tabulation results will not be available when using SuperCROSS client weighting and any of the weighted summation options defined in the formulas.xml file. This is because these custom weighted functions do not have R Keys to allow the perturbed results to be calculated.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.