Beispiel #1
0
static void 
populate_x12a_arma_model (MODEL *pmod, const char *path, 
			  const DATASET *dset, 
			  arma_info *ainfo)
{
    char fname[MAXLEN];
    int err;

    pmod->t1 = ainfo->t1;
    pmod->t2 = ainfo->t2;
    pmod->ncoeff = ainfo->nc;
    pmod->full_n = dset->n;

    err = gretl_model_allocate_storage(pmod);
    if (err) {
	pmod->errcode = err;
	return;
    }

    sprintf(fname, "%s.est", path);
    err = get_estimates(fname, pmod, ainfo);

    if (!err) {
	sprintf(fname, "%s.rsd", path);
	err = get_uhat(fname, pmod, dset);
    }

    if (!err) {
	sprintf(fname, "%s.lks", path);
	err = get_ll_stats(fname, pmod);
    }

    if (!err) {
	sprintf(fname, "%s.rts", path);
	err = get_roots(fname, pmod, ainfo);
    }

#if 0
    if (!err) {
	sprintf(fname, "%s.acm", path);
	err = get_x12a_vcv(fname, pmod, nc);
	/* also .rcm */
    }
#endif

    if (err) {
	fprintf(stderr, "problem reading X-12-ARIMA model info\n");
	pmod->errcode = err;
    } else {
	write_arma_model_stats(pmod, ainfo, dset);
    }
}
Beispiel #2
0
static void handle_null_model (MODEL *pmod, arma_info *ainfo)
{
    int full_n = pmod->full_n;

    pmod->ncoeff = 1;
    pmod->full_n = 0;
    pmod->errcode = gretl_model_allocate_storage(pmod);
    pmod->full_n = full_n;

    if (!pmod->errcode) {
	gretl_model_set_int(pmod, "null-model", 1);
	pmod->coeff[0] = 0.0;
	pmod->sigma = pmod->sdy;
    }
}