This article describes how to compare time periods when you do not have regular time intervals. For example, you want to compare November against May and May against February. With the same example data, the average statistic of 1.3 is significantly less than Feb ’18 for the first row.
The solution is to create a dummy date variable, and then relabel the time intervals (using a rule). In this post, I explain how you can do this via a worked example.
- A data set with irregular wave data
Create your dummy date variable
Creating a dummy date question is essentially the same as creating a date question, except you give the variable dates that are bogus and regular. I typically set each period at 1001 with each successive wave as a year (so 1001, 1002, 1003, etc). Using a ridiculous date such as 1001 AD means there will never be any doubt that it’s a dummy date variable!
if (dip == 1) Q.EncodeDate(1001,01,01);
else if (dip == 2) Q.EncodeDate(1002,01,01);
else if (dip == 3) Q.EncodeDate(1003,01,01);
else if (dip == 4) Q.EncodeDate(1004,01,01);
- In the Label box, type Dummy Date
- Click OK.
- In the Variable Type column, change the type to Date/TIme.
To view the results,
- Switch to the Outputs tab
- Change the question in the Blue Drop-down menu to Q2 - No. of colas consumed and in the Brown Drop-down menu to Dummy Date.
Apply a rule to change the labels:
In the Automate menu, we have a rule that can manually relabel column labels. It can be found under
- Automate > Browse Online Library > Modifying Headers > Automatically Rename Column Labels.
- In the Old label box, select a label and in the New Label box change it to whatever you want. In this example, we will change it to Feb '18
- Click OK.
- Repeat the process until you have changed all the labels
Set the statistical assumptions
Finally, don’t forget to change the Statistical Assumptions (under Table Options or Project Options) to compare to the previous period for Date questions.
- Select Edit > Table Options > Statistical Assumptions > Test Type > Compare to previous period
The results are as follows: