Reporter > Applying statistical tests > Net difference test > Example of the net difference test
 
Example of the net difference test
Sample script file: NetDifferenceTest.mrs
This example script is based on the SkiDemo sample data set.
In this example, a new variable that combines categories from the ownski and repeat variables forms the top of the table and the age variable forms the side.
Here is the script to add the test to the table:
TableDoc.Default.Statistics.Add("NetDifference")
TableDoc.Default.Statistics.NetDifference.SigLevel = 5
This is the section of script that creates the table:
TableDoc.Tables.AddNew("Table1", "!
class *
axis({element1 'own skis not visited before'
expression('ownski={own} and repeat={no}'),
element2 'own skis visited before'
expression('ownski={own} and repeat={yes}'),
element3 'rented skis not visited before'
expression('ownski={rented} and repeat={no}'),
element4 'rented skis visited before'
expression('ownski={rented} and repeat={yes}'), ntd()})
'Ski ownership and previous visits'
!", "Net difference test")
Notice the net difference element (ntd()) in the specification for the top axis.
Here is the resulting table:
The test is based on proportions; that is, it takes the value in each row as a proportion of the total for the whole column. For each row (socio-economic class in this example) it finds the difference for this value (the proportion of the whole column) between those who have not visited the resort before and those who have visited before. It does this separately for two groups of people, those who own their skis (the first and second columns) and those who rent them (the third and fourth columns). It then finds the overall difference between the two groups of people, ski owners and ski renters. This results in a single value for each row, which is then tested against the base for the column to see if it is significantly different from the column as a whole. If the result is found to be significant for any row, an S is placed in the net difference column for that row.
The net difference test in this example shows that there is a significant difference for the AB and the C2 socio-economic classes.
See also
Net difference test