Command Reference : Special Expression Reference
  
Special Expression Reference
The following reference is an alphabetical listing of special expressions that may be used in series assignment and generation, or as terms in estimation specifications.
Special Expression Summary
ar autoregressive error specification.
d fractional difference specification.
@expand automatic dummy variables.
ma moving average error specification.
na not available (missing value) code.
pdl polynomial distributed lag specification.
sar seasonal autoregressive error specification.
sma seasonal moving average error specification.
ar
Autoregressive error specification.
Syntax: @ar(arg)
arg: integer or lag range
The AR specification can appear in an ls or tsls specification to indicate an autoregressive component. ar(1) indicates the first order component, ar(2) indicates the second order component, and so on.
You may express a range of AR terms using the “to” keyword between a starting and ending integer.
Examples
The command:
ls m1 c tb3 tb3(-1) ar(1) ar(4)
regresses M1 on a constant, TB3, and TB3 lagged once with a first order and fourth order autoregressive component. The command:
tsls sale c adv ar(1) ar(2) ar(3) ar(4) @ c gdp
performs two-stage least squares of SALE on a constant and ADV with up to fourth order autoregressive components using a constant and GDP as instruments.
tsls sale c adv ar(1 to 4) @ c gdp
estimates an equivalent specification.
Cross-references
See “Time Series Regression” for details on ARMA and seasonal ARMA modeling.
See also sar, ma, and sma.
d
Fractional difference specification.
The D specification can appear in an ls equation specification to indicate that the equation should be estimated with fractional differencing (typically as part of an ARFIMA model).
Examples
The command:
ls m1 c tb3 tb3(-1) ar(1) ar(4) d
regresses M1 on a constant, TB3, and TB3 lagged once with a first order and fourth order autoregressive component and fractional differencing.
Cross-references
See “Time Series Regression” for details on ARMA and seasonal ARMA modeling.
See also sar, ma, and sma.
@expand
Automatic dummy variables.
Create a set of dummy variables that span the unique values of the input series
Syntax: @expand(ser1[, ser2, ser3, ...][, drop_spec])
ser1: series, alpha
ser2...: series, alpha
The @expand expression may be added in estimation to indicate the use of one or more automatically created dummy variables.
The optional drop_spec may be used to drop one or more of the dummy variables. drop_spec may contain the keyword @dropfirst (indicating that you wish to drop the first category), @droplast (to drop the last category), or a description of an explicit category, using the syntax:
@drop(val1[, val2, val3,...])
where each argument corresponds to a category in @expand. You may use the wild card “*” to indicate all values of a corresponding category.
Example
For example, consider the following two variables:
SEX is a numeric series which takes the values 1 and 0.
REGION is an alpha series which takes the values “North”, “South”, “East”, and “West”.
The command:
eq.ls income @expand(sex) age
regresses INCOME on two dummy variables, one for “SEX=0” and one for “SEX=1” as well as the simple regressor AGE.
The @EXPAND statement in,
eq.ls income @expand(sex, region) age
creates 8 dummy variables corresponding to:
sex=0, region="North"
sex=0, region="South"
sex=0, region="East"
sex=0, region="West"
sex=1, region="North"
sex=1, region="South"
sex=1, region="East"
sex=1, region="West"
The expression:
@expand(sex, region, @dropfirst)
creates the set of dummy variables defined above, but no dummy is created for “SEX=0, REGION="North"”. In the expression:
@expand(sex, region, @droplast)
no dummy is created for “SEX=1, REGION="WEST"”.
The expression:
@expand(sex, region, @drop(0,"West"), @drop(1,"North"))
creates a set of dummy variables from SEX and REGION pairs, but no dummy is created for “SEX=0, REGION="West"” and “SEX=1, REGION="North"”.
@expand(sex, region, @drop(1,*))
specifies that dummy variables for all values of REGION where “SEX=1” should be dropped.
eq.ls income @expand(sex)*age
regresses INCOME on regressor AGE with category specific slopes, one for “SEX=0” and one for “SEX=1”.
Cross-references
See “Automatic Categorical Dummy Variables” for further discussion. See also @wexpand.
ma
Moving average error specification.
The ma specification may be added in an ls or tsls specification to indicate a moving average error component. ma(1) indicates the first order component, ma(2) indicates the second order component, and so on.
You may express a range of MA terms using the “to” keyword between a starting and ending integer.
Examples
ls(z) m1 c tb3 tb3(-1) ma(1) ma(2)
regresses M1 on a constant, TB3, and TB3 lagged once with first order and second order moving average error components. The “z” option turns off backcasting in estimation.
ls(z) m1 c tb3 tb3(-1) ma(1 to 4)
estimates the same model but with MA terms from 1 to 4.
Cross-references
See “Time Series Regression” for details on ARMA and seasonal ARMA modeling.
See also sma, ar, and sar.
na
Not available code. “NA” is used to represent missing observations.
Examples
smpl if y >= 0
series z = y
smpl if y < 0
z = na
generates a series Z containing the contents of Y, but with all negative values of Y set to “NA”.
NA values will also be generated by mathematical operations that are undefined:
series y = nrnd
y = log(y)
will replace all positive value of Y with log(Y) and all negative values with “NA”.
series test = (yt <> na)
creates the series TEST which takes the value one for nonmissing observations of the series YT. A zero value of TEST indicates missing values of the series YT.
Note that the behavior of missing values has changed since EViews 2. Previously, NA values were coded as 1e-37. This implied that in EViews 2, you could use the expression:
series z = (y>=0)*x + (y<0)*na
to return the value of Y for non-negative values of Y and “NA” for negative values of Y. This expression will now generate the value “NA” for all values of Y, since mathematical expressions involving missing values always return “NA”. You must now use the smpl statement as in the first example above, or the @recode or @nan function.
Cross-references
See “Missing Values” for a discussion of working with missing values in EViews.
pdl
Polynomial distributed lag specification.
This expression allows you to estimate polynomial distributed lag specifications in ls or tsls estimation. pdl forces the coefficients of a distributed lag to lie on a polynomial. The expression can only be used in estimation by list.
Syntax
pdl(series_name, lags, order[,options])
Options
The PDL specification must be provided in parentheses after the keyword pdl in the following order: the name of the series to which to fit a polynomial lag, the number of lags to include, the order (degree) of polynomial to fit, and an option number to constrain the PDL. By default, EViews does not constrain the endpoints of the PDL.
The constraint options are:
1
Constrain the near end of the distribution to zero.
2
Constrain the far end of the distribution to zero.
3
Constrain both the near and far end of the distribution to zero.
Examples
ls sale c pdl(order,8,3) ar(1) ar(2)
fits a third degree polynomial to the coefficients of eight lags of the regressor ORDER.
tsls sale c pdl(order,12,3,2) @ c pdl(rain,12,6)
fits a third degree polynomial to the coefficients of twelve lags of ORDER, constraining the far end to be zero. Estimation is by two-stage least squares, using a constant and a sixth degree polynomial fit to twelve lags of RAIN.
tsls y c x1 x2 pdl(z,12,3,2) @ c pdl(*) z2 z3 z4
When the PDL variable is exogenous in 2SLS, you may use “pdl(*)” in the instrument list instead of repeating the full PDL specification.
Cross-references
See “Polynomial Distributed Lags (PDLs)” for further discussion.
sar
Seasonal autoregressive error specification.
sar can be included in ls or tsls specification to specify a multiplicative seasonal autoregressive term. A sar(p) term can be included in your equation specification to represent a seasonal autoregressive term with lag . The lag polynomial used in estimation is the product of that specified by the ar terms and that specified by the sar terms. The purpose of the sar expression is to allow you to form the product of lag polynomials.
Examples
ls tb3 c ar(1) ar(2) sar(4)
TB3 is modeled as a second order autoregressive process with a multiplicative seasonal autoregressive term at lag four.
tsls sale c adv ar(1) sar(12) sar(24) @ c gdp
In this two-stage least squares specification, the error term is a first order autoregressive process with multiplicative seasonal autoregressive terms at lags 12 and 24.
Cross-references
See “Background” for details on ARMA and seasonal ARMA modeling.
See also sma, ar, and ma.
sma
Seasonal moving average error specification.
sma can be included in a ls or tsls specification to specify a multiplicative seasonal moving average term. A sma(p) term can be included in your equation specification to represent a seasonal moving average term of order . The lag polynomial used in estimation is the product of that specified by the ma terms and that specified by the sma terms. The purpose of the sma expression is to allow you to form the product of lag polynomials.
Examples
ls tb3 c ma(1) ma(2) sma(4)
TB3 is modeled as a second order moving average process with a multiplicative seasonal moving average term at lag four.
tsls(z) sale c adv ma(1) sma(12) sma(24) @ c gdp
In this two-stage least squares specification, the error term is a first order moving average process with multiplicative seasonal moving average terms at lags 12 and 24. The “z” option turns off backcasting.
Cross-references
See “Background” for details on ARMA and seasonal ARMA modeling.
See also sar, ar, and ma.