1 /* 2 * gretl -- Gnu Regression, Econometrics and Time-series Library 3 * Copyright (C) 2001 Allin Cottrell and Riccardo "Jack" Lucchetti 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 #ifndef JOHANSEN_H_ 21 #define JOHANSEN_H_ 22 23 #include "gretl_matrix.h" 24 25 typedef enum { 26 J_NO_CONST = 0, 27 J_REST_CONST, 28 J_UNREST_CONST, 29 J_REST_TREND, 30 J_UNREST_TREND 31 } JohansenCode; 32 33 struct JohansenInfo_ { 34 int ID; /* for identifying saved vars */ 35 JohansenCode code; /* see enumeration above */ 36 int rank; /* if specified, chosen cointegration rank, else 0 */ 37 int seasonals; /* number of seasonal dummies included */ 38 gretl_matrix *R0; /* residuals, VAR in differences */ 39 gretl_matrix *R1; /* residuals, second regressions */ 40 gretl_matrix *S00; /* cross-products of residuals */ 41 gretl_matrix *S11; /* cross-products of residuals */ 42 gretl_matrix *S01; /* cross-products of residuals */ 43 gretl_matrix *evals; /* vector of eigenvalues */ 44 gretl_matrix *Beta; /* matrix of eigenvectors */ 45 gretl_matrix *Alpha; /* matrix of adjustments */ 46 gretl_matrix *Bvar; /* variance matrix of beta */ 47 gretl_matrix *Bse; /* standard errors of beta */ 48 gretl_matrix *Ase; /* standard errors of alpha */ 49 gretl_matrix *R; /* beta-restriction LHS matrix */ 50 gretl_matrix *q; /* beta-restrictions RHS matrix */ 51 gretl_matrix *Ra; /* alpha-restriction LHS matrix */ 52 gretl_matrix *qa; /* alpha-restrictions RHS matrix */ 53 gretl_matrix *YY; /* double-size Y matrix */ 54 gretl_matrix *RR; /* double-size residuals matrix */ 55 gretl_matrix *BB; /* double-size coefficient matrix */ 56 double ll0; /* unrestricted log-likelihood */ 57 int lrdf; /* df for likelihood ratio test */ 58 double prior_ll; /* ll for prior model in restriction sequence */ 59 int prior_df; /* df for prior model in restriction sequence */ 60 }; 61 62 #define jcode(v) ((v->jinfo == NULL)? 0 : v->jinfo->code) 63 64 #define jrank(v) ((v->jinfo == NULL)? 0 : v->jinfo->rank) 65 66 #define effective_order(v) (v->order+(v->ci==VECM)) 67 68 /* vecm contains an "automatic" restricted term */ 69 #define auto_restr(v) (v->jinfo != NULL && \ 70 (v->jinfo->code == J_REST_CONST || \ 71 v->jinfo->code == J_REST_TREND)) 72 73 /* number of extra terms confined to the cointegrating space */ 74 int n_restricted_terms (const GRETL_VAR *v); 75 76 void print_Johansen_test_case (JohansenCode jcode, PRN *prn); 77 78 int gretl_VECM_id (GRETL_VAR *vecm); 79 80 int *VAR_list_composite (const int *ylist, const int *xlist, 81 const int *rlist); 82 83 #endif /* JOHANSEN_H_ */ 84 85