Descriptive statistics

Descriptive statistics — descriptive statistics plus some tests

Functions

int eval_ytest ()
int gretl_minmax ()
double gretl_min ()
double gretl_max ()
double gretl_sum ()
double gretl_mean ()
double gretl_restricted_mean ()
double gretl_quantile ()
int gretl_array_quantiles ()
double gretl_array_quantile ()
double gretl_median ()
double gretl_sst ()
double gretl_variance ()
double gretl_restricted_variance ()
double gretl_stddev ()
double gretl_restricted_stddev ()
double gretl_long_run_variance ()
double gretl_covar ()
double gretl_corr ()
double gretl_corr_rsq ()
double gretl_skewness ()
double gretl_kurtosis ()
int gretl_moments ()
double * gretl_sorted_series ()
void free_freq ()
int freq_setup ()
FreqDist * get_freq ()
FreqDist * get_discrete_freq ()
int freqdist ()
gretl_matrix * freqdist_matrix ()
int crosstab ()
int crosstab_from_matrix ()
int compare_xtab_rows ()
Xtab * single_crosstab ()
gretl_matrix * xtab_to_matrix ()
void free_xtab ()
int model_error_dist ()
int auto_acf_order ()
int auto_spectrum_order ()
int corrgram ()
int xcorrgram ()
int periodogram ()
int residual_periodogram ()
gretl_matrix * periodogram_matrix ()
int fractint ()
Summary * get_summary ()
Summary * get_summary_weighted ()
Summary * get_summary_restricted ()
int list_summary ()
void print_summary ()
void print_summary_single ()
int summary_has_missing_values ()
void free_summary ()
VMatrix * corrlist ()
VMatrix * vmatrix_new ()
void free_vmatrix ()
int gretl_corrmx ()
int satterthwaite_df ()
int means_test ()
int vars_test ()
void print_corrmat ()
double doornik_chisq ()
int multivariate_normality_test ()
int mahalanobis_distance ()
MahalDist * get_mahal_distances ()
void free_mahal_dist ()
const double * mahal_dist_get_distances ()
int mahal_dist_get_n ()
const int * mahal_dist_get_varlist ()
double gretl_gini ()
int gini ()
int shapiro_wilk ()
int gretl_normality_test ()
gretl_matrix * acf_matrix ()
gretl_matrix * xcf_vec ()
double ljung_box ()

Types and Values

typedef MahalDist
  Summary
  FreqDist
  Xtab

Object Hierarchy


Includes

#include <libgretl.h>

Description

Computation and printing of numerous descriptive statistics along with some hypothesis tests, for example regarding the normality of a data series.

Functions

eval_ytest ()

int
eval_ytest (double y,
            GretlOp op,
            double test);

Parameters

y

reference numerical value.

 

op

operator.

 

test

numerical test value.

 

Returns

1 if the expression y yop test (for example "y = 2" or "y <= 45") evaluates as true, else 0.


gretl_minmax ()

int
gretl_minmax (int t1,
              int t2,
              const double *x,
              double *min,
              double *max);

Puts the minimum and maximum values of the series x , from obs t1 to obs t2 , into the variables min and max .

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

min

location to receive minimum value.

 

max

location to receive maximum value.

 

Returns

the number of valid observations in the given data range.


gretl_min ()

double
gretl_min (int t1,
           int t2,
           const double *x);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

Returns

the minimum value of x over the given range, or NADBL if no valid vaues are found.


gretl_max ()

double
gretl_max (int t1,
           int t2,
           const double *x);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

Returns

the maximum value of x over the given range, or NADBL if no valid vaues are found.


gretl_sum ()

double
gretl_sum (int t1,
           int t2,
           const double *x);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

Returns

the sum of the series x from obs t1 to obs t2 , skipping any missing values, or NADBL in case there are no valid observations.


gretl_mean ()

double
gretl_mean (int t1,
            int t2,
            const double *x);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

Returns

the arithmetic mean of the series x from obs t1 to obs t2 , skipping any missing values, or NADBL in case there are no valid observations.


gretl_restricted_mean ()

double
gretl_restricted_mean (int t1,
                       int t2,
                       const double *x,
                       const double *y,
                       GretlOp yop,
                       double yval);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

y

criterion series.

 

yop

criterion operator.

 

yval

criterion value.

 

Returns

the arithmetic mean of the series x in the range t1 to t2 (inclusive), but including only observations where the criterion variable y bears the relationship yop to the value yval -- or NADBL in case there are no observations that satisfy the restriction.


gretl_quantile ()

double
gretl_quantile (int t1,
                int t2,
                const double *x,
                double p,
                gretlopt opt,
                int *err);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

p

probability.

 

opt

may include OPT_Q to hush warning when sample is too small.

 

err

location to receive error code.

 

Returns

the p quantile of the series x from obs t1 to obs t2 , skipping any missing values, or NADBL on failure.


gretl_array_quantiles ()

int
gretl_array_quantiles (double *a,
                       int n,
                       double *p,
                       int k);

Computes k quantiles (given by the elements of p ) for the first n elements of the array a , which is re-ordered in the process. On successful exit, p contains the quantiles.

Parameters

a

data array (this gets re-ordered).

 

n

length of array.

 

p

array of probabilities (over-written by quantiles).

 

k

number of probabilities.

 

Returns

0 on success, non-zero code on error.


gretl_array_quantile ()

double
gretl_array_quantile (double *a,
                      int n,
                      double p);

Parameters

a

array on which to operate.

 

n

number of elements in a .

 

p

probability.

 

Returns

the p quantile of the first n elements in a , which is re-ordered in the process, or NADBL on failure.


gretl_median ()

double
gretl_median (int t1,
              int t2,
              const double *x);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

Returns

the median value of the series x from obs t1 to obs t2 , skipping any missing values, or NADBL on failure.


gretl_sst ()

double
gretl_sst (int t1,
           int t2,
           const double *x);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

Returns

the sum of squared deviations from the mean for the series x from obs t1 to obs t2 , skipping any missing values, or NADBL on failure.


gretl_variance ()

double
gretl_variance (int t1,
                int t2,
                const double *x);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

Returns

the variance of the series x from obs t1 to obs t2 , skipping any missing values, or NADBL on failure.


gretl_restricted_variance ()

double
gretl_restricted_variance (int t1,
                           int t2,
                           const double *x,
                           const double *y,
                           GretlOp yop,
                           double yval);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

y

criterion series.

 

yop

criterion operator.

 

yval

criterion value.

 

Returns

the variance of the series x from obs t1 to obs t2 , skipping any missing values and observations where the series y does not bear the relationship yop to the value yval , or NADBL on failure.


gretl_stddev ()

double
gretl_stddev (int t1,
              int t2,
              const double *x);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

Returns

the standard deviation of the series x from obs t1 to obs t2 , skipping any missing values, or NADBL on failure.


gretl_restricted_stddev ()

double
gretl_restricted_stddev (int t1,
                         int t2,
                         const double *x,
                         const double *y,
                         GretlOp yop,
                         double yval);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

y

criterion series.

 

yop

criterion operator.

 

yval

criterion value.

 

Returns

the standard deviation of the series x from obs t1 to obs t2 , skipping any missing values and observations where the series y does not bear the relationship yop to the value yval , or NADBL on failure.


gretl_long_run_variance ()

double
gretl_long_run_variance (int t1,
                         int t2,
                         const double *x,
                         int m);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

m

bandwidth.

 

Returns

the long-run variance of the series x from obs t1 to obs t2 , using Bartlett kernel weights, or NADBL on failure (which includes encountering missing values).


gretl_covar ()

double
gretl_covar (int t1,
             int t2,
             const double *x,
             const double *y,
             int *missing);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

y

data series.

 

missing

location to receive information on the number of missing observations that were skipped, or NULL.

 

Returns

the covariance of the series x and y from obs t1 to obs t2 , skipping any missing values, or NADBL on failure.


gretl_corr ()

double
gretl_corr (int t1,
            int t2,
            const double *x,
            const double *y,
            int *missing);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

y

data series.

 

missing

location to receive information on the number of missing observations that were skipped, or NULL.

 

Returns

the correlation coefficient for the series x and y from obs t1 to obs t2 , skipping any missing values, or NADBL on failure.


gretl_corr_rsq ()

double
gretl_corr_rsq (int t1,
                int t2,
                const double *x,
                const double *y);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

y

data series.

 

Returns

the square of the correlation coefficient for the series x and y from obs t1 to obs t2 , skipping any missing values, or NADBL on failure. Used as alternative value for R^2 in a regression without an intercept.


gretl_skewness ()

double
gretl_skewness (int t1,
                int t2,
                const double *x);

Returns


gretl_kurtosis ()

double
gretl_kurtosis (int t1,
                int t2,
                const double *x);

Returns


gretl_moments ()

int
gretl_moments (int t1,
               int t2,
               const double *x,
               const double *wts,
               double *xbar,
               double *sd,
               double *skew,
               double *kurt,
               int k);

Calculates sample moments for series x from obs t1 to obs t2 .

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

wts

weights (may be NULL)

 

xbar

pointer to receive mean.

 

sd

pointer to receive standard deviation.

 

skew

pointer to receive skewness.

 

kurt

pointer to receive excess kurtosis.

 

k

degrees of freedom loss (generally 1).

 

Returns

0 on success, 1 on error.


gretl_sorted_series ()

double *
gretl_sorted_series (int v,
                     const DATASET *dset,
                     gretlopt opt,
                     int *n,
                     int *err);

Parameters

v

ID number of input series.

 

dset

dataset struct.

 

opt

may include OPT_M to flag an error in case missing values are found.

 

n

on input, the minimum acceptable number of non-missing observations; on output, the number of valid observations.

 

err

location to receive error code.

 

Returns

an array containing the valid values of the input series over the sample range given in dset , sorted from smallest to largest, or NULL on error. An error is flagged if the number of valid observations is less than that given in n on input, or if OPT_M is given and the input contains missing values.


free_freq ()

void
free_freq (FreqDist *freq);

Frees all resources associated with freq , and the pointer itself.

Parameters

freq

pointer to gretl frequency distribution struct

 

freq_setup ()

int
freq_setup (int v,
            const DATASET *dset,
            int *pn,
            double *pxmax,
            double *pxmin,
            int *nbins,
            double *binwidth);

Returns


get_freq ()

FreqDist *
get_freq (int varno,
          const DATASET *dset,
          double fmin,
          double fwid,
          int nbins,
          int params,
          gretlopt opt,
          int *err);

Calculates the frequency distribution for the specified variable.

Parameters

varno

ID number of variable to process.

 

dset

dataset struct.

 

fmin

lower limit of left-most bin (or NADBL for automatic).

 

fwid

bin width (or NADBL for automatic).

 

nbins

number of bins to use (or 0 for automatic).

 

params

degrees of freedom loss (generally = 1 unless we're dealing with the residual from a regression).

 

opt

if includes OPT_Z, set up for comparison with normal dist; if includes OPT_O, compare with gamma distribution; if includes OPT_Q, do not show a graph; if includes OPT_D, treat the variable as discrete; OPT_X indicates that this function is called as part of a cross-tabulation.

 

err

location to receive error code.

 

Returns

pointer to struct containing the distribution.


get_discrete_freq ()

FreqDist *
get_discrete_freq (int v,
                   const DATASET *dset,
                   gretlopt opt,
                   int *err);

Returns


freqdist ()

int
freqdist (int varno,
          const DATASET *dset,
          int *graph,
          gretlopt opt,
          PRN *prn);

Returns


freqdist_matrix ()

gretl_matrix *
freqdist_matrix (const double *x,
                 int t1,
                 int t2,
                 int *err);

Returns


crosstab ()

int
crosstab (const int *list,
          const DATASET *dset,
          gretlopt opt,
          PRN *prn);

Returns


crosstab_from_matrix ()

int
crosstab_from_matrix (gretlopt opt,
                      PRN *prn);

Returns


compare_xtab_rows ()

int
compare_xtab_rows (const void *a,
                   const void *b);

Returns


single_crosstab ()

Xtab *
single_crosstab (const int *list,
                 const DATASET *dset,
                 gretlopt opt,
                 PRN *prn,
                 int *err);

Returns


xtab_to_matrix ()

gretl_matrix *
xtab_to_matrix (const Xtab *tab);

Returns


free_xtab ()

void
free_xtab (Xtab *tab);

Frees all resources associated with tab , and the pointer itself.

Parameters

tab

pointer to gretl crosstab struct.

 

model_error_dist ()

int
model_error_dist (const MODEL *pmod,
                  DATASET *dset,
                  gretlopt opt,
                  PRN *prn);

Returns


auto_acf_order ()

int
auto_acf_order (int T);

Returns


auto_spectrum_order ()

int
auto_spectrum_order (int T,
                     gretlopt opt);

Returns


corrgram ()

int
corrgram (int varno,
          int order,
          int nparam,
          DATASET *dset,
          gretlopt opt,
          PRN *prn);

Computes the autocorrelation function and plots the correlogram for the variable specified by varno .

Parameters

varno

ID number of variable to process.

 

order

integer order for autocorrelation function.

 

nparam

number of estimated parameters (e.g. for the case of ARMA), used to correct the degrees of freedom for Q test.

 

dset

dataset struct.

 

opt

if includes OPT_R, variable in question is a model residual generated "on the fly"; OPT_U can be used to specify a plot option.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


xcorrgram ()

int
xcorrgram (const int *list,
           int order,
           DATASET *dset,
           gretlopt opt,
           PRN *prn);

Computes the cross-correlation function and plots the cross-correlogram for the specified variables.

Parameters

list

should contain ID numbers of two variables.

 

order

integer order for autocorrelation function.

 

dset

dataset struct.

 

opt

may include OPT_U for plot options.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


periodogram ()

int
periodogram (int varno,
             int width,
             const DATASET *dset,
             gretlopt opt,
             PRN *prn);

Computes and displays the periodogram for the series specified by varno .

Parameters

varno

ID number of variable to process.

 

width

width of window.

 

dset

dataset struct.

 

opt

if includes OPT_O, use Bartlett lag window for periodogram; OPT_L, use log scale.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


residual_periodogram ()

int
residual_periodogram (const double *x,
                      int width,
                      const DATASET *dset,
                      gretlopt opt,
                      PRN *prn);

Computes and displays the periodogram for x , which is presumed to be a model residual series.

Parameters

x

series to process.

 

width

width of window.

 

dset

dataset struct.

 

opt

if includes OPT_O, use Bartlett lag window for periodogram; OPT_L, use log scale.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


periodogram_matrix ()

gretl_matrix *
periodogram_matrix (const double *x,
                    int t1,
                    int t2,
                    int width,
                    int *err);

Implements the userspace gretl pergm function, which can be used on either a series from the dataset or a gretl vector.

Parameters

x

the series to process.

 

t1

starting observation in x .

 

t2

ending observation in x .

 

width

width of Bartlett window, or -1 for plain sample periodogram.

 

err

location to receive error code.

 

Returns

allocated matrix on success, NULL on failure.


fractint ()

int
fractint (int varno,
          int order,
          const DATASET *dset,
          gretlopt opt,
          PRN *prn);

Computes and prints a test for fractional integration of the series specified by varno . By default the test uses the Local Whittle Estimator but if opt includes OPT_G then the Geweke and Porter-Hudak test is done instead, or if OPT_A then both tests are shown. If OPT_Q is given the test results are not printed, just recorded (with preference given to the LWE in case of OPT_A).

Parameters

varno

ID number of variable to process.

 

order

lag order / window size.

 

dset

dataset struct.

 

opt

option flags.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


get_summary ()

Summary *
get_summary (const int *list,
             const DATASET *dset,
             gretlopt opt,
             PRN *prn,
             int *err);

Calculates descriptive summary statistics for the specified variables.

Parameters

list

list of variables to process.

 

dset

dataset struct.

 

opt

may include OPT_S for "simple" version.

 

prn

gretl printing struct.

 

err

location to receive error code.

 

Returns

Summary object containing the summary statistics, or NULL on failure.


get_summary_weighted ()

Summary *
get_summary_weighted (const int *list,
                      const DATASET *dset,
                      int var,
                      gretlopt opt,
                      PRN *prn,
                      int *err);

Calculates descriptive summary statistics for the specified variables, weighting the observations by rv . The series rv must be of full length (dset->n).

Parameters

list

list of variables to process.

 

dset

dataset struct.

 

opt

may include OPT_S for "simple" version.

 

prn

gretl printing struct.

 

err

location to receive error code.

 

Returns

Summary object containing the summary statistics, or NULL on failure.


get_summary_restricted ()

Summary *
get_summary_restricted (const int *list,
                        const DATASET *dset,
                        const double *rv,
                        gretlopt opt,
                        PRN *prn,
                        int *err);

Calculates descriptive summary statistics for the specified variables, with the observations restricted to those for which rv has a non-zero (and non-missing) value. The series rv must be of full length (dset->n).

Parameters

list

list of variables to process.

 

dset

dataset struct.

 

rv

series to use as restriction dummy.

 

opt

may include OPT_S for "simple" version.

 

prn

gretl printing struct.

 

err

location to receive error code.

 

Returns

Summary object containing the summary statistics, or NULL on failure.


list_summary ()

int
list_summary (const int *list,
              int wgtvar,
              const DATASET *dset,
              gretlopt opt,
              PRN *prn);

Prints descriptive statistics for the listed variables.

Parameters

list

list of series to process.

 

dset

dataset struct.

 

opt

may include OPT_S for "simple" version.

 

prn

gretl printing struct.

 

Returns

0 on success, non-zero code on error.


print_summary ()

void
print_summary (const Summary *summ,
               const DATASET *dset,
               PRN *prn);

Prints the summary statistics for a given variable.

Parameters

summ

pointer to gretl summary statistics struct.

 

dset

information on the data set.

 

prn

gretl printing struct.

 

print_summary_single ()

void
print_summary_single (const Summary *s,
                      int digits,
                      int places,
                      const DATASET *dset,
                      PRN *prn);


summary_has_missing_values ()

int
summary_has_missing_values (const Summary *summ);

Returns


free_summary ()

void
free_summary (Summary *summ);

Frees all resources associated with summ , and the pointer itself.

Parameters

summ

pointer to gretl summary statistics struct

 

corrlist ()

VMatrix *
corrlist (int *list,
          const DATASET *dset,
          gretlopt opt,
          int *err);

Computes pairwise correlation coefficients for the variables specified in list , skipping any constants. If the option flags contain OPT_U, a uniform sample is ensured: only those observations for which all the listed variables have valid values are used. If OPT_C is included, we actually calculate covariances rather than correlations.

Parameters

list

list of variables to process, by ID number.

 

dset

dataset struct.

 

opt

option flags.

 

err

location to receive error code.

 

Returns

gretl correlation matrix struct, or NULL on failure.


vmatrix_new ()

VMatrix *
vmatrix_new (void);

Returns

an allocated and initialized VMatrix, or NULL on failure.


free_vmatrix ()

void
free_vmatrix (VMatrix *vmat);

Frees all resources associated with vmat , and the pointer itself.

Parameters

vmat

pointer to gretl correlation matrix struct

 

gretl_corrmx ()

int
gretl_corrmx (int *list,
              const DATASET *dset,
              gretlopt opt,
              PRN *prn);

Computes and prints the correlation matrix for the specified list of variables.

Parameters

list

gives the ID numbers of the variables to process.

 

dset

dataset struct.

 

opt

option flags: OPT_U = use uniform sample size.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, 1 on error.


satterthwaite_df ()

int
satterthwaite_df (double v1,
                  int n1,
                  double v2,
                  int n2);

Returns


means_test ()

int
means_test (const int *list,
            const DATASET *dset,
            gretlopt opt,
            PRN *prn);

Carries out test of the null hypothesis that the means of two variables are equal.

Parameters

list

gives the ID numbers of the variables to compare.

 

dset

dataset struct.

 

opt

if OPT_O, assume population variances are different.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


vars_test ()

int
vars_test (const int *list,
           const DATASET *dset,
           PRN *prn);

Carries out test of the null hypothesis that the variances of two variables are equal.

Parameters

list

gives the ID numbers of the variables to compare.

 

dset

dataset struct.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


print_corrmat ()

void
print_corrmat (VMatrix *corr,
               const DATASET *dset,
               PRN *prn);

Prints a gretl correlation matrix to prn .

Parameters

corr

gretl correlation matrix.

 

dset

dataset information.

 

prn

gretl printing struct.

 

doornik_chisq ()

double
doornik_chisq (double skew,
               double xkurt,
               int n);

Calculates the Chi-square test for normality as set out by Doornik and Hansen, "An Omnibus Test for Normality", 1994. This is a modified version of the test proposed by Bowman and Shenton (Biometrika, 1975).

Parameters

skew

skewness.

 

xkurt

excess kurtosis.

 

n

number of observations.

 

Returns

the Chi-square value, which has 2 degrees of freedom.


multivariate_normality_test ()

int
multivariate_normality_test (const gretl_matrix *E,
                             const gretl_matrix *Sigma,
                             PRN *prn);

Returns


mahalanobis_distance ()

int
mahalanobis_distance (const int *list,
                      DATASET *dset,
                      gretlopt opt,
                      PRN *prn);

Returns


get_mahal_distances ()

MahalDist *
get_mahal_distances (const int *list,
                     DATASET *dset,
                     gretlopt opt,
                     PRN *prn,
                     int *err);

Returns


free_mahal_dist ()

void
free_mahal_dist (MahalDist *md);


mahal_dist_get_distances ()

const double *
mahal_dist_get_distances (const MahalDist *md);

Returns


mahal_dist_get_n ()

int
mahal_dist_get_n (const MahalDist *md);

Returns


mahal_dist_get_varlist ()

const int *
mahal_dist_get_varlist (const MahalDist *md);

Returns


gretl_gini ()

double
gretl_gini (int t1,
            int t2,
            const double *x);

Parameters

t1

starting observation.

 

t2

ending observation.

 

x

data series.

 

Returns

the Gini coefficient for the series x from obs t1 to obs t2 , skipping any missing values, or NADBL on failure.


gini ()

int
gini (int varno,
      DATASET *dset,
      gretlopt opt,
      PRN *prn);

Graphs the Lorenz curve for variable vnum and prints the Gini coefficient.

Parameters

varno

ID number of variable to examine.

 

dset

dataset struct.

 

opt

unused at present.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, error code on error.


shapiro_wilk ()

int
shapiro_wilk (const double *x,
              int t1,
              int t2,
              double *W,
              double *pval);

Computes the Shapiro-Wilk W statistic as a test for normality of the data x , and also the p-value for the test. These are written into the pointer arguments W and pval .

Parameters

x

data array.

 

t1

starting observation.

 

t2

ending observation.

 

W

location to receive test statistic.

 

pval

location to receive p-value.

 

Returns

0 on success, non-zero on failure.


gretl_normality_test ()

int
gretl_normality_test (int varno,
                      const DATASET *dset,
                      gretlopt opt,
                      PRN *prn);

Performs, and prints the results of, the specified test(s) randomness for the variable specified by v .

Parameters

varno

ID number of the variable to process.

 

dset

dataset struct.

 

opt

OPT_A: all tests; OPT_D: Doornik-Hansen; OPT_W: Shapiro-Wilk; OPT_J: Jarque-Bera; OPT_L: Lilliefors; default is Doornik-Hansen. Also use OPT_Q for quiet.

 

prn

gretl printing struct.

 

Returns

0 on successful completion, non-zero on error.


acf_matrix ()

gretl_matrix *
acf_matrix (const double *x,
            int order,
            const DATASET *dset,
            int n,
            int *err);

Computes the autocorrelation function for series x with maximum lag order .

Parameters

x

series to analyse.

 

order

maximum lag for autocorrelation function.

 

dset

information on the data set, or NULL.

 

n

length of series (required if dset is NULL).

 

err

location to receive error code.

 

Returns

two-column matrix containing the values of the ACF and PACF at the successive lags, or NULL on error.


xcf_vec ()

gretl_matrix *
xcf_vec (const double *x,
         const double *y,
         int p,
         const DATASET *dset,
         int n,
         int *err);

Computes the cross-correlation function for series x with series y up to maximum lag order .

Parameters

x

first series.

 

y

second series.

 

p

maximum lag for cross-correlation function.

 

dset

information on the data set, or NULL.

 

n

length of series (required only if dset is NULL).

 

err

location to receive error code.

 

Returns

column vector containing the values of the cross-correlation function, or NULL on error.


ljung_box ()

double
ljung_box (int m,
           int t1,
           int t2,
           const double *y,
           int *err);

Parameters

m

maximum lag.

 

t1

starting observation.

 

t2

ending observation.

 

y

data series.

 

err

location to receive error code.

 

Returns

the Ljung-Box statistic for lag order m for the series y over the sample t1 to t2 , or NADBL on failure.

Types and Values

MahalDist

typedef struct MahalDist_ MahalDist;


Summary

typedef struct {
    gretlopt opt;
    int n;
    int weight_var;
    int *misscount;
    int *list;
    double *stats;
    double *mean;
    double *median;
    double *sd;
    double *skew; 
    double *xkurt;
    double *low;
    double *high;
    double *cv;
    double *perc05;
    double *perc95;
    double *iqr;
    double sw;
    double sb;
} Summary;


FreqDist

typedef struct {
    char varname[VNAMELEN];  /* for ID purposes */
    int discrete;            /* 1 if variable contains integers */
    int dist;                /* code for theoretical distribution */
    int numbins;             /* number of bins or intervals */
    double xbar, sdx;        /* mean and std dev of variable */
    double *midpt;           /* array of midpoints of intervals */
    double *endpt;           /* array of endpoints of intervals */
    int *f;                  /* frequencies in the intervals */
    double test;             /* either Chi-squared statistic for testing
                                for a Gaussian distribution, or z statistic
			        for testing for Gamma dist. */
    int n;
    int t1, t2;
} FreqDist;


Xtab

typedef struct {
    char rvarname[VNAMELEN]; 
    char cvarname[VNAMELEN]; 
    int rows, cols;
    double *rval, *cval;
    int *rtotal, *ctotal;
    int **f;
    int n, missing;
    int t1, t2;
    const char **rlabels, **clabels;
} Xtab;