Descriptive Statistics and Distribution Functions in Eviews

advertisement
Descriptive Statistics and Distribution Functions in Eviews
Descriptive Statistics
These functions compute descriptive statistics for a specified sample, excluding missing
values if necessary. The default sample is the current workfile sample. If you are
performing these computations on a series and placing the results into a series, you can
specify a sample as the last argument of the descriptive statistic function, either as a
string (in double quotes) or using the name of a sample object. For example:
series z = @mean(x, "1945m01 1979m12")
or
w = @var(y, s2)
where S2 is the name of a sample object and W and X are series. Note that you may not
use a sample argument if the results are assigned into a matrix, vector, or scalar object.
For example, the following assignment:
vector(2) a
series x
a(1) = @mean(x, "1945m01 1979m12")
is not valid since the target A(1) is a vector element. To perform this latter computation,
you must explicitly set the global sample prior to performing the calculation performing
the assignment:
smpl 1945:01 1979:12
a(1) = @mean(x)
To determine the number of observations available for a given series, use the @obs
function. Note that where appropriate, EViews will perform casewise exclusion of data
with missing values. For example, @cov(x,y) and @cor(x,y) will use only observations
for which data on both X and Y are valid.
In the following table, arguments in square brackets [ ] are optional arguments:

[s]: sample expression in double quotes or name of a sample object. The optional
sample argument may only be used if the result is assigned to a series. For
@quantile,
you must provide the method option argument in order to include the
optional sample argument.
If the desired sample expression contains the double quote character, it may be entered
using the double quote as an escape character. Thus, if you wish to use the equivalent of,
smpl if name = "Smith"
in your @MEAN function, you should enter the sample condition as:
series y = @mean(x, "if name=""Smith""")
The pairs of double quotes in the sample expression are treated as a single double quote.
Function
Name
Description
@cor(x,y[,s])
correlation
the correlation between X
and Y.
@cov(x,y[,s])
covariance
the covariance between X
and Y (division by ).
@covp(x,y[,s])
population
covariance
the covariance between X
and Y (division by ).
@covs(x,y[,s])
sample
covariance
the covariance between X
and Y (division by
).
@inner(x,y[,s])
inner product the inner product of X and
Y.
@obs(x[,s])
number of
observations
the number of non-missing
observations for X in the
current sample.
@nas(x[,s])
number of
NAs
the number of missing
observations for X in the
current sample.
@mean(x[,s])
mean
average of the values in X.
@median(x[,s])
median
computes the median of the
X (uses the average of
middle two observations if
the number of observations
is even).
@min(x[,s])
minimum
minimum of the values in X.
@max(x[,s])
maximum
maximum of the values in
X.
@quantile(x,q[,m,s]) quantile
the q-th quantile of the series
X. m is an optional string
argument for specifying the
quantile method: "b"
(Blom), "r" (RankitCleveland), "o" (Ordinary),
"t" (Tukey), "v" (van der
Waerden), "g" (Gumbel).
The default value is "r".
@ranks(x[,o,t,s])
rank
the ranking of each
observation in X.
The order of ranking is set
using o: "a" (ascending default) or "d" (descending).
Ties are broken according to
the setting of t: "i" (ignore),
"f" (first), "l" (last), "a"
(average - default), "r"
randomize.
@stdev(x[,s])
standard
deviation
square root of the unbiased
sample variance (sum-ofsquared residuals divided by
).
@stdevp(x[,s])
population
standard
deviation
square root of the population
variance (sum-of-squared
residuals divided by ).
@stdevs(x[,s])
sample
standard
deviation
square root of the unbiased
sample variance. Note this is
the same calculation as
@stdev.
@var(x[,s])
variance
variance of the values in X
(division by ).
@varp(x[,s])
population
variance
variance of the values in X.
Note this is the same
calculation as @var.
@vars(x[,s])
sample
variance
sample variance of the
values in X (division by
).
@skew(x[,s])
skewness
skewness of values in X.
@kurt(x[,s])
kurtosis
kurtosis of values in X.
@sum(x[,s])
sum
the sum of X.
@prod(x[,s])
product
the product of X (note this
function could be subject to
numerical overflows).
@sumsq(x[,s])
sum-ofsquares
sum of the squares of X.
@gmean(x[,s])
geometric
mean
the geometric mean of X.
Statistical Distribution Functions
The following functions provide access to the density or probability functions,
cumulative distribution, quantile functions, and random number generators for a number
of standard statistical distributions.
There are four functions associated with each distribution. The first character of each
function name identifies the type of function:
Function Type
Beginning of Name
Cumulative distribution (CDF) @c
Density or probability
@d
Quantile (inverse CDF)
@q
Random number generator
@r
The remainder of the function name identifies the distribution. For example, the functions
for the beta distribution are @cbeta, @dbeta, @qbeta and @rbeta.
When used with series arguments, EViews will evaluate the function for each observation
in the current sample. As with other functions, NA or invalid inputs will yield NA values.
For values outside of the support, the functions will return zero.
Note that the CDFs are assumed to be right-continuous:
. The quantile
functions will return the smallest value where the CDF evaluated at the value equals or
exceeds the probability of interest:
, where
. The inequalities are
only relevant for discrete distributions.
The information provided below should be sufficient to identify the meaning of the
parameters for each distribution.
Distribution Functions
Beta
Binomial
Chi-square
Exponential
Density/Probability Function
@cbeta(x,a,b),
@dbeta(x,a,b),
@qbeta(p,a,b),
@rbeta(a,b)
for
and for
is the @beta function.
@cbinom(x,n,p),
@dbinom(x,n,p),
@qbinom(s,n,p),
@rbinom(n,p)
if
for
@cchisq(x,v),
@dchisq(x,v),
@qchisq(p,v),
@rchisq(v)
@cexp(x,m),
@dexp(x,m),
@qexp(p,m),
@rexp(m)
Extreme
Value
(Type Iminimum)
@cextreme(x),
@dextreme(x),
@qextreme(p),
@cloglog(p),
@rextreme
Fdistribution
@cfdist(x,v1,v2),
@dfdist(x,v1,v2),
@qfdist(p,v1,v2),
@rfdist(v1,v1)
, where
, and 0 otherwise,
.
where
, and
. Note that the
degrees of freedom parameter need
not be an integer.
for
for
, and
.
.
where
, and
. Note that
the functions allow for fractional
degrees of freedom parameters and
.
Gamma
Generalized
Error
@cgamma(x,b,r),
@dgamma(x,b,r),
@qgamma(p,b,r),
@rgamma(b,r)
where
, and
.
@cged(x,r),
@dged(x,r),
@qged(p,r),
@rged(r)
where
, and
.
Laplace
Logistic
Log-normal
Negative
Binomial
@claplace(x),
@dlaplace(x),
@qlaplace(x)v
@rlaplace
@clogistic(x),
@dlogistic(x),
@qlogistic(p),
@rlogistic
for
.
for
.
@clognorm(x,m,s),
@dlognorm(x,m,s),
@qlognorm(p,m,s),
@rlognorm(m,s)
@cnegbin(x,n,p),
@dnegbin(x,n,p),
@qnegbin(s,n,p),
@rnegbin(n,p)
,
, and
if
for
, and 0 otherwise,
.
Normal
(Gaussian)
@cnorm(x),
@dnorm(x),
@qnorm(p),
@rnorm, nrnd
for
Poisson
@cpoisson(x,m),
@dpoisson(x,m),
@qpoisson(p,m),
@rpoisson(m)
if
for
@cpareto(x,k,a),
@dpareto(x,k,a),
@qpareto(p,k,a),
@rpareto(k,a)
for location parameter
shape parameter
.
Pareto
Student's distribution
Weibull
.
, and 0 otherwise,
.
and
@ctdist(x,v),
@dtdist(x,v),
@qtdist(p,v),
@rtdist(v)
for
Uniform
.
@cunif(x,a,b),
@dunif(x,a,b),
@qunif(p,a,b),
@runif(a,b), rnd
for
@cweib(x,m,a),
@dweib(x,m,a),
@qweib(p,m,a),
where
, and
. Note that
, yields the Cauchy distribution.
and
.
, and
.
@rweib(m,a)
Additional Distribution Related Functions
The following utility functions were designed to facilitate the computation of p-values for
common statistical tests. While these results may be derived using the distributional
functions above, they are retained for convenience and backward compatibility.
Function
Distribution
Description
@chisq(x,v)
Chi-square
Returns the probability that a
Chi-squared statistic with
degrees of freedom exceeds :
@chisq(x,v)=1-@cchisq(x,d)
@fdist(x,v1,v2)
F-distribution Probability that an F-statistic
with numerator degrees of
freedom and denominator
degrees of freedom exceeds :
@fdist(x,v1,v2)=1@cfdist(x,v1,v2)
@tdist(x,v)
t-distribution
Probability that a t-statistic with
degrees of freedom exceeds
in absolute value (two-sided pvalue):
@tdist(x,v)=2*(1@ctdist(@abs(x),v))
Download