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 /* subsample.h for gretl */
21 
22 #ifndef SUBSAMPLE_H
23 #define SUBSAMPLE_H
24 
25 #define RESAMPLED ((char *) 0xdeadbeef)
26 
27 DATASET *fetch_full_dataset (void);
28 
29 void sync_dataset_shared_members (const DATASET *dset);
30 
31 void free_subsample_mask (char *s);
32 
33 char *copy_subsample_mask (const char *src, int *err);
34 
35 char *copy_dataset_submask (const DATASET *dset, int *err);
36 
37 int write_dataset_submask (const DATASET *dset, PRN *prn);
38 
39 int write_model_submask (const MODEL *pmod, PRN *prn);
40 
41 int get_dataset_submask_size (const DATASET *dset);
42 
43 int get_model_submask_size (const MODEL *pmod);
44 
45 int subsample_check_model (MODEL *pmod, char *mask);
46 
47 int remove_model_subsample_info (MODEL *pmod);
48 
49 int submask_cmp (const char *m1, const char *m2);
50 
51 int attach_subsample_to_model (MODEL *pmod, const DATASET *dset);
52 
53 int add_dataset_to_model (MODEL *pmod, const DATASET *dset,
54 			  gretlopt opt);
55 
56 int restrict_sample (const char *param, const int *list,
57 		     DATASET *dset, ExecState *state,
58 		     gretlopt opt, PRN *prn,
59 		     int *n_dropped);
60 
61 int restrict_sample_from_mask (char *mask, DATASET *dset,
62 			       gretlopt opt);
63 
64 int perma_sample (DATASET *dset, gretlopt opt, PRN *prn,
65 		  int *n_dropped);
66 
67 int complex_subsampled (void);
68 
69 int dataset_is_subsampled (const DATASET *dset);
70 
71 int get_full_length_n (void);
72 
73 void set_dataset_resampled (DATASET *dset, unsigned int seed);
74 
75 int dataset_is_resampled (const DATASET *dset);
76 
77 int set_sample (const char *start, const char *stop,
78 		DATASET *dset, gretlopt opt);
79 
80 int set_panel_sample (const char *start, const char *stop,
81 		      gretlopt opt, DATASET *dset);
82 
83 int restore_full_sample (DATASET *dset, ExecState *state);
84 
85 int backup_full_dataset (DATASET *dset);
86 
87 int count_missing_values (const DATASET *dset, gretlopt opt,
88 			  PRN *prn, int *err);
89 
90 void maybe_free_full_dataset (const DATASET *dset);
91 
92 int model_sample_problem (const MODEL *pmod, const DATASET *dset);
93 
94 int fcast_not_feasible (const MODEL *pmod, const DATASET *dset);
95 
96 int same_dataset (const MODEL *pmod, const DATASET *dset);
97 
98 void print_sample_obs (const DATASET *dset, PRN *prn);
99 
100 void print_sample_status (const DATASET *dset, PRN *prn);
101 
102 int data_report (const DATASET *dset, const char *fname, PRN *prn);
103 
104 #endif /* SUBSAMPLE_H */
105