Desktop User Guides > Professional > Table scripting > Statistical tests > Column means test > Examples of the column means test
 
Examples of the column means test
Sample script file: QuanvertTables.mrs
This example script is based on the Museum sample data set. See Running the sample table scripts for information on running the example scripts.
The column means test in this example tests whether there are any significant differences between:
The mean age of all respondents who do and do not have a biology qualification
The mean age of the male respondents who do and do not have a biology qualification
The mean age of the female respondents who do and do not have a biology qualification
This graphic is described in the surrounding text.
Notice that UNICOM Intelligence Professional has assigned IDs to all of the columns in the test. Because this is a nested table, the Yes and No columns formed from the categories of the child variable (biology) are repeated for each element of the parent variable (gender). UNICOM Intelligence Professional performs the column means test separately for each set of columns formed from the categories of the biology variable. Notice how this is reflected in the footnote text.
The first set of Yes and No columns in the table (with IDs A and B respectively) are nested within the Base column of the gender parent variable. They therefore relate to all of the respondents, both male and female. The A below the cell contents in the Mean age row in the No column indicates that the mean age of the respondents in this column is higher than the mean age of the respondents in the Yes column and that the difference is statistically significant at the 5% significance level.
The second set of Yes and No columns in the table (with IDs C and D respectively) relate to the male respondents. The C in the No column also indicates that the mean age of the respondents in this column is higher than the mean age of the respondents in the Yes column and that the difference is statistically significant at the 5% significance level.
The third set of Yes and No columns in the table (with IDs E and F respectively) relate to the female respondents. UNICOM Intelligence Professional has not displayed any IDs in the mean age row in these columns, because the difference in mean age is not statistically significant at the 5% significance level.
The column means test in this table shows us that the difference in mean age between the respondents who have and do not have a biology qualification is significant at the 5% significance level, but that this is only true for the male respondents and the whole sample. It is not true for the female respondents.
This example was created using the Museum Quanvert database, in which the age variable has a built-in mean element based on the raw age data. Here is the script to load the Museum data, create the table, and run the test:
Dim TableDoc

' Create the Table Document object
Set TableDoc = CreateObject("TOM.Document")
' Load the Museum sample .mdd file
TableDoc.DataSet.Load("[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\ Data\Quanvert\Museum\qvinfo", "mrQvDsc")
...
TableDoc.Tables.AddNew("Table3", "age * gender > biology{Base(),
  Yes, No}",
"Table of Age by Biology within Gender with column means test")
' Remove the column percentages cell item and
' define the column means test
TableDoc.Table3.CellItems.Remove(1)
TableDoc.Table3.Statistics.Add("ColumnMeans")
Example of testing different columns
The previous example describes the results of testing the default selection of columns. However, it is possible to test other combinations of columns instead. For example, you might want to test for significant differences between:
The mean age of holders of a biology qualification who are male and those who are female
The mean age of those without a biology qualification who are male and those who are female
You can do this by specifying the columns you want to test:
"C/E, D/F"
You can do this by specifying the columns you want to test, using the following line of script:
TableDoc.Table4.Statistics.TestColumns = "C/E, D/F"
This example shows the results of this test:
This graphic is described in the surrounding text.
The result shows that there is a significant difference between the mean ages of male and female holders of a biology qualification (columns C and E).
Example of testing at two significance levels
In the following example, two levels of significance have been specified, to test the same table both at the 5% (higher) and the 10% (lower) level.
This graphic is described in the surrounding text.
Notice that in addition to the IDs assigned to the cells in the previous example, in the third set of Yes and No columns in the table, relating to the female respondents, there is now a lowercase e in the No column. This indicates that the mean age of the respondents in this column is higher than the mean age of the respondents in the Yes column and that the difference is statistically significant at the 10% level.
These lines of script add the two significance levels to the test:
TableDoc.Table5.Statistics.Add("ColumnMeans")
' Set the higher significance level
TableDoc.Table5.Statistics.ColumnMeans.SigLevel = 5
' Set the lower significance level
TableDoc.Table5.Statistics.ColumnMeans.SigLevelLow = 10
See also
Column means test