Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Eviews5 / EViews5 / Docs / EViews 5 Users Guide.pdf
Скачиваний:
196
Добавлен:
23.03.2015
Размер:
11.51 Mб
Скачать

Chapter 7. Working with Data (Advanced)

In addition to the basic tools for working with numeric data outlined in Chapter 6, “Working with Data”, EViews provides additional tools and objects for more advanced data handling, or for working with different kinds of data.

Auto-Updating Series

One of the most powerful features of EViews is the ability to use a series expression in place of an existing series. These expressions generate auto-series in which the expression is calculated when in use, and automatically recalculated whenever the underlying data change, so that the values are never out of date.

Auto-series are designed to be discarded after use. The resulting downside to autoseries is that they are quite transitory. You must, for example, enter the expression wherever it is used; for example, you must type “LOG(X)” every time you wish to use an auto-series for the logarithm of X. For a single use of a simple expression, this requirement may not be onerous, but for more complicated expressions used in multiple settings, repeatedly entering the expression quickly becomes tedious.

For more permanent series expression handling, EViews provides you with the ability to define a series or alpha object that uses a formula. The resulting auto-updating series is simply an EViews numeric series or alpha series that is defined, not by the values currently in the object, but rather by an expression that is used to compute the values. In most respects, an auto-updating series may simply be thought of as a named auto-series. Indeed, naming an auto-series is one way to create an auto-updat- ing series.

The formula used to define an auto-series may contain any of the standard EViews series expressions, and may refer to series data in the current workfile page, or in EViews databases on disk. It is worth emphasizing that in contrast with link objects, which also provide dynamic updating capabilities, auto-updating series are designed to work with data in a single workfile page.

Auto-updating series appear in the workfile with a modified version of the series or alpha series icon, with the numeric series icon augmented by an “=” sign to show that it depends upon a formula.

150—Chapter 7. Working with Data (Advanced)

Defining an Auto-Updating Series

Using the Dialog

To turn a series into an auto-updating series, you will assign an expression to the series and tell EViews to use this expression to determine the series values. Simply click on the Properties button on the series or alpha series toolbar, or select

View/Properties... from the main menu, then select the Values tab.

There are two radio buttons which control the values that will be placed in the numeric or alpha series (“Alpha Series” beginning on page 153). The default set-

ting is either Numeric data or Alphanumeric (text) data (depending on the series type) in which the series is defined by the values currently in the series; this is the traditional way that one thinks of defining a numeric or alpha series.

If instead you select Formula, enter a valid series expression in the dialog box, and click on OK, EViews will treat the series as an auto-updating series and will evaluate the expression, putting the resulting values in the series. Auto-updating numeric series appear with a new icon in the workfile—a slightly modified version of the standard series icon, featuring the series line with an extra equal sign, all on an orange background.

In this example, we instruct EViews that the existing series LOGTAXRT should be an auto-updating series that contains the natural logarithm of the TAXRATE2 series. As with an auto-series expression, the values in LOGTAXRT will never be out of date since they will change to reflect changes in TAXRATE2. In contrast to an auto-series, however, LOGTAXRT is a permanent series in the workfile which may be used like any other series.

You may, at any time, change an auto-updating series into an standard numeric series by bringing up the Values page of the Properties dialog, and clicking on the Numeric data setting. EViews will define then define the series by its current values. In this way you may freeze the formula series values at their existing values, a procedure that is equivalent to performing a standard series assignment using the provided expression.

Auto-Updating Series—151

Note that once an expression is entered as a formula in a series, EViews will keep the definition even if you specify the series by value. Thus, you make take a series that has previously been frozen, and return it to auto-updating by selecting Formula definition.

Issuing a Command

To create an auto-updating series using commands, you should use the formula keyword, frml, followed by an assignment statement. The following example creates a series named LOW that uses a formula to compute values. The auto-updating series takes the value 1 if either INC is less than or equal to 5000 or EDU is less than 13, and takes the value 0 otherwise:

frml low = inc<=5000 or edu<13

LOW is now an auto-updating series that will be reevaluated whenever INC or EDU change.

You may also define auto-updating alpha series using the frml keyword. If FIRST_NAME and LAST_NAME are alpha series, then the declaration:

frml full_name = first_name + " " + last_name

creates an auto-updating alpha series, FULL_NAME.

The same syntax should be used when you wish to apply a formula to an existing series.

series z = rnd

frml z =(x+y)/2

makes Z an auto-updating series that contains the average of series X and Y. Note that the previous values of Z are replaced, and obviously lost. Similarly, we may first define an alpha series and then apply an updating formula:

alpha a = "initial value"

frml a = @upper(first_name)

You may not, however, apply an alpha series expression to a numeric series, or vice versa. Given the series Z and A defined above, the following two statements:

frml z = @upper(first_name)

frml a = (x+y)/2

will generate errors.

Note that once a numeric series or alpha series is defined to be auto-updating, its values may not be modified directly, since they are determined from the formula. Thus, if Z is an auto-updating series, the assignment command:

152—Chapter 7. Working with Data (Advanced)

z = log(x)

will generate an error since an auto-updating series may not be modified. To modify Z you must either issue a new frml assignment or you must first set the values of Z to their current values by turning off auto-updating, and then issue the assignment statement.

To reset the formula in Z, you may simply issue the command:

frml z = log(x)

to replace the formula currently in the series.

To turn off auto-updating for a series, you should use the special expression “@CLEAR” in your frml assignment. When you turn off auto-updating, EViews freezes the numbers or strings in the series at their current values. Once the series is set to current values, it is treated as an ordinary series, and may be modified as desired. Thus, the commands:

frml z = @clear

z = log(x)

are allowed since Z is converted into an ordinary series prior to performing the series assignment.

One particularly useful feature of auto-updating series is the ability to reference series in databases. The command:

frml gdp = usdata::gdp

creates a series in the workfile called GDP that gets its values from the series GDP in the database USDATA. Similarly:

frml lgdp = log(usdata::gdp)

creates an auto-updating series named LGDP that contains the log of the values of GDP in the database USDATA.

Series that reference data in databases are refreshed each time a workfile is loaded from disk. Thus, it is possible to setup a workfile so that its data are current relative to a shared database.

Naming an Auto-Series

If you have previously opened a window containing an ordinary auto-series, you may convert the auto-series into an auto-updating series by assigning a name. To turn an autoseries into an auto-updating series, simply click on the Name button on the toolbar, or select Object/Name... from the main menu, and enter a name. EViews will assign the name to the series object, and will apply the auto-series definition as the formula to use for auto-updating.

Соседние файлы в папке Docs