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

Appendix D. Operator and Function Reference

The reference material in this section describes basic operators and functions that may be used with series and (in some cases) matrix objects. A general description of the use of these operators and functions may be found in Chapter 6, “Working with Data”, beginning on page 127 of the User’s Guide.

This material is divided into several topics:

Operators.

Basic mathematical functions.

Time series functions.

Descriptive statistics.

By-group statistics.

Additional and special functions.

Trigonometric functions.

Statistical distribution functions.

String functions.

Date functions.

Workfile functions.

Value map functions.

Matrix functions.

Documentation on libraries of more specialized functions is provided elsewhere:

For a description of functions related to string and date manipulation, see “String Function Summary” on page 129 and “Date Function Summary” on page 152.

For details on workfile functions that provide information about each observation of a workfile based on information contained in the structure of the workfile, see Appendix E, “Workfile Functions”, on page 589.

Functions for working with value maps are documented in “Valmap Functions” on page 171 of the User’s Guide.

574—Appendix D. Operator and Function Reference

For a list of functions specific to matrices, see “Matrix Function and Command Summary” on page 44.

Operators

All of the operators described below may be used in expressions involving series and scalar values. When applied to a series expression, the operation is performed for each observation in the current sample. The precedence of evaluation is listed in “Operators” on page 127 of the User’s Guide. Note that you can enforce order-of-evaluation using parentheses.

.

Expression

Operator

Description

 

 

 

+

add

x+y adds the contents of X and Y.

 

 

 

subtract

x–y subtracts the contents of Y from X.

 

 

 

*

multiply

x*y multiplies the contents of X by Y.

 

 

 

/

divide

x/y divides the contents of X by Y.

 

 

 

^

raise to the power

x^y raises X to the power of Y.

 

 

 

>greater than x>y takes the value 1 if X exceeds Y, and 0 other-

 

 

wise.

 

 

 

<

less than

x<y takes the value 1 if Y exceeds X, and 0 oth-

 

 

erwise.

 

 

 

=

equal to

x=y takes the value 1 if X and Y are equal, and 0

 

 

otherwise.

 

 

 

<>

not equal to

x<>y takes the value 1 if X and Y are not equal,

 

 

and 0 if they are equal.

 

 

 

<=

less than or equal

x<=y takes the value 1 if X does not exceed Y,

 

to

and 0 otherwise.

 

 

 

>=

greater than or

x>=y takes the value 1 if Y does not exceed X,

 

equal to

and 0 otherwise.

 

 

 

and

logical and

x and y takes the value 1 if both X and Y are

 

 

nonzero, and 0 otherwise.

 

 

 

or

logical or

x or y takes the value 1 if either X or Y is non-

 

 

zero, and 0 otherwise.

 

 

 

In addition, EViews provides special functions to perform comparisons using special rules for handling missing values (see “Missing Values” on page 132) :

Basic Mathematical Functions—575

@eqna(x,y)

equal to

takes the value 1 if X and Y are equal, and

 

 

0 otherwise. NAs are treated as ordinary

 

 

values for purposes of comparison.

 

 

 

@isna(x)

equal to NA

takes the value 1 if X is equal to NA and 0

 

 

otherwise.

 

 

 

@neqna(x,y)

not equal to

takes the value 1 if X and Y are not equal,

 

 

and 0 if they are equal. NAs are treated as

 

 

ordinary values for purposes of compari-

 

 

son.

 

 

 

Basic Mathematical Functions

These functions perform basic mathematical operations. When applied to a series, they return a value for every observation in the current sample. When applied to a matrix object, they return a value for every element of the matrix object. The functions will return NA values for observations where the input values are NAs, or where the input values are not valid. For example, the square-root function @sqrt, will return NAs for all observations less than zero.

Name

Function

Examples/Description

 

 

 

@abs(x), abs(x)

absolute value

@abs(−3) = 3 .

@ceiling(x)

smallest integer not less

@ceiling(2.34) = 3 ;

 

than

@ceiling(4) = 4 .

 

 

 

@exp(x), exp(x)

exponential, ex

@exp(1) ≈ 2.71813 .

@fact(x)

factorial, x!

@fact(3) = 6 ; @fact(0) = 1 .

 

 

 

@factlog(x)

natural logarithm of the fac-

@factlog(3) = 1.7918 ;

 

torial, loge( x!)

@factlog(0) = 0 .

@floor(x)

largest integer not greater

@floor(1.23) = 1 ;

 

than

@floor(−3.1) = −4 .

 

 

 

@inv(x)

reciprocal, 1 ⁄ x

@inv(2) = 0.5 .

@mod(x,y)

floating point remainder

returns the remainder of x y with

 

 

the same sign as x . If y = 0 the

 

 

result is 0.

 

 

 

@log(x), log(x)

natural logarithm, loge( x)

@log ( 2) ≈ 0.693 ;

 

 

log ( 2.71813) ≈ 1 .

@log10(x)

base-10 logarithm,

@log10(100) = 2 .

 

log10( x)

 

576—Appendix D. Operator and Function Reference

@logx(x,b)

base-b logarithm, logb( x)

@log(256, 2) = 8 .

@nan(x,y)

recode NAs in X to Y

returns x if x<>NA , and y if

 

 

x = NA .

 

 

 

@recode(s,x,y)

recode by condition

returns x if condition s is true; oth-

 

 

erwise returns y .

 

 

 

@round(x)

round to the nearest integer

@round(-97.5) = −98 ;

 

 

@round(3.5) = 4 .

 

 

 

@sqrt(x), sqr(x)

square root

@sqrt(9) = 3 .

 

 

 

Time Series Functions

The following functions facilitate working with time series data. Note that NAs will be returned for observations for which lagged values are not available. For example, d(x) returns a missing value for the first observation in the workfile, since the lagged value is not available.

Name

Function

Description

 

 

 

 

 

d(x)

first difference

( 1 − L )X = X X ( −1 )

 

 

 

where L is the lag operator.

 

 

 

 

 

 

d(x,n)

n-th order difference

( 1

L )nX .

 

 

 

 

 

 

d(x,n,s)

n-th order difference with a

( 1

L )n( 1 − Ls) X .

 

 

seasonal difference at s

 

 

 

dlog(x)

first difference of the logarithm

( 1 − L) log ( X )

.

 

 

= log ( X) − log ( X( −1) )

 

 

 

 

 

 

dlog(x,n)

n-th order difference of the log-

( 1

L )nlog ( X) .

 

 

arithm

 

 

 

dlog(x,n,s)

n-th order difference of the log-

( 1

L )n( 1 − Ls) log ( X) .

 

 

arithm with a seasonal differ-

 

 

 

 

ence at s

 

 

 

 

 

 

 

@movav(x,n)

n-period backward moving

@movav(x, 3)

 

 

average

= ( X + X ( −1 ) + X( −2 ) )

 

 

 

⁄ 3

 

@movsum(x,n)

n-period backward moving

@movsum(x,3)

 

 

sum

= ( X + X ( −1 ) + X( −2 ) )

 

 

 

 

 

 

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