Command Reference : Function Reference : Function Reference: M
  
Function Reference: M
 
@mae
@makedate
@makediagonal
@makevalidname
@mape
@mav
@mavc
@max
@maxerrcount
@maxes
@maxsby
@mcor
@mcov
@mcovp
@mcovs
@mean
@meansby
@median
@mediansby
@mid
@min
@minner
@mins
@minsby
@minute
@mkurt
@mmax
@mmedian
@mmin
@mnas
@mnrnd
@mobs
@mod
@month
@movav
@movavc
@movcor
@movcov
@movcovp
@movcovs
@movinner
@movkurt
@movmax
@movmedian
@movmin
@movskew
@movstdev
@movstdevp
@movstdevs
@movsum
@movsumsq
@movvar
@movvarp
@movvars
@mrnd
@mse
@mskew
@mstdev
@mstdevp
@mstdevs
@msum
@msumsq
@mvar
@mvarp
@mvars
@mae Mean of absolute error (difference) between series.
@makediagonal Create a matrix with vector placed on a diagonal.
@makedate Convert numeric representation of a date to date number.
@makevalidname Make string into a valid EViews name.
@mape Mean absolute percentage error (difference) between series.
@mav Trailing moving averages (ignore NAs).
@mavc Centered moving averages (ignore NAs).
@max Maximum value.
@maxerrcount Maximum number of errors in a program before halting execution.
@maxes Maximum values (multiple).
@maxsby Maximum values in a series for each specified group.
@mcor Trailing moving correlations (ignore NAs).
@mcov Trailing moving population covariance (no d.f. adjustment; ignore NAs).
@mcovp Trailing moving population covariance (no d.f. adjustment; ignore NAs).
@mcovs Trailing moving sample covariance (d.f. adjusted; ignore NAs).
@mean Arithmetic mean.
@meansby Mean of observations in a series for each specified group.
@median Median.
@mediansby Medians for a series for each specified group.
@mid Substring in middle or from middle to end of string.
@min Minimum value.
@minner Trailing moving inner product of two series (ignore NAs).
@mins Minimum values (multiple).
@minsby Minimum values in a series for each specified group.
@minute Minute of the hour of the observation.
@mkurt Trailing moving kurtosis (ignore NAs).
@mmax Trailing moving maximums (ignore NAs).
@mmedian Trailing moving median (ignore NAs).
@mmin Trailing moving minimums (ignore NAs).
@mnas Trailing moving missing observations.
@mnrnd Matrix of normal random numbers.
@mobs Trailing moving non-missing observations.
@mod Floating point remainder.
@month Month of the year of the observation.
@movav Trailing moving averages (propagate NAs).
@movavc Centered moving averages (propagate NAs).
@movcor Trailing moving population correlations (propagate NAs).
@movcov Trailing moving population covariance (no d.f. adjustment; propagate NAs).
@movcovp Trailing moving population covariance (no d.f. adjustment; propagate NAs).
@movcovs Trailing moving sample covariance (d.f. adjusted; propagate NAs).
@movinner Trailing moving inner product of two series (propagate NAs).
@movkurt Trailing moving kurtosis (propagate NAs).
@movmax Trailing moving maximums (propagate NAs).
@movmedian Trailing moving median (propagate NAs).
@movmin Trailing moving minimums (propagate NAs).
@movskew Trailing moving skewness (propagate NAs).
@movstdev Trailing moving sample standard deviations (d.f. adjusted; propagate NAs).
@movstdevp Trailing moving population standard deviations (non-d.f. adjusted; propagate NAs).
@movstdevs Trailing moving sample standard deviations (d.f. adjusted; propagate NAs).
@movsum Trailing moving sums (propagate NAs).
@movsumsq Trailing moving sums of squares (propagate NAs).
@movvar Trailing moving population variances (non d.f. adjusted; propagate NAs).
@movvarp Trailing moving population variances (non-d.f. adjusted; propagate NAs).
@movvars Trailing moving sample variances (d.f. adjusted; propagate NAs).
@mrnd Matrix of uniform random numbers.
@mse Mean of square error (difference) between series.
@mskew Trailing moving skewness (ignore NAs).
@mstdev Trailing moving sample standard deviation (d.f. adjusted; ignore NAs).
@mstdevp Trailing moving population standard deviations (non-d.f. adjusted; ignore NAs).
@mstdevs Trailing moving sample standard deviations (d.f. adjusted; ignore NAs).
@msum Trailing moving sums (ignore NAs).
@msumsq Trailing moving sums of squares (ignore NAs).
@mvar Trailing moving population variances (non-d.f. adjusted; ignore NAs).
@mvarp Trailing moving population variances (non-d.f. adjusted; ignore NAs).
@mvars Trailing moving population variances (d.f. adjusted; ignore NAs).
@mae
Mean of absolute error (difference) between series.
Computes the mean of the absolute difference between x and y.
Syntax: @mae(x, y, [s])
x: series
y: series
s: (optional) sample string or object
Return: series
EViews will use the current or specified workfile sample.
Examples
Let yf denote in-sample forecasts for the series y. Then
= @mae(yf, y)
returns the MAE between the series y and its forecast.
Cross-references
See also @mape, @mse, @rmse, @smape, and @theil.
@makedate
Convert numeric representation of a date to date number.
Syntax: @makedate(arg1[, arg2[,arg3]], fmt)
arg1: number
args: (optional) number(s) arg2, arg3, ...
fmt: date format
Return: date number
Takes the numeric values given by the arguments arg1, and optionally, arg2, etc. and returns a date number using the required format string, fmt.
If more than one argument is provided, the arguments must be listed from the lowest frequency to the highest, with the first field representing either the year or the hour.
Examples
The expressions,
@makedate(1999, "yyyy")
@makedate(99, "yy")
both return the date number 729754.0 corresponding to 12 midnight on January 1, 1999.
@makedate(199003, "yyyymm")
@makedate(1990.3, "yyyy.mm")
@makedate(1031990, "ddmmyyyy")
@makedate(30190, "mmddyy")
all return the value 726526.0, representing March 1, 1990.
Dates may be created using multiple arguments. The expressions,
@makedate(97, 12, 3, "yy mm dd")
@makedate(1997, 12, 3, "yyyymmdd")
will return the value 729360.0 corresponding to midnight on December 3, 1997. You may provide a subset of this information so that
@makedate(97, 12, "yymm")
returns the value 729358.0 representing the earliest date and time in December of 1997 (12 midnight, December 1, 1997). Likewise,
@makedate(1997, 37, "yyyy ddd")
yields the value 729060.0 (February 6, 1997, the 37th day of the year) and
@makedate(14, 25, 10, "hh mi ss")
fills the series YM with date numbers for observations in the workfile sample.
If Y is a series containing year data, M is a series containing month data, and DT is a series containing day data,
series ymd = @makedate(y, m, dt, "yyyymmdd")
fills the series YMDSTR with date numbers formed using those series, for observations in the workfile sample.
Let MYDATE is a series that contains values with the year and month combined in a single number (e.g., “201011”, “200505”),
mydate = y * 100 + m
series ym = @makedate(mydate, "yyyymm")
Then YM contains the date number associated with MYDATE.
If YVEC is a vector with (hour*10000 + minute*100 + seconds) values,
vector yearvec = @makedate(yvec, "hhmiss")
fills YEARVEC with the date numbers associated with each element of YVEC.
Cross-references
See “Date Formats” and “Translating Ordinary Numbers into Date Numbers” for additional details.
See @datestr for string representations of date numbers.
@makediagonal
Create a matrix with vector placed on a diagonal.
Syntax: @makediagonal(v[, k])
v: vector, rowvector
k: (optional) integer
Return: sym or matrix
Create a square matrix with v placed in the k-th diagonal relative to the main diagonal, and zeros off the diagonal.
If no k value is provided or if k is set to 0, the resulting sym matrix will have the same number of rows and columns as the length of v, and will have v in the main diagonal.
If a value for k is provided, the matrix has the same number of rows and columns as the number of elements in the vector plus k, and will place v in the diagonal offset from the main by k.
Examples
sym s1 = @makediagonal(v1)
matrix m2 = @makediagonal(v1,1)
matrix m4 = @makediagonal(r1,-3)
S1 will contain V1 in the main diagonal; M2 will contain V1 in the diagonal immediately above the main diagonal; M4 will contain R1 in the diagonal 3 positions below the main diagonal. Using the optional k parameter may be useful in creating covariance matrices for AR models. For example, you can create an AR(1) correlation matrix by issuing the commands:
matrix(10,10) m1
vector(9) rho = .3
m1 = @makediagonal(rho,-1) + @makediagonal(rho,+1)
m1 = m1 + @identity(10)
Note that to make a diagonal matrix with the same elements on the diagonal, you may use @identity, multiplied by the scalar value.
Cross-references
See also @getmaindiagonal and @identity.
@makevalidname
Make string into a valid EViews name.
Syntax: @makevalidname(str)
str: string
Return: string
Returns a string containing an uppercased valid EViews name based on str.
If str is a valid name, then the original string str is returned.
If str exceeds the maximum length, the resulting string will be truncated.
If str is not a valid name, invalid characters will be replaced in the new string with “_” prior to the return.
Examples
@makevalidname("re!sult%")
returns the string “RE_SULT_”.
@makevalidname("evname01")
returns the string “EVNAME01”.
If ALPHA1 is an alpha series,
alpha a1 = @makevalidname(alpha1)
returns valid EViews names based on ALPHA1 for each observation in the workfile sample.
If SVEC1 is an string vector,
svector sv1 = @makevalidname(svec1)
returns a string vector containing valid names corresponding to elements of SVEC1.
Cross-references
See also @isvalidname and @getnextname.
@mape
Mean absolute percentage error (difference) between series.
Computes the mean of the absolute percentage difference between x and y.
Syntax: @mape(x, y, [s])
x: series
y: series
s: (optional) sample string or object
Return: number
EViews will use the current or specified workfile sample.
Examples
Let yf denote in-sample forecasts for the series y. Then
= @mape(yf, y)
returns the MAPE between the series y and its forecast.
Cross-references
See also @mae, @mse, @rmse, @smape, and @theil.
@mav
Trailing moving averages (ignore NAs).
n-period trailing moving averages, ignoring NAs.
Syntax: @mav(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the average () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mav(x, 12)
produces a linked series of the moving average of the series x where NAs are ignored.
Cross-references
See also @mavc for a centered moving average.
For the NA-propagating variant of this function, see @movav.
@mavc
Centered moving averages (ignore NAs).
n-period centered moving averages, ignoring NAs.
Syntax: @mavc(x, n)
x: series
n integer, series
Return: series
For each observation and integer ,
If is odd, compute the average of the current, and previous and subsequent observations of a series,
where . If missing values are encountered, the observation is discarded, and the divisor for the mean is adjusted to compensate.
If is even, compute the period centered moving sum, weighting the endpoints by 1/2, then divide by :
where and . If missing values are encountered, the observation is discarded, and the divisor for the mean is adjusted to compensate.
If n is not an integer, the integer floor will be used.
Examples
show @mavc(x, 12)
produces a linked series of the centered moving average of the series x where NAs are ignored.
Cross-references
See also @mav for a trailing moving average.
For the NA-propagating variant of this function, see @movavc.
@max
Maximum value.
Finds the maximum value of the elements of x.
Syntax: @max(x[, s])
x: series, vector, matrix
s: (optional) sample string or object when x is a series and assigning to series
Return: number
The maximum may be written as
where the order statistics represent the data ordered from low to high.
For series calculations, EViews will use the current or specified workfile sample.
Examples
Let x be a series of length 5 whose elements are 1, 3, 5, 4, 2. Then
= @max(x)
returns 5.
Cross-references
See also @imax, @min, and @maxes.
@maxerrcount
Maximum number of errors in a program before halting execution.
Syntax: @maxerrcount
Return: integer
Returns an integer containing the current value of the maximum number of errors that a program may encounter before execution is halted.
May only be used in a program.
Cross-references
See also @errorcount, setmaxerrs, clearerrs, seterr, and seterrcount.
@maxes
Maximum values (multiple).
Vector of the n maximum values of the elements of x.
Syntax: @max(x, n[, s])
x: series, vector, matrix
s: (optional) sample string or object when x is a series and assigning to a series
Return: vector
The maximum n values may be written as
where the order statistics represent the data ordered from low to high.
For series calculations, EViews will use the current or specified workfile sample.
Examples
Let x be a series of length 5 whose elements are 1, 3, 5, 4, 2. Then
= @maxes(x,2)
returns a vector of length 2 whose elements are 5 and 4.
Cross-references
See also @imaxes, @mins, and @max.
@maxsby
Maximum values in a series for each specified group.
Syntax: @maxsby(x, y[y1, y2, ... yn, s])
x: series
y series, alpha
s: (optional) sample string or object
Return: series
Returns the maximum value in x each group defined by distinct values of y.
EViews will use the current or specified workfile sample.
Examples
show @maxsby(x, g1, g2)
produces a linked series of the by-group maximums of the series x, where members of the same group have identical values for both g1 and g2.
Cross-references
See also @minsby.
@mcor
Trailing moving correlations (ignore NAs).
n-period trailing moving Pearson product moment correlations between a pair of variables, with d.f. correction, ignoring NAs.
Syntax: @mcor(x, y, n)
x: series
y: series
n integer, series
Return: series
For each observation and integer , compute the correlations () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mcor(x, y, 12)
produces a linked series of the moving population correlation of the series x and y where NAs are ignored.
Cross-references
See also @mcov for NA-excluding trailing moving covariances
For the NA-propagating variant of this function, see @movcor.
@mcov
Trailing moving population covariance (no d.f. adjustment; ignore NAs).
n-period trailing moving Pearson product moment population covariances between a pair of variables, with no d.f. correction, ignoring NAs.
Syntax: @mcov(x, y, n)
x: series
y: series
n integer, series
Return: series
For each observation and integer , compute the population covariance () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movcov(x, y, 12)
produces a linked series of the moving population covariance of the series x and y where NAs are ignored.
Cross-references
See also @mcovp and @mcovs for NA-excluding covariances.
For the NA-propagating variant of this function, see @movcov.
@mcovp
Trailing moving population covariance (no d.f. adjustment; ignore NAs).
n-period trailing moving Pearson product moment population covariances between a pair of variables, with no d.f. correction, ignoring NAs.
Syntax: @mcovp(x, y, n)
x: series
y: series
n integer, series
Return: series
For each observation and integer , compute the population covariance () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Equivalent to @mcov.
Examples
show @mcovp(x, y, 12)
produces a linked series of the moving population covariance of the series x and y where NAs are ignored.
Cross-references
See also @mcov and @mcovs.
For the NA-propagating variant of this function, see @movcovp.
@mcovs
Trailing moving sample covariance (d.f. adjusted; ignore NAs).
n-period trailing moving Pearson product moment sample covariances between a pair of variables, with d.f. correction, ignoring NAs.
Syntax: @mcovs(x, y, n)
x: series
y: series
n integer, series
Return: series
For each observation and integer , compute the sample covariance () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mcov(x, y, 12)
produces a linked series of the moving sample covariance of the series x and y where NAs are ignored.
Cross-references
See also @mcov and @mcovp.
For the NA-propagating variant of this function, see @movcovs.
@mean
Arithmetic mean.
Computes the arithmetic mean of the elements of x.
Syntax: @mean(x[, s])
x: series, vector, matrix
s: (optional) sample string or object when x is a series and assigning to a series
Return: number
For series calculations, EViews will use the current or specified workfile sample.
Examples
= @mean(x)
returns the sample mean of a series x. If x = @rnd, then @mean(x) will be near 0.5 in large samples.
Cross-references
See also @trmean, @gmean, @hmean, @median, @var, @skew, and @kurt.
@meansby
Mean of observations in a series for each specified group defined by distinct values.
Syntax: @meansby(x, y[y1, y2, ... yn, s])
x: series
y1...yn series, alpha, group
s: (optional) sample string or object
Return: series
Compute the mean of observations in x for group identifiers defined by distinct values of y, using the current or specified workfile sample.
Examples
show @meansby(x, g1, g2)
produces a linked series of by-group means of the series x, where members of the same group have identical values for both g1 and g2.
Cross-references
See also @demeanby.
@median
Median.
Computes the median of the elements of x.
Syntax: @median(x[, s])
x: series, vector, matrix
s: (optional) sample string or object when x is a series and assigning to a series
Return: number
When is odd, the median is the middle ordered-observation and when is even, the median is the average of the two middle ordered-observations. The median may be written as
where the order statistics represent the data ordered from low to high.
For series calculations, EViews will use the current or specified workfile sample.
Examples
Let x be a series of length 6 with observations 1, 2, 3, 4, 5, 6. Then
= @median(x)
returns 3.5.
Cross-references
See also @mean.
@mediansby
Medians for a series for each specified group defined by distinct values.
Syntax: @medians(x, y[y1, y2, ... yn, s])
x: series
y1...yn series, alpha, group
s: (optional) sample string or object
Return: series
Returns the median of x each group defined by distinct values of y, using the current or specified workfile sample.
Examples
show @mediansby(x, g1, g2)
produces a linked series of the by-group sample medians of the series x, where members of the same group have identical values for both g1 and g2.
Cross-references
See also @meansby and @quantilesby.
@mid
Substring in middle or from middle to end of string.
Syntax: @mid(str, n1[, n2])
str: string, alpha, svector
n1: integer, series, vector
n2: (optional) integer, series, vector
Return: string, alpha, svector
Returns n2 characters from str, starting at location n1 and continuing for n2 characters to the right. If you omit n2, it will return all of the remaining characters in the string.
Examples
The command
string s1 = @mid("I doubt it", 5)
assigns “ubt it” to the string object S1, while
string s2 = @mid("I doubt it", 5, 2)
assigns “ub” to S2.
If ALPHA1 is an alpha series,
alpha a1 = @mid(alpha1, 7)
returns the characters beginning with the 7th from the string values of ALPHA1 for each observation in the workfile sample.
If LETTER_ID is a numeric series with integer values from 1 to 26, then
string alphabet = "abcdefghijklmnopqrstuvwxyz"
alpha letter = @mid(alphabet, letter_id, 1)
will lookup the letter associated with each value of LETTER_ID for observations in the workfile sample.
If SVEC1 is an string vector,
svector sv1 = @mid(svec1, 12, 5)
returns an svector beginning at the 12th for 5 characters for each element of SVEC1.
Cross-references
See also @wmid, @left and @right.
@min
Minimum value.
Finds the minimum value of the elements of x.
Syntax: @min(x[, s])
x: data object
s: (optional) sample string or object when x is a series or alpha and assigning to series or alpha
Return: number or string
The minimum may be written as
where the order statistics represent the data ordered from low to high.
For series calculations, EViews will use the current or specified workfile sample.
Examples
Let x be a series of length 5 whose elements are 1, 3, 5, 4, 2. Then
= @min(x)
returns 1.
Cross-references
See also @imin, @mins, and @max.
@minner
Trailing moving inner product of two series (ignore NAs).
n-period moving inner product of two variables for the current and previous observations, ignoring NAs.
Syntax: @minner(x, y, n)
x: series
y: series
n integer, series
Return: series
For each observation and integer , compute the inner product of the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @minner(x, y, 12)
produces a linked series of the moving inner product of the series x and y where NAs are ignored.
Cross-references
See also @msumsq.
For the NA-propagating variant of this function, see @movinner.
@mins
Minimum values (multiple).
Vector or svector the n minimum values of the elements of x.
Syntax: @mins(x, n[, s])
x: data object
s: (optional) sample string or object when x is a series or alpha
Return: vector or svector
The minimum n values may be written as
where the order statistics represent the data ordered from low to high.
For series calculations, EViews will use the current or specified workfile sample.
Examples
Let x be a series of length 5 whose elements are 1, 3, 5, 4, 2. Then
= @mins(x,2)
returns a vector of length 2 whose elements are 1 and 2.
Cross-references
See also @imins, @min, and @maxes.
@minsby
Minimum values in a series for each specified group.
Syntax: @minsby(x, y[y1, y2, ... yn, s])
x: series
y series or alpha
s: (optional) sample string or object
Return: series or alpha
Returns the minimum value in x each group defined by distinct values of y.
EViews will use the current or specified workfile sample.
Examples
show @minsby(x, g1, g2)
produces a linked series of the by-group minimums of the series x, where members of the same group have identical values for both g1 and g2.
Cross-references
See also @maxsby.
@minute
Minute of the hour of the observation.
Syntax: @minute
Return: series
Returns the minute of the hour (0-59) associated with each observation in the workfile.
If the workfile is of lower than minute frequency, all observations will be set to 0.
If the workfile is undated, observations will be set to -1.
Examples
series dt = @minute
saves the minute of the hour into the series DT.
The command
smpl if @hourf >= 50
sets the sample to only include the last 10 minutes of each hour.
Cross-references
See also @day, @hour, @hourf, @month, @quarter, @seas, @second, @weekday, and @year.
@mkurt
Trailing moving kurtosis (ignore NAs).
n-period trailing moving kurtosis, ignoring NAs.
Syntax: @mkurt(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the average using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mkurt(x, 12)
produces a linked series of the moving kurtosis of the series x where NAs are ignored.
Cross-references
See also @mskew for centered moving skewness.
For the NA-propagating variant of this function, see @movkurt.
@mmax
Trailing moving maximums (ignore NAs).
n-period trailing maximums, ignoring NAs.
Syntax: @mmax(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the maximum () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mmax(x, 12)
produces a linked series of maximums based on a 12-period moving window over the series x where NAs are ignored.
Cross-references
See also @mmin for moving minimums.
For the NA-propagating variant of this function, see @movmax.
@mmedian
Trailing moving median (ignore NAs).
n-period trailing moving median, ignoring NAs.
Syntax: @mmedian(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the median using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mmedian(x, 12)
produces a linked series of the moving median of the series X where NAs are ignored.
Cross-references
See also @mav.
For the NA-propagating variant of this function, see @movmax.
@mmin
Trailing moving minimums (ignore NAs).
n-period trailing minimums, ignoring NAs.
Syntax: @mmin(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the minimum () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mmin(x, 12)
produces a linked series of minimums based on a 12-period moving window over the series x where NAs are ignored.
Cross-references
See also @mmax.
For the NA-propagating variant of this function, see @movmin.
@mnas
Trailing moving missing observations.
n-period trailing number of missing observations, ignoring NAs.
Syntax: @mnas(x, n)
x: series, alpha
n integer, series
Return: series
For each observation and integer , count the number of missing (NA) observations in the current and previous observations of the series,
Equivalent to @movnas.
Examples
show @mnas(x, 12)
produces a linked series of NA counts based on a 12-period moving window over the series x.
Cross-references
See also @mobs.
@mnrnd
Matrix of normal random numbers.
Syntax: @mnrnd(n1[, n2])
n1: integer
n2: (optional) integer
Return: matrix
Creates a matrix filled with normal random numbers. The size of the matrix is given by the integers n1 (number of rows) and n2 (number of columns).
Examples
matrix m1 = @mnrnd(3,2)
creates a matrix filled with standard normal random numbers.
If n2 is omitted or set to 1, the function returns a vector as in
vector v1 = @mnrnd(18)
You may obtain a random sym of normal numbers by creating a square source matrix of random normals and assigning it to a sym matrix,
sym s1 = @mnrnd(5, 5)
which creates the sym S1 based on the lower triangle of the source matrix.
Cross-references
See also @mrnd, nrnd, and rnd.
@mobs
Trailing moving non-missing observations.
n-period trailing number of non-missing observations, ignoring NAs.
Syntax: @mobs(x, n)
x: series, alpha
n integer, series
Return: series
For each observation and integer , count the number of non-missing (non-NA) observations in the current and previous observations of the series,
Equivalent to @movobs.
Examples
show @mobs(x, 12)
produces a linked series of non-NA counts based on a 12-period moving window over the series x.
Cross-references
See also @mnas.
@mod
Floating point remainder.
Syntax: @mod(x, y)
x: number
y: number
Return: number
For non-zero , returns the decimal remainder of with the same sign as
where is the integer floor function.
If returns 0.
Examples
= @mod(4,3)
returns 1.
Cross-references
See also @round.
@month
Month of the year of the observation.
Syntax: @month
Return: series
Returns the month of the year (1–12) associated with each observation in the workfile.
If the workfile is of lower than monthly frequency, all observations will be set to 1.
If the workfile is undated, observations will be set to -1.
Examples
series dt = @month
saves the month into the series DT.
The command
smpl if @month=12 or @month=1
sets the sample to only include observations in December and January.
Cross-references
See also @day, @hour, @hourf, @minute, @quarter, @seas, @second, @weekday, and @year.
@movav
Trailing moving averages (propagate NAs).
n-period trailing moving averages, propagating NAs.
Syntax: @movav(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the average () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movav(x, 12)
produces a linked series of the moving average of the series x where NAs are propagated.
Cross-references
See also @movavc for trailing moving averages.
For the NA-ignoring variant of this function, see @mav.
@movavc
Centered moving averages (propagate NAs).
n-period centered moving averages, propagating NAs.
Syntax: @movavc(x, n)
x: series
n integer, series
Return: series
For each observation and integer ,
If is odd, compute the average of the current, and previous and subsequent observations of a series, propagating missing values (NAs)
where .
If is even, compute the period centered moving sum, weighting the endpoints by 1/2 and propagating missing values (NAs), then divide by :
where and .
If n is not an integer, the integer floor will be used.
Examples
show @movavc(x, 12)
produces a linked series of the centered moving average of the series x where NAs are propagated.
Cross-references
See also @movav for trailing moving averages.
For the NA-excluding variant of this function, see @mavc.
@movcor
Trailing moving population correlations (propagate NAs).
n-period trailing moving Pearson product moment population correlations between a pair of variables, with d.f. correction, propagating NAs.
Syntax: @movcor(x, y, n)
x: series
y: series
n integer, series
Return: series
For each observation and integer , compute the correlations () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movcor(x, y, 12)
produces a linked series of the moving population correlation of the series x and y where NAs are propagated.
Cross-references
See also @movcor for moving correlation, and @movcov and @movcovs for trailing moving covariances.
See @mcor for an NA-excluding version of this function.
@movcov
Trailing moving population covariance (no d.f. adjustment; propagate NAs).
n-period trailing moving Pearson product moment population covariances between a pair of variables, with no d.f. correction, propagating NAs.
Syntax: @movcov(x, y, n)
x: series
y: series
n integer, series
Return: series
For each observation and integer , compute the population covariance () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movcov(x, y, 12)
produces a linked series of the moving population covariance of the series x and y where NAs are propagated.
Cross-references
See also @movcor for moving correlation, and @movcovp and @movcovs for trailing moving covariances.
See @mcov for NA-excluding version of this function.
@movcovp
Trailing moving population covariance (no d.f. adjustment; propagate NAs).
n-period trailing moving Pearson moment population covariances between a pair of variables, with no d.f. correction, propagating NAs.
Syntax: @movcovp(x, y, n)
x: series
y: series
n integer, series
Return: series
For each observation and integer , compute the population covariance () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Equivalent to @movcov.
Examples
show @movcovp(x, y, 12)
produces a linked series of the moving population covariance of the series x and y where NAs are propagated.
Cross-references
See also @movcovp and @movcovs.
See @mcovp for NA-excluding version of this function.
@movcovs
Trailing moving sample covariance (d.f. adjusted; propagate NAs).
n-period trailing moving Pearson product moment sample covariances between a pair of variables, with d.f. correction, propagating NAs.
Syntax: @movcovs(x, y, n)
x: series
y: series
n integer, series
Return: series
For each observation and integer , compute the sample covariance () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movcov(x, y, 12)
produces a linked series of the moving sample covariance of the series x and y where NAs are propagated.
Cross-references
See also @movcov and @movcovp.
See @mcov for NA-excluding version of this function.
@movinner
Trailing moving inner product of two series (propagate NAs).
n-period moving inner product of two variables for the current and previous observations, propagating NAs.
Syntax: @movinner(x, y, n)
x: series
y: series
n integer, series
Return: series
For each observation and integer , compute the inner product of the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movinner(x, y, 12)
produces a linked series of the moving inner product of the series x and y where NAs are propagated.
Cross-references
See also @movsumsq for the trailing moving sums-of-squares.
See @minner for an NA-excluding version of this function.
@movkurt
Trailing moving kurtosis (propagate NAs).
n-period trailing moving kurtosis, propagating NAs.
Syntax: @movkurt(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the average () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movkurt(x, 12)
produces a linked series of the moving kurtosis of the series x where NAs are propagated.
Cross-references
See also @movskew for the trailing moving skewness.
See @mkurt for an NA-excluding version of this function.
@movmax
Trailing moving maximums (propagate NAs).
n-period trailing maximums, propagating NAs.
Syntax: @movmax(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the maximum () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movmax(x, 12)
produces a linked series of maximums based on a 12-period moving window over the series x where NAs propagate.
Cross-references
See also @movmin.
For the NA-excluding variant of this function, see @mmax.
@movmedian
Trailing moving median (propagate NAs).
n-period trailing moving median, ignoring NAs.
Syntax: @movmedian(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the median using the current and previous observations of the series,
propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movmedian(x, 12)
produces a linked series of the moving median of the series X where NAs are propagated.
Cross-references
For the NA-excluding variant of this function, see @mmedian.
@movmin
Trailing moving minimums (propagate NAs).
n-period trailing minimums, propagating NAs.
Syntax: @movmin(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the minimum () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movmin(x, 12)
produces a linked series of minimums based on a 12-period moving window over the series x where NAs propagate.
Cross-references
See also @movmax.
@movskew
Trailing moving skewness (propagate NAs).
n-period trailing moving skewness, propagating NAs.
Syntax: @movskew(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the average () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movskew(x, 12)
produces a linked series of the moving skew of the series x where NAs are propagated.
Cross-references
See also @movkurt.
For the NA-ignoring variant of this function, see @mskew.
@movstdev
Trailing moving sample standard deviations (d.f. adjusted; propagate NAs).
n-period trailing moving square roots of Pearson product moment sample variances, with d.f. correction, propagating NAs.
Syntax: @movstdev(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sample standard deviation () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movstdev(x, 12)
produces a linked series of the moving sample standard deviation of the series x where NAs are propagated.
Cross-references
See also @movstdevp, @movstdevs, @movvar, @movvarp, and @movvars.
For the NA-ignoring variant of this function, see @mstdev.
@movstdevp
Trailing moving population standard deviations (non-d.f. adjusted; propagate NAs).
n-period trailing moving square roots of (population) Pearson product moment population variances, with no d.f. correction, propagating NAs.
Syntax: @movstdevp(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the population standard deviation () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movstdevp(x, 12)
produces a linked series of the moving population standard deviation of the series x where NAs are propagated.
Cross-references
See also @movstdev, @movstdevs, @movvar, @movvarp, and @movvars.
For the NA-ignoring variant of this function, see @mstdevp.
@movstdevs
Trailing moving sample standard deviations (d.f. adjusted; propagate NAs).
n-period trailing moving square roots of Pearson product moment sample variances, with d.f. correction, propagating NAs.
Syntax: @movstdevs(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sample standard deviation () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Equivalent to @movstdev.
Examples
show @movstdevs(x, 12)
produces a linked series of the moving sample standard deviation of the series x where NAs are propagated.
Cross-references
See also @movstdev, @movstdevp, @movvar, @movvarp, and @movvars.
For the NA-ignoring variant of this function, see @mstdevs.
@movsum
Trailing moving sums (propagate NAs).
n-period trailing moving sums, propagating NAs.
Syntax: @movsum(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sum () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movsum(x, 12)
produces a linked series of the moving sum of the series x where NAs are propagated.
Cross-references
See also @movsumsq.
For the NA-ignoring variant of this function, see @msum.
@movsumsq
Trailing moving sums of squares (propagate NAs).
n-period trailing moving sums of squares, propagating NAs.
Syntax: @movsumsq(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sums of squares () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movsumsq(x, 12)
produces a linked series of the moving sum of squares of the series x where NAs are propagated.
Cross-references
See also @movsum.
For the NA-ignoring variant of this function, see @msumsq.
@movvar
Trailing moving population variances (non d.f. adjusted; propagate NAs).
n-period trailing moving Pearson product moment population variances, with no d.f. correction, propagating NAs.
Syntax: @movvar(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sample variance () using the current and previous observations of the series,
propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movvar(x, 12)
produces a linked series of the moving population variance of the series x where NAs are propagated.
Cross-references
See also @movstdev, @movstdevp, @movstdevs, @movvarp, and @movvars.
For the NA-ignoring variant of this function, see @mvar.
@movvarp
Trailing moving population variances (non-d.f. adjusted; propagate NAs).
n-period trailing moving Pearson product moment population variances, with no d.f. correction, propagating NAs.
Syntax: @movvarp(x, n)
x: series
n integer, series
Return: number
For each observation and integer , compute the population variance () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Equivalent to @movvar.
Examples
show @movvarp(x, 12)
produces a linked series of the moving population variance of the series x where NAs are propagated.
Cross-references
See also @movstdev, @movstdevp, @movstdevs, @movvar, and @movvars.
For the NA-ignoring variant of this function, see @mvarp.
@movvars
Trailing moving sample variances (d.f. adjusted; propagate NAs).
n-period trailing moving Pearson product moment sample variances, with d.f. correction, propagating NAs.
Syntax: @movvars(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sample variance () using the current and previous observations of the series,
and propagating missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @movvars(x, 12)
produces a linked series of the moving sample variance of the series x where NAs are propagated.
Cross-references
See also @movstdev, @movstdevp, @movstdevs, @movvar, and @movvarp.
For the NA-ignoring variant of this function, see @mvars.
@mrnd
Matrix of uniform random numbers.
Syntax: @mrnd(n1[, n2])
n1: integer
n2: (optional) integer
Return: matrix
Creates a matrix filled with uniform (0, 1) random numbers. The size of the matrix is given by the integers n1 (number of rows) and n2 (number of columns).
Examples
matrix m1 = @mrnd(3,2)
creates a matrix filled with uniform random numbers.
If n2 is omitted or set to 1, the function returns a vector as in
vector v1 = @mrnd(18)
You may obtain a random sym of uniform numbers by creating a square source matrix of uniform numbers and assigning it to a sym matrix,
sym s1 = @mrnd(5, 5)
which creates the sym S1 based on the lower triangle of the source matrix.
Cross-references
See also @mnrnd, nrnd, and rnd.
@mse
Mean of square error (difference) of two series.
Computes the mean of the squared difference between x and y.
Syntax: @mse(x, y, [s])
x: series
y: series
s: (optional) sample string or object
Return: number
EViews will use the current or specified workfile sample.
Examples
Let yf denote in-sample forecasts for the series y. Then
= @mse(yf, y)
returns the MSE between the series y and its forecast.
Cross-references
See also @mae, @mape, @rmse, @smape, and @theil.
@mskew
Trailing moving skewness (ignore NAs).
n-period trailing moving skewness, ignoring NAs.
Syntax: @mskew(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the average () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mskew(x, 12)
produces a linked series of the moving skew of the series x where NAs are ignored.
Cross-references
See also @mkurt for moving kurtosis.
For the NA-propagating variant of this function, see @movskew.
@mstdev
Trailing moving sample standard deviation (d.f. adjusted; ignore NAs).
n-period trailing moving square roots of Pearson product moment sample variances, with d.f. correction, ignoring NAs.
Syntax: @mstdev(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sample standard deviation (division by ) using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mstdev(x, 12)
produces a linked series of the moving sample standard deviation of the series x where NAs are ignored.
Cross-references
See also @mstdevp, @mstdevs, @mvar, @mvarp, and @mvars.
For the NA-propagating variant of this function, see @movstdev.
@mstdevp
Trailing moving population standard deviations (non-d.f. adjusted; ignore NAs).
n-period trailing moving square roots of Pearson product moment population variances, with no d.f. correction, ignoring NAs.
Syntax: @mstdevp(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the population standard deviation using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mstdevp(x, 12)
produces a linked series of the moving population standard deviation of the series x where NAs are ignored.
Cross-references
See also @mstdev, @mstdevs, @mvar, @mvarp, and @mvars.
For the NA-propagating variant of this function, see @movstdevp.
@mstdevs
Trailing moving sample standard deviations (d.f. adjusted; ignore NAs).
n-period trailing moving square roots of Pearson product moment sample variances, with d.f. correction, ignoring NAs.
Syntax: @mstdevs(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sample standard deviation () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Equivalent to @mstdev.
Examples
show @mstdevs(x, 12)
produces a linked series of the moving sample standard deviation of the series x where NAs are ignored.
Cross-references
See also @mstdev, @mstdevp, @mvar, @mvarp, and @mvars.
For the NA-propagating variant of this function, see @movstdevs.
@msum
Trailing moving sums (ignore NAs).
n-period trailing moving sums, ignoring NAs.
Syntax: @msum(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sum () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @msum(x, 12)
produces a linked series of the moving sum of the series x where NAs are ignored.
Cross-references
See also @msumsq.
For the NA-propagating variant of this function, see @movsum.
@msumsq
Trailing moving sums of squares (ignore NAs).
n-period trailing moving sums of squares, ignoring NAs.
Syntax: @msumsq(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sums of squares () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @msumsq(x, 12)
produces a linked series of the moving sum of squares of the series x where NAs are ignored.
Cross-references
See also @msum.
For the NA-propagating variant of this function, see @movsumsq.
@mvar
Trailing moving population variances (non-d.f. adjusted; ignore NAs).
n-period trailing moving square roots of Pearson product moment population variances, with no d.f. correction, ignoring NAs.
Syntax: @mvar(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the population variance () using the current and previous observations of the series,
ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mvar(x, 12)
produces a linked series of the moving population variance of the series x where NAs are ignored.
Cross-references
See also @mstdev, @mstdevp, @mstdevs, @mvarp, and @mvars.
For the NA-propagating variant of this function, see @movvar.
@mvarp
Trailing moving population variances (non-d.f. adjusted; ignore NAs).
n-period trailing moving square roots of population Pearson product moment variance, with no d.f. correction, ignoring NAs.
Syntax: @mvarp(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the population variance () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Equivalent to @mvar.
Examples
show @mvarp(x, 12)
produces a linked series of the moving population variance of the series x where NAs are ignored.
Cross-references
See also @mstdev, @mstdevp, @mstdevs, @mvar, and @mvars.
For the NA-propagating variant of this function, see @movvarp.
@mvars
Trailing moving population variances (d.f. adjusted; ignore NAs).
n-period trailing moving square roots of Pearson product moment sample variances, with d.f. correction, ignoring NAs.
Syntax: @mvars(x, n)
x: series
n integer, series
Return: series
For each observation and integer , compute the sample variance () using the current and previous observations of the series,
and ignoring missing values (NAs).
If n is not an integer, the integer floor will be used.
Examples
show @mvars(x, 12)
produces a linked series of the moving sample variance of the series x where NAs are ignored.
Cross-references
See also @mstdev, @mstdevp, @mstdevs, @mvar, and @mvarp.
For the NA-propagating variant of this function, see @movvars.