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