Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Keywords for data analysis > Statistical elements > Statistics using analysis elements

Statistics using analysis elements
Defining factors
If the question or derived variable is categorical, you will need to define factors that can be used in the calculations. To do this, append the following to the response definitions in the main part of the response list, not in the axis block.
factor(n)
where n is a positive or negative integer or real number. Responses with no factor are ignored when statistics are calculated.
Creating statistics using Analysis elements and factors
Put statements of the following form in the response list where you want the statistics to appear in tables:
Name ["Text"] [Properties] elementtype(Type)
where:
Name is the element’s unique name.
Text is the text you want to use for this element in analyses (that is, the row or column heading).
Properties is a list of analysis properties that are required for the element you are creating. The property list must be enclosed in square brackets.
Type is the type of element you want to create. This parameter must follow the property list.
Element type keywords
AnalysisMean
The mean value of factors assigned to categorical responses.
Required properties:
CalculationType=Mean
HasNoData=True
ExcludedFromSummaries= True
Optional properties:
CalculationScope= AllElements
AnalysisSampleVariance
The sample variance of factors assigned to categorical responses.
Required properties:
CalculationType= SampleVar
HasNoData=True
ExcludedFromSummaries= True
Optional properties:
CalculationScope= AllElements
AnalysisStdDev
The standard deviation of factors assigned to categorical responses.
Required properties:
CalculationType=StdDev
HasNoData=True
ExcludedFromSummaries= True
Optional properties:
CalculationScope= AllElements
AnalysisStdErr
The standard error of factors assigned to categorical responses.
Required properties:
CalculationType=StdErr
HasNoData=True
ExcludedFromSummaries= True
Optional properties:
CalculationScope= AllElements
Example
Rating "What is your overall rating for the hotel?" categorical [1..1]
{
Excellent factor(5),
VGood "Very good" factor(4),
Satisfactory factor(3),
Poor factor(2),
VPoor "Very poor" factor(1),
RateMean "Mean rating"
[CalculationType=Mean, HasNoData=True, ExcludedFromSummaries=True]
elementtype(AnalysisMean),
RateSD "Std. dev"
[CalculationType=StdDev, HasNoData=True, ExcludedFromSummaries=True]
elementtype(AnalysisStdDev)
};