You are on page 1of 7

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 @cor(x,y[,s]) @cov(x,y[,s]) @covp(x,y[,s]) @covs(x,y[,s]) @inner(x,y[,s]) @obs(x[,s]) Name correlation covariance population covariance sample covariance Description the correlation between X and Y. the covariance between X and Y (division by ). the covariance between X and Y (division by ). the covariance between X and Y (division by ).

inner product the inner product of X and Y. number of observations number of NAs mean median the number of non-missing observations for X in the current sample. the number of missing observations for X in the current sample. average of the values in X. computes the median of the X (uses the average of middle two observations if the number of observations is even). minimum of the values in X. maximum of the values in X.

@nas(x[,s])

@mean(x[,s]) @median(x[,s])

@min(x[,s]) @max(x[,s])

minimum maximum

@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" (Rankit-Cleveland), "o" (Ordinary), "t" (Tukey), "v" (van der Waerden), "g" (Gumbel). The default value is "r". 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. square root of the unbiased sample variance (sum-ofsquared residuals divided by ). square root of the population variance (sum-of-squared residuals divided by ). square root of the unbiased sample variance. Note this is the same calculation as @stdev. variance of the values in X (division by ). variance of the values in X. Note this is the same calculation as @var. sample variance of the values in X (division by ). skewness of values in X. kurtosis of values in X.

@ranks(x[,o,t,s])

rank

@stdev(x[,s])

standard deviation

@stdevp(x[,s])

population standard deviation sample standard deviation variance population variance sample variance skewness kurtosis

@stdevs(x[,s])

@var(x[,s]) @varp(x[,s])

@vars(x[,s]) @skew(x[,s]) @kurt(x[,s])

@sum(x[,s]) @prod(x[,s])

sum product

the sum of X. the product of X (note this function could be subject to numerical overflows). sum of the squares of X. the geometric mean of X.

@sumsq(x[,s]) @gmean(x[,s])

sum-ofsquares geometric mean

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 Quantile (inverse CDF) Random number generator @d @q @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 @cbeta(x,a,b), @dbeta(x,a,b), @qbeta(p,a,b), @rbeta(a,b) @cbinom(x,n,p), @dbinom(x,n,p), @qbinom(s,n,p), @rbinom(n,p) @cchisq(x,v), @dchisq(x,v), @qchisq(p,v), @rchisq(v) @cexp(x,m), @dexp(x,m), @qexp(p,m), @rexp(m) @cextreme(x), @dextreme(x), @qextreme(p), @cloglog(p), @rextreme @cfdist(x,v1,v2), @dfdist(x,v1,v2), @qfdist(p,v1,v2), @rfdist(v1,v1) where , and . Note that the functions allow for fractional degrees of freedom parameters and . Gamma @cgamma(x,b,r), @dgamma(x,b,r), @qgamma(p,b,r), @rgamma(b,r) where , and . Density/Probability Function

for and for the @beta function.

, where

is

Binomial

if for

, and 0 otherwise, .

Chi-square

where , and . Note that the degrees of freedom parameter need not be an integer.

Exponential

for

, and

Extreme Value (Type Iminimum) Fdistribution

for

Generalized Error

@cged(x,r), @dged(x,r), @qged(p,r), @rged(r) where , and . @claplace(x), @dlaplace(x), @qlaplace(x)v @rlaplace @clogistic(x), @dlogistic(x), @qlogistic(p), @rlogistic @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) @cnorm(x), @dnorm(x), @qnorm(p), @rnorm, nrnd @cpoisson(x,m), @dpoisson(x,m), @qpoisson(p,m), @rpoisson(m) @cpareto(x,k,a), @dpareto(x,k,a), @qpareto(p,k,a), @rpareto(k,a) @ctdist(x,v), @dtdist(x,v), @qtdist(p,v), @rtdist(v) for , and . Note that , yields the Cauchy distribution.

Laplace

for

Logistic

for

Log-normal

, and

Negative Binomial

if for for

, and 0 otherwise, . .

Normal (Gaussian)

Poisson

if for

, and 0 otherwise, .

Pareto

for location parameter shape parameter .

and

Student's distribution

Uniform

@cunif(x,a,b), @dunif(x,a,b), @qunif(p,a,b), @runif(a,b), rnd @cweib(x,m,a), @dweib(x,m,a), @qweib(p,m,a), @rweib(m,a)

for

and

Weibull

where

, and

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 @chisq(x,v) Distribution Chi-square Description Returns the probability that a Chisquared 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) 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))

@tdist(x,v)

You might also like