1 /*
2  *   Copyright (c) 1998 Lucent Technologies.
3  *   See README file for details.
4  */
5 
6 /*
7   Numeric values for constants used in locfit
8 */
9 
10 /*
11   MXDIM and MXDEG are maximum dimension and local polynomial
12   degree for Locfit. Note that some parts of the code may be
13   more restrictive.
14 */
15 #define MXDIM 15
16 #define MXDEG 7
17 
18 /*
19   floating point constants
20 */
21 #ifndef PI
22 #define PI    3.141592653589793238462643
23 #endif
24 #define S2PI  2.506628274631000502415765
25 #define SQRT2 1.4142135623730950488
26 #define SQRPI 1.77245385090552
27 #define LOGPI 1.144729885849400174143427
28 #define GOLDEN 0.61803398874989484820
29 #define HL2PI 0.91893853320467267 /* log(2pi)/2 */
30 #define SQRPI 1.77245385090552    /* sqrt(pi)   */
31 
32 /*
33   Criteria for adaptive local fitting  mi[MACRI]
34   1: localized CP;  2: ICI (katkovnik);  3: curvature model index
35   4: Increase bandwidth until locfit returns LF_OK
36 */
37 #define ANONE 0
38 #define ACP  1
39 #define AKAT 2
40 #define AMDI 3
41 #define AOK  4
42 
43 /*
44   vector of double precision parameters.
45   0, 1, 2 are the three components of the smoothing parameter.
46   3 cut parameter for adaptive evaluation structures.
47   4-8 are likelihood, degrees of freedom and residual variance,
48   computed as part of the fit.
49   Stored as the lf.dp vector.
50 */
51 #define DALP 0
52 #define DFXH 1
53 #define DADP 2
54 #define DCUT 3
55 #define DLK  4
56 #define DT0  5
57 #define DT1  6
58 #define DRV  7
59 #define DSWT 8
60 #define DRSC 9
61 #define LEND 10
62 
63 /*
64   Evaluation structures mi[MEV]
65   EFITP special for `interpolation' at fit points
66 */
67 #define ENULL  0
68 #define ETREE  1
69 #define EPHULL 2
70 #define EDATA  3
71 #define EGRID  4
72 #define EKDTR  5
73 #define EKDCE  6
74 #define ECROS  7
75 #define EPRES  8
76 #define EXBAR  9
77 #define ENONE  10
78 #define EFITP  50
79 
80 /*
81   integer parameters: sample size; dimension; number of local parameters etc.
82   stored as the lf.mi vector.
83 */
84 #define MN     0
85 #define MP     1
86 #define MDEG0  2
87 #define MDEG   3
88 #define MDIM   4
89 #define MACRI  5
90 #define MKER   6
91 #define MKT    7
92 #define MIT    8
93 #define MMINT  9
94 #define MMXIT 10
95 #define MREN  11
96 #define MEV   12
97 #define MTG   13
98 #define MLINK 14
99 #define MDC   15
100 #define MK    16
101 #define MDEB  17
102 #define MGETH 18
103 #define MPC   19
104 #define MUBAS 20
105 #define LENM  21
106 
107 /*
108   Link functions mi[MLINK].
109   Mostly as in table 4.1 of the book.
110   LDEFAU and LCANON are used to select default and canonical
111   links respectively. LINIT shouldn't be selected by user...
112 */
113 #define LINIT  0
114 #define LDEFAU 1
115 #define LCANON 2
116 #define LIDENT 3
117 #define LLOG   4
118 #define LLOGIT 5
119 #define LINVER 6
120 #define LSQRT  7
121 #define LASIN  8
122 
123 /*
124   components of vector returned by the links() function
125   in family.c. ZLIK the likelihood; ZMEAN = estimated mean;
126   ZDLL = derivative of log-likelihood; ZDDLL = - second derivative
127 */
128 #define LLEN  4
129 #define ZLIK  0
130 #define ZMEAN 1
131 #define ZDLL  2
132 #define ZDDLL 3
133 
134 /*
135   weight functions mi[MKER].
136   see Table 3.1 or the function W() in weights.c for definitions.
137 */
138 #define WRECT 1
139 #define WEPAN 2
140 #define WBISQ 3
141 #define WTCUB 4
142 #define WTRWT 5
143 #define WGAUS 6
144 #define WTRIA 7
145 #define WQUQU 8
146 #define W6CUB 9
147 #define WMINM 10
148 #define WEXPL 11
149 #define WMACL 12
150 #define WPARM 13
151 
152 /*
153   type of multivariate weight function mi[MKT]
154   KSPH (spherical)  KPROD (product)
155   others shouldn't be used at present.
156 */
157 #define KSPH   1
158 #define KPROD  2
159 #define KCE    3
160 #define KLM    4
161 
162 #define STANGL 4
163 #define STLEFT 5
164 #define STRIGH 6
165 #define STCPAR 7
166 
167 /*
168   Local likelihood family mi[MTG]
169   for quasi-likelihood, add 64.
170 */
171 #define TNUL 0
172 #define TDEN 1
173 #define TRAT 2
174 #define THAZ 3
175 #define TGAUS 4
176 #define TLOGT 5
177 #define TPOIS 6
178 #define TGAMM 7
179 #define TGEOM 8
180 #define TCIRC 9
181 #define TROBT 10
182 #define TRBIN 11
183 #define TWEIB 12
184 #define TCAUC 13
185 #define TPROB 14
186 
187 /*
188   Integration type mi[MIT] for integration in
189   density estimation.
190 */
191 #define INVLD 0
192 #define IDEFA 1
193 #define IMULT 2
194 #define IPROD 3
195 #define IMLIN 4
196 #define IHAZD 5
197 #define IMONT 7
198 
199 /*
200   For prediction functions, what to predict?
201   PCOEF -- coefficients        PT0   -- influence function
202   PNLX  -- ||l(x)||            PBAND -- bandwidth h(x)
203   PDEGR -- local poly. degree  PLIK  -- max. local likelihood
204   PRDF  -- local res. d.f.     PVARI -- ||l(x)||^2
205 */
206 #define PCOEF 1
207 #define PT0   2
208 #define PNLX  3
209 #define PBAND 4
210 #define PDEGR 5
211 #define PLIK  6
212 #define PRDF  7
213 #define PVARI 8
214 
215 /*
216   Residual Types
217 */
218 #define RDEV  1
219 #define RPEAR 2
220 #define RRAW  3
221 #define RLDOT 4
222 #define RDEV2 5
223 #define RLDDT 6
224 #define RFIT  7
225 #define RMEAN 8
226 
227 /*
228   components of the colour vector
229 */
230 #define CBAK 0
231 #define CAXI 1
232 #define CTEX 2
233 #define CLIN 3
234 #define CPOI 4
235 #define CCON 5
236 #define CCLA 6
237 #define CSEG 7
238 #define CPA1 8
239 #define CPA2 9
240 
241 /*
242   variable types: double, INT, char, argument list
243 */
244 #define VDOUBLE 0
245 #define VINT    1
246 #define VCHAR   2
247 #define VARGL   3
248 #define VPREP   4
249 #define VARC    5
250 #define VVARI   6
251 #define VXYZ    7
252 
253 /*
254   variable status
255 */
256 #define STEMPTY   0
257 #define STREGULAR 1
258 #define STHIDDEN  3
259 #define STPLOTVAR 4
260 #define STSYSTEM  5
261 #define STSYSPEC  6
262 #define STREADFI  7
263 
264 /*
265   return status for the locfit() function
266 */
267 #define LF_OK   0
268 #define LF_OOB  2   /* out of bounds, or large unstable parameter */
269 #define LF_PF   3   /* perfect fit; interpolation; deviance=0 */
270 #define LF_NCON 4   /* not converged */
271 #define LF_NOPT 6   /* no or insufficient points with non-zero wt */
272 #define LF_INFA 7   /* initial failure e.g. log(0) */
273 #define LF_DEMP 10  /* density -- empty integration region */
274 #define LF_XOOR 11  /* density -- fit point outside xlim region */
275 #define LF_DNOP 12  /* density version of 6 */
276 #define LF_FPROB 80
277 #define LF_BADP 81  /* bad parameters e.g. neg prob for binomial */
278 #define LF_LNK  82  /* invalid link */
279 #define LF_FAM  83  /* invalid family */
280 #define LF_ERR  99  /* error */
281