Weightings - Data Control
To configure the weighting of survey data results in SuperSERVER, you need to create the following two configuration files:
- The weighting configuration file, which defines the weighting parameters.
- The formula file, which defines the available functions.
The weighting configuration file can only be used by one database, but the formula file can be used by more than one database.
Weightings Configuration File
File Name | <SXV4_db_filename>_sa_weightings.xml For example, if the SXV4 filename is Survey.sxv4, the weighting file must be named Survey_sa_weightings.xml |
---|
Location | The same location as the SXV4 database file. For example C:\ProgramData\STR\SuperSERVER SA\databases |
---|
Structure | The structure of this file is as follows: Node | Description |
---|
<DATABASE_WEIGHTINGS> | Root node. This node has the following attributes: dbid - The ID of the database this weighting file applies to.formula_file - The name of the formula XML file.
| <WEIGHT> | The start of the weighting factor definitions. This node has the following attributes: id - The ID of the weighting. For a single weight this should be the display name of the weight field; for replicate weights it can be any name.type - the weighting type (either single or replicate ).level - the name of the table that the weighted field comes from.
| <CODE>Name</CODE> | For replicate weights only. One entry per replicate weight. The name must be the display name of the weighted field from the table in the database. | </WEIGHT> | The end of the weighting factor definitions. | <COEFF> | The start of the constant coefficient used in the formulas. this node has the following attributes: measure - Either the ID of the measure that this coefficient applies to, or all if it applies to all measures.weight_id - The display name of the measure (must be the display name of a column in the database).
| <VAR ... /> | The coefficient definition: id - the name to be used in the coefficient formula (displayed in SuperCROSS).value - the value of the coefficient.
| </COEFF> | End of the coefficient definitions. | </DATABASE_WEIGHTINGS> | End of the database weighting definitions. |
|
---|
Example |
XML
<DATABASE_WEIGHTINGS dbid="VISTA0709WDWE" formula_file="formula.xml">
<WEIGHT id="Trips level replicate weights" type="Replicate" level="TRIPS">
<CODE>TRIPS</CODE>
<CODE>WDWE_RW_0</CODE>
<CODE>WDWE_RW_1</CODE>
<CODE>WDWE_RW_2</CODE>
<CODE>WDWE_RW_3</CODE>
<CODE>WDWE_RW_4</CODE>
<CODE>WDWE_RW_5</CODE>
<CODE>WDWE_RW_6</CODE>
<CODE>WDWE_RW_7</CODE>
<CODE>WDWE_RW_8</CODE>
<CODE>WDWE_RW_9</CODE>
</WEIGHT>
<COEFF measure="all" weight_id="Trips level replicate weights">
<VAR id="G" value="10">
</COEFF>
</DATABASE_WEIGHTINGS>
|
---|
File Name | Defined in the weightings file. |
---|
Location | Must be located in the same directory as the weightings file and the SXV4 database. |
---|
Notes | The "Standard Error of Sum (JK) of Sum" formula shown in the sample below has been implemented in SuperSERVER. The <LABELTEMPLATE> setting lets you configure the text string used to describe the weighted sum of a record type. If formula.xml is used by SuperSERVER and not SuperWEB2, Space-Time Research recommends that the label template contain only "%MEASURE" . This place holder will be replaced by the record type count name of the Main Weight defined in the weightings configuration file. In this case, "%FUNCTION" and "%WEIGHT" are not processed by SuperSERVER and they are copied into the newly created display names. For example:
XML
<WEIGHTFORMULAS id="type1">
<TAGS measure="measure" measure2="measure2" weight="weight" level="level" all="all"/>
<LABELTEMPLATE expression="Weighted sum %MEASURE"/>
...
If the label template does not contain "%MEASURE" , the label template is used as a prefix for the display name of the Main Weight. If the label template is empty, the Main Weight's names will not change.
|
---|
Supported Forumla Types | The type element of the <FORMULA> tag indicates the type of formula. There are three supported types 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
- Sum expression (if required).
“Sum expression” 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. It is required in the XML file, as it has to get displayed as one of the formulae available for the user to choose from. |
---|
|
---|
Example |
XML
<WEIGHTFORMULAS id="type1">
<TAGS measure="measure" measure2="measure2" weight="weight" level="level" all="all"/>
<LABELTEMPLATE expression="%FUNCTION of %MEASURE, by %WEIGHT"/>
...
<!-- Sum -->
<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>
...
</WEIGHTFORMULAS>
|
---|