How to Compare Yearly Patterns Graphically

Statistica how-toPlotting data across time helps to reveal interesting patterns and relationships. This was true of a study of weather and temperature patterns in Illinois that was conducted by Carl von Ende from the Department of Biological Sciences at Northern Illinois University.

The goal was to visually compare the trends in temperate between two years, 2008 and 2009. The data, available from the National Weather Service Forecast Office (of) Central Illinois, gives temperatures (measured in Fahrenheit) and dates when the measurements were taken.

In this article, we will explore the steps needed to create such a plot, including the creation of new variables, using time and date functions and graph customization tools.

The data used to create the graph is presented above. As you can see, there is only one date variable, and we need to obtain from this variable the year for categorization as well as the day of the year for plotting along an axis. Therefore, the first step is creating two variables with this data.

In STATISTICA, select the Data tab. In the Variables group, click the Variables arrow, and from the menu, select Add. In the Add Variables dialog box, add two variables after Temperature (in F).

statistica how-to 'Add Variables' image

After you click OK, two new variables are added to the data file, NewVar1 and NewVar2.

Double-click on the variable header for NewVar1 to display the variable specifications dialog box. Change the variable name to Day_of_Year. In the Long name field, enter a function that returns a numerical code for the day of the year. You can see this function and the required parameters by clicking the Functions button, which displays the Function Browser. In the Category list, click on Date/Time, and in the Item list, scroll down to and click on DTDAYOFYEAR.

Statistica how-to function browser

This is the function that will be used to bring back a numerical code for the day of the year. As you can see from the description of the function, it returns a numerical code between 1 and 366 that represents the day of the year. Close the function browser and return to the variable specification dialog. In the Long name field, type =DTDayOfYear(‘Date’).

Statistica how-to Scatterplot variable specification dialog

When you click OK, a message will be displayed, letting you know whether the expression is correct. If the expression is correct, click Yes and the variable will be renamed and numerical codes for the day of the year will be included in the cases for the variable.

Now, double-click on the variable header for NewVar2, rename the variable Year, and in the Long name field, type =DTYEAR(‘Date’). This will rename the variable and add a four-digit number for the year in each case of the data set.

You will now have the complete data set with two additional variables, Day_of_Year and Year. These variables will be used in the results graph.

Statistica how-to scatterplot data reference table

To create the graph, select the Graphs tab. In the Common group, click Scatterplot.

STATISTICA is designed so that when creating a 2D Scatterplot, the most common options for creating a scatterplot are shown on the Quick tab, as shown below. On the Quick tab of the 2D Scatterplots dialog box, click the Variables button. Select Day_of_Year as the x-axis variable and Temperature (in F) as the y-axis variable. Click OK in the variable selection dialog box. Under Fit type, clear the Linear check box.

Statistica how-to 2D Scatterplots Quick Tab image

On the Categorized tab, in the X-Categories group box, select the On check box. Click the Change Variable button, and select Year as the categorization variable. Click OK. In the Layout group box, select the Overlaid option button.

Statistica how-to 2D Scatterplots Categorized Tab image

Click OK to create the scatterplot graph.

Statistica how-to Scatterplot graph image

We still need to convert the numerical codes to date format and to connect the data points by lines. To do this, double-click in the graph background to display the Graph Options dialog box.

Select the General tab for Plot, and select the Multiple lines check box.

Statistica how-to Scatterplots graph options dialog

Select the Scale Values tab for Axis, and ensure that the X Axis is specified. Then, for the Value format, select Date and the option for 17-Mar. Finally, under Options in the Layout drop-down list, select Perpendicular.

Statistica how-to Scatterplot graph options scale values

Click OK to create a graph that shows the data for Day_of_Year categorized by Year for Temperature (in F), as shown below.

Statistica how-to Scatterplot with multiple lines

About statsoftsa

StatSoft, Inc. was founded in 1984 and is now one of the largest global providers of analytic software worldwide. StatSoft is also the largest manufacturer of enterprise-wide quality control and improvement software systems in the world, and the only company capable of supporting its QC products worldwide, with wholly owned subsidiaries in all major markets (StatSoft has 23 full-service offices, on all continents), and its software is available in more than 10 languages.

Posted on May 30, 2013, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: