/usr/include/gretl/gretl_model.h is in libgretl1-dev 2016d-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | /*
* gretl -- Gnu Regression, Econometrics and Time-series Library
* Copyright (C) 2001 Allin Cottrell and Riccardo "Jack" Lucchetti
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GRETL_MODEL_H
#define GRETL_MODEL_H
#include "objstack.h"
typedef enum {
ARMA_X12A = 1 << 0, /* using X-12-ARIMA (or X-13) to generate estimates */
ARMA_EXACT = 1 << 1, /* using exact ML */
ARMA_LS = 1 << 2, /* using conditional ML, and O/NLS == CML */
ARMA_OLS = 1 << 3 /* OLS == MLE */
} ArmaFlags;
typedef struct CoeffIntervals_ CoeffIntervals;
struct CoeffIntervals_ {
int asy;
int ncoeff;
double alpha;
double t;
char **names;
double *coeff;
double *maxerr;
int df;
int ifc;
};
typedef enum {
VCV_CLASSICAL,
VCV_HC,
VCV_HAC,
VCV_ML,
VCV_PANEL,
VCV_RQ,
VCV_CLUSTER
} VCVMajorType;
typedef enum {
ML_UNSET,
ML_HESSIAN,
ML_IM,
ML_OP,
ML_QML,
ML_BW,
ML_VCVMAX
} MLVCVType;
typedef enum {
KERNEL_BARTLETT,
KERNEL_PARZEN,
KERNEL_QS,
KERNEL_MAX
} HACKernel;
typedef enum {
PANEL_HAC,
PANEL_BK /* Beck-Katz */
} PanelVCVType;
typedef enum {
RQ_ASY,
RQ_NID /* sandwich */
} RQVCVType;
typedef enum {
HAC_PREWHITEN = 1
} VCVFlags;
typedef struct VCVInfo_ VCVInfo;
struct VCVInfo_ {
int vmaj; /* general type of VCV */
int vmin; /* HC variant, etc. */
int order; /* for use with HAC */
VCVFlags flags; /* includes prewhitening */
double bw; /* for use with QS HAC kernel */
};
/* single-equation model commands */
#define MODEL_COMMAND(c) (c == AR || \
c == AR1 || \
c == ARBOND || \
c == ARCH || \
c == ARMA || \
c == DPANEL || \
c == DURATION || \
c == GARCH || \
c == GMM || \
c == HECKIT || \
c == HSK || \
c == INTREG || \
c == IVREG || \
c == LAD || \
c == LOGISTIC || \
c == LOGIT || \
c == MIDASREG || \
c == MLE || \
c == MPOLS || \
c == NEGBIN || \
c == NLS || \
c == OLS || \
c == PANEL || \
c == POISSON || \
c == PROBIT || \
c == BIPROBIT || \
c == QUANTREG || \
c == TOBIT || \
c == WLS)
#define AR_MODEL(c) (c == AR || \
c == AR1 || \
c == ARMA || \
c == GARCH)
#define SIMPLE_AR_MODEL(c) (c == AR || c == AR1)
#define ML_ESTIMATOR(c) (c == ARMA || \
c == DURATION || \
c == GARCH || \
c == HECKIT || \
c == LOGIT || \
c == MLE || \
c == NEGBIN || \
c == POISSON || \
c == PROBIT || \
c == TOBIT)
#define LIMDEP(c) (c == LOGIT || \
c == PROBIT || \
c == TOBIT || \
c == INTREG)
#define COUNT_MODEL(c) (c == POISSON || c == NEGBIN)
#define LSQ_MODEL(c) (c == AR1 || \
c == HSK || \
c == OLS || \
c == WLS)
#define ASYMPTOTIC_MODEL(c) (c == ARBOND || \
c == ARMA || \
c == DPANEL || \
c == DURATION || \
c == GARCH || \
c == GMM || \
c == HECKIT || \
c == INTREG || \
c == IVREG || \
c == LOGIT || \
c == MLE || \
c == NEGBIN || \
c == POISSON || \
c == PROBIT || \
c == TOBIT || \
c == BIPROBIT)
/* model where the specification is not based on a list
of variables */
#define NONLIST_MODEL(c) (c == NLS || c == MLE || c == GMM || c == MIDASREG)
#define is_model_ref_cmd(c) (c == ADD || \
c == ARCH || \
c == CHOW || \
c == CUSUM || \
c == FCAST || \
c == LEVERAGE || \
c == MODTEST || \
c == OMIT || \
c == RESTRICT || \
c == VIF)
#define RQ_SPECIAL_MODEL(m) ((m->ci == LAD || m->ci == QUANTREG) && \
NULL != gretl_model_get_data(m, "rq_tauvec"))
#define POOLED_MODEL(m) ((m->ci == OLS || m->ci == PANEL) && \
gretl_model_get_int(m, "pooled"))
typedef enum {
GRETL_TEST_ADD,
GRETL_TEST_ARCH,
GRETL_TEST_AUTOCORR,
GRETL_TEST_CHOW,
GRETL_TEST_CUSUM,
GRETL_TEST_QLR,
GRETL_TEST_GROUPWISE,
GRETL_TEST_LOGS,
GRETL_TEST_NORMAL,
GRETL_TEST_OMIT,
GRETL_TEST_RESET,
GRETL_TEST_SQUARES,
GRETL_TEST_WHITES,
GRETL_TEST_SARGAN,
GRETL_TEST_IV_HAUSMAN,
GRETL_TEST_PANEL_HAUSMAN,
GRETL_TEST_PANEL_F,
GRETL_TEST_PANEL_BP,
GRETL_TEST_PANEL_TIMEDUM,
GRETL_TEST_HET_1,
GRETL_TEST_BP,
GRETL_TEST_CHOWDUM,
GRETL_TEST_COMFAC,
GRETL_TEST_INDEP,
GRETL_TEST_RE,
GRETL_TEST_WITHIN_F,
GRETL_TEST_PANEL_WELCH,
GRETL_TEST_RE_WALD,
GRETL_TEST_XDEPEND,
GRETL_TEST_MAX
} ModelTestType;
MODEL *gretl_model_new (void);
void gretl_model_init (MODEL *pmod, const DATASET *dset);
int gretl_model_allocate_storage (MODEL *pmod);
MODEL **gretl_model_array_new (int n);
MODEL *allocate_working_model (void);
void gretl_model_array_destroy (MODEL **models, int n);
void destroy_working_model (MODEL *models);
void gretl_model_smpl_init (MODEL *pmod, const DATASET *dset);
void impose_model_smpl (const MODEL *pmod, DATASET *dset);
void gretl_model_set_auxiliary (MODEL *pmod, ModelAuxCode aux);
void clear_model (MODEL *pmod);
void gretl_model_free (MODEL *pmod);
void clear_model_xpx (MODEL *pmod);
void gretl_model_free_on_exit (MODEL *pmod);
void display_model_data_items (const MODEL *pmod);
int bundlize_model_data_scalars (const MODEL *pmod, void *ptr);
int gretl_model_set_data_with_destructor (MODEL *pmod, const char *key, void *ptr,
GretlType type, size_t size,
void (*destructor) (void *));
int gretl_model_set_data (MODEL *pmod, const char *key, void *ptr,
GretlType type, size_t size);
int gretl_model_set_matrix_as_data (MODEL *pmod, const char *key,
gretl_matrix *m);
int gretl_model_set_list_as_data (MODEL *pmod, const char *key, int *list);
int gretl_model_set_string_as_data (MODEL *pmod, const char *key, char *str);
int gretl_model_set_array_as_data (MODEL *pmod, const char *key,
gretl_array *A);
int gretl_model_destroy_data_item (MODEL *pmod, const char *key);
int gretl_model_detach_data_item (MODEL *pmod, const char *key);
int gretl_model_set_int (MODEL *pmod, const char *key, int val);
int gretl_model_set_double (MODEL *pmod, const char *key, double val);
int gretl_model_set_full_vcv_info (MODEL *pmod, int vmaj, int vmin,
int order, int flags, double bw);
int gretl_model_set_vcv_info (MODEL *pmod, int vmaj, int vmin);
int gretl_model_get_vcv_type (const MODEL *pmod);
int gretl_model_get_hc_version (const MODEL *pmod);
int gretl_model_get_cluster_var (const MODEL *pmod);
void *gretl_model_get_data (const MODEL *pmod, const char *key);
void *gretl_model_get_data_full (const MODEL *pmod, const char *key,
GretlType *type, size_t *sz);
int gretl_model_get_int (const MODEL *pmod, const char *key);
double gretl_model_get_double (const MODEL *pmod, const char *key);
int *gretl_model_get_list (const MODEL *pmod, const char *key);
char *gretl_model_get_param_name (const MODEL *pmod,
const DATASET *dset,
int i, char *targ);
int gretl_model_get_param_number (const MODEL *pmod,
const DATASET *dset,
const char *s);
void free_coeff_intervals (CoeffIntervals *cf);
CoeffIntervals *
gretl_model_get_coeff_intervals (const MODEL *pmod,
const DATASET *dset);
int reset_coeff_intervals (CoeffIntervals *cf, double alpha);
int gretl_model_get_depvar (const MODEL *pmod);
const char *gretl_model_get_depvar_name (const MODEL *pmod,
const DATASET *dset);
int *gretl_model_get_x_list (const MODEL *pmod);
int *gretl_model_get_y_list (const MODEL *pmod);
int *gretl_model_get_secondary_list (const MODEL *pmod);
int arma_model_nonseasonal_AR_order (const MODEL *pmod);
int arma_model_nonseasonal_MA_order (const MODEL *pmod);
int arma_model_max_AR_lag (const MODEL *pmod);
int arma_model_max_MA_lag (const MODEL *pmod);
int arma_model_integrated_AR_MA_coeffs (const MODEL *pmod,
double **phi_star,
double **theta_star);
int regarma_model_AR_coeffs (const MODEL *pmod,
double **phi0,
int *pp);
const double *arma_model_get_x_coeffs (const MODEL *pmod);
int arma_model_get_n_arma_coeffs (const MODEL *pmod);
int regarima_model_get_AR_coeffs (const MODEL *pmod,
double **phi0,
int *pp);
int *arima_delta_coeffs (int d, int D, int s);
int gretl_model_set_coeff_separator (MODEL *pmod, const char *s, int pos);
int gretl_model_get_coeff_separator (const MODEL *pmod, const char **ps, int *ppos);
int gretl_model_new_vcv (MODEL *pmod, int *nelem);
int gretl_model_write_vcv (MODEL *pmod, const gretl_matrix *V);
int gretl_model_add_QML_vcv (MODEL *pmod, int ci,
const gretl_matrix *H,
const gretl_matrix *G,
const DATASET *dset,
gretlopt opt,
gretl_matrix **pV);
int gretl_model_add_hessian_vcv (MODEL *pmod,
const gretl_matrix *H);
int gretl_model_add_OPG_vcv (MODEL *pmod,
const gretl_matrix *G);
VMatrix *gretl_model_get_vcv (MODEL *pmod, const DATASET *dset);
double gretl_model_get_vcv_element (const MODEL *pmod,
int i, int j,
int np);
int gretl_model_write_coeffs (MODEL *pmod, double *b, int k);
int gretl_model_add_arinfo (MODEL *pmod, int nterms);
MODEL *gretl_model_copy (const MODEL *pmod);
void swap_models (MODEL *targ, MODEL *src);
int command_ok_for_model (int test_ci, gretlopt opt,
const MODEL *pmod);
int model_test_ok (int ci, gretlopt opt, const MODEL *pmod,
const DATASET *dset);
int gretl_is_simple_OLS (const MODEL *pmod);
int gretl_is_arima_model (const MODEL *pmod);
int get_first_model_stat (const char **word, const char **desc);
int get_next_model_stat (const char **word, const char **desc);
int get_model_count (void);
void set_model_count (int c);
int model_count_plus (void);
void model_count_minus (void);
void set_model_id (MODEL *pmod);
ModelTest *model_test_new (ModelTestType ttype);
void model_test_free (ModelTest *test);
int maybe_add_test_to_model (MODEL *pmod, ModelTest *test);
void model_test_set_teststat (ModelTest *test, unsigned char ts);
void model_test_set_order (ModelTest *test, int order);
void model_test_set_dfn (ModelTest *test, int df);
void model_test_set_dfd (ModelTest *test, double df);
void model_test_set_value (ModelTest *test, double val);
void model_test_set_pvalue (ModelTest *test, double pval);
void model_test_set_param (ModelTest *test, const char *s);
void model_test_set_opt (ModelTest *test, gretlopt opt);
void model_test_set_allocated_param (ModelTest *test, char *s);
void model_test_set_crit_and_alpha (ModelTest *test,
double crit,
double alpha);
void gretl_model_test_print (const MODEL *pmod, int i, PRN *prn);
void gretl_model_print_last_test (const MODEL *pmod, PRN *prn);
void gretl_model_test_print_direct (const ModelTest *test, int heading,
PRN *prn);
void gretl_model_destroy_tests (MODEL *pmod);
void model_list_to_string (int *list, char *buf);
int highest_numbered_var_in_model (const MODEL *pmod,
const DATASET *dset);
int mle_criteria (MODEL *pmod, int addk);
double coeff_pval (int ci, double x, int df);
double model_coeff_pval (const MODEL *pmod, double x);
int exact_fit_check (const MODEL *pmod, PRN *prn);
void maybe_suppress_time_dummies (MODEL *pmod, int ndum);
int gretl_model_allocate_param_names (MODEL *pmod, int k);
int gretl_model_set_param_name (MODEL *pmod, int i, const char *name);
int gretl_model_add_arma_varnames (MODEL *pmod, const DATASET *dset,
int yno, int p, int q,
const char *pmask, const char *qmask,
int P, int Q,
int r);
int gretl_model_add_panel_varnames (MODEL *pmod, const DATASET *dset,
const int *ulist);
void gretl_model_add_allocated_varnames (MODEL *pmod, char **vnames);
int gretl_model_add_y_median (MODEL *pmod, const double *y);
int gretl_model_add_normality_test (MODEL *pmod, double X2);
int gretl_model_get_normality_test (const MODEL *pmod, PRN *prn);
char *gretl_model_get_fitted_formula (const MODEL *pmod, int xvar,
const DATASET *dset);
void gretl_model_set_name (MODEL *pmod, const char *name);
const char *gretl_model_get_name (const MODEL *pmod);
double gretl_model_get_scalar (MODEL *pmod,
ModelDataIndex idx,
DATASET *dset,
int *err);
int gretl_model_get_series (double *x, MODEL *pmod,
const DATASET *dset,
ModelDataIndex idx);
gretl_matrix *gretl_model_get_matrix (MODEL *pmod,
ModelDataIndex idx,
int *err);
double
gretl_model_get_data_element (MODEL *pmod, int idx, const char *s,
const DATASET *dset, int *err);
int gretl_model_serialize (const MODEL *pmod, SavedObjectFlags flags,
FILE *fp);
#ifdef FULL_XML_HEADERS
int attach_model_tests_from_xml (MODEL *pmod, xmlNodePtr node);
MODEL *gretl_model_from_XML (xmlNodePtr node, xmlDocPtr doc,
const DATASET *dset,
int *err);
#endif
#endif /* GRETL_MODEL_H */
|