0
|
1 /*
|
|
2 * Copyright 1996-2006 Catherine Loader.
|
|
3 */
|
|
4 #ifndef I_LFEV_H
|
|
5 #define I_LFEV_H
|
|
6
|
|
7 #include "locf.h"
|
|
8 #include "tube.h"
|
|
9
|
|
10 /* uncomment the following line to allow plug-in modules. */
|
|
11 /*#define ALLOW_MODULES*/
|
|
12
|
|
13 #define DALP 0
|
|
14 #define DFXH 1
|
|
15
|
|
16 typedef struct {
|
|
17 int ev;
|
|
18 double *sv;
|
|
19 double cut;
|
|
20 double fl[2*MXDIM];
|
|
21 int *iwk, *ce, *s, *lo, *hi;
|
|
22 int liw, nce, ncm, maxk;
|
|
23 int mg[MXDIM];
|
|
24 void (*espec)();
|
|
25 } evstruc;
|
|
26 #define ev(evs) ((evs)->ev)
|
|
27 #define cut(evs) ((evs)->cut)
|
|
28 #define mk(evs) ((evs)->maxk)
|
|
29 #define mg(evs) ((evs)->mg)
|
|
30
|
|
31 typedef struct {
|
|
32 double *xev, *wk, *coef, *nlx, *t0, *lik, *h, *deg, *kap;
|
|
33 int lev, lwk;
|
|
34 int d, dcor, geth, hasd;
|
|
35 int nv, nvm;
|
|
36 } fitpt;
|
|
37 #define evp(fp) ((fp)->xev)
|
|
38 #define evpt(fp,i) (&(fp)->xev[(i)*(fp)->d])
|
|
39 #define evptx(fp,i,k) ((fp)->xev[(i)*(fp)->d+(k)])
|
|
40 #define llk(fp) ((fp)->kap[0])
|
|
41 #define df0(fp) ((fp)->kap[1])
|
|
42 #define df1(fp) ((fp)->kap[2])
|
|
43 #define rv(fp) ((fp)->kap[3])
|
|
44 #define rsc(fp) ((fp)->kap[5])
|
|
45 #define dc(fp) ((fp)->dcor)
|
|
46 #define geth(fp) ((fp)->geth)
|
|
47
|
|
48 typedef struct {
|
|
49 int (*procv)(), keepv, keepc, nopc, isset, np;
|
|
50 void (*alloc)();
|
|
51 void (*pproc)();
|
|
52 double *params;
|
|
53 } module;
|
|
54 #define PROC_VERTEX(des,lf,i) (lf)->mdl.procv((des),(lf),(i))
|
|
55 #define MODPARAMS(lf) ((lf)->mdl.params)
|
|
56 #define MODPARAM(lf,i) ((lf)->mdl.params[i])
|
|
57 #define MODNPARAMS(lf) ((lf)->mdl.np)
|
|
58 #define PROCV(lf) (lf)->mdl.procv
|
|
59 #define ALLOC(lf) (lf)->mdl.alloc
|
|
60 #define PPROC(lf) (lf)->mdl.pproc
|
|
61 #define KEEPC(lf) (lf)->mdl.keepc
|
|
62 #define KEEPV(lf) (lf)->mdl.keepv
|
|
63 #define NOPC(lf) (lf)->mdl.nopc
|
|
64
|
|
65 typedef struct {
|
|
66 int lf_init_id;
|
|
67 lfdata lfd;
|
|
68 smpar sp;
|
|
69 evstruc evs;
|
|
70 fitpt fp;
|
|
71 deriv dv;
|
|
72 paramcomp pc;
|
|
73 module mdl;
|
|
74 } lfit;
|
|
75 #define LF_INIT_ID 34897239
|
|
76 #define NOBS(lf) ((lf)->lfd.n)
|
|
77 #define NVAR(lf) ((lf)->lfd.d)
|
|
78 #define NPAR(lf) ((lf)->sp.p)
|
|
79
|
|
80 /*
|
|
81 * VVEC(lf,i) is storage vector for the i'th item.
|
|
82 * VVAL(lf,v,i) is the storage point for the i'th item when fitting at vertex v.
|
|
83 * should have 0 <= i < keepv; keepv defined when initializing module.
|
|
84 */
|
|
85 #define VVEC(lf,i) (&(lf)->fp.wk[(i)*(lf)->fp.nvm])
|
|
86 #define VVAL(lf,v,i) ((lf)->fp.wk[(i)*(lf)->fp.nvm+(v)])
|
|
87 #define VECR(lf) ((lf)->kap)
|
|
88
|
|
89 /*
|
|
90 * mi[MGETH] codes
|
|
91 * scb(), pointwise codes are 71,...,75.
|
|
92 * add 10 for simultaneous codes.
|
|
93 */
|
|
94 #define GSTD 0
|
|
95 #define GHAT 1
|
|
96 #define GKAP 2
|
|
97 #define GRBD 3
|
|
98 #define GAMF 4
|
|
99 #define GAMP 5
|
|
100 #define GLSC 6
|
|
101 #define GSMP 7
|
|
102 #define GMIX 8
|
|
103 #define GLM1 71
|
|
104 #define GLM2 72
|
|
105 #define GLM3 73
|
|
106 #define GLM4 74
|
|
107 #define GLDN 75
|
|
108
|
|
109 /* bandwidth criteria */
|
|
110 #define BGCV 1
|
|
111 #define BCP 2
|
|
112 #define BIND 3
|
|
113
|
|
114 /*
|
|
115 * Evaluation structures
|
|
116 * EFITP special for `interpolation' at fit points
|
|
117 */
|
|
118 #define ENULL 0
|
|
119 #define ETREE 1
|
|
120 #define EPHULL 2
|
|
121 #define EDATA 3
|
|
122 #define EGRID 4
|
|
123 #define EKDTR 5
|
|
124 #define EKDCE 6
|
|
125 #define ECROS 7
|
|
126 #define EPRES 8
|
|
127 #define EXBAR 9
|
|
128 #define ENONE 10
|
|
129 #define ESPHR 11
|
|
130 #define EFITP 50
|
|
131 #define ESPEC 100
|
|
132
|
|
133 /*
|
|
134 * For prediction functions, what to predict?
|
|
135 * PCOEF -- coefficients PT0 -- influence function
|
|
136 * PNLX -- ||l(x)|| PBAND -- bandwidth h(x)
|
|
137 * PDEGR -- local poly. degree PLIK -- max. local likelihood
|
|
138 * PRDF -- local res. d.f. PVARI -- ||l(x)||^2
|
|
139 */
|
|
140 #define PCOEF 1
|
|
141 #define PT0 2
|
|
142 #define PNLX 3
|
|
143 #define PBAND 4
|
|
144 #define PDEGR 5
|
|
145 #define PLIK 6
|
|
146 #define PRDF 7
|
|
147 #define PVARI 8
|
|
148
|
|
149 /*
|
|
150 * Residual Types
|
|
151 */
|
|
152 #define RDEV 1
|
|
153 #define RPEAR 2
|
|
154 #define RRAW 3
|
|
155 #define RLDOT 4
|
|
156 #define RDEV2 5
|
|
157 #define RLDDT 6
|
|
158 #define RFIT 7
|
|
159 #define RMEAN 8
|
|
160
|
|
161 /* band.c */
|
|
162 extern void band(), kdeselect(), kdecri(), bselect();
|
|
163
|
|
164 /* dens_int.c */
|
|
165 extern double dens_integrate();
|
|
166 extern void dens_renorm(), lforder();
|
|
167
|
|
168 /* ev_atree.c */
|
|
169 extern void atree_start(), atree_grow(), atree_guessnv();
|
|
170 extern double atree_int();
|
|
171
|
|
172 /* ev_interp.c */
|
|
173 extern double dointpoint(), cubintd();
|
|
174 extern double linear_interp(), cubic_interp(), rectcell_interp();
|
|
175 extern int exvval();
|
|
176 extern void exvvalpv(), hermite2();
|
|
177
|
|
178 /* ev_kdtre.c */
|
|
179 extern void kdtre_start(), kdtre_guessnv();
|
|
180 extern double kdtre_int();
|
|
181
|
|
182 /* ev_sphere.c */
|
|
183 extern void sphere_start(), sphere_guessnv();
|
|
184 extern double sphere_int();
|
|
185
|
|
186 /* ev_main.c */
|
|
187 extern void trchck(), guessnv(), lfit_alloc(), evstruc_alloc(), evstruc_init();
|
|
188 extern void dataf(), gridf(), crossf(), xbarf(), preset();
|
|
189 extern int findpt(), newsplit(), lfit_reqd(), evstruc_reqi();
|
|
190 extern int lfevstr();
|
|
191
|
|
192 /* ev_trian.c */
|
|
193 extern void triang_start(), triang_grow(), triang_guessnv();
|
|
194 extern double triang_int();
|
|
195
|
|
196 /* fitted.c */
|
|
197 extern void fitted();
|
|
198 extern double resid();
|
|
199 extern int restyp();
|
|
200
|
|
201 /* frend.c */
|
|
202 extern void ressumm();
|
|
203 extern double rss();
|
|
204
|
|
205 /* lf_dercor.c */
|
|
206 extern void dercor();
|
|
207
|
|
208 /* pcomp.c */
|
|
209 extern double addparcomp();
|
|
210 extern void compparcomp(), subparcomp(), subparcomp2(), pcchk();
|
|
211 extern int pc_reqd(), noparcomp();
|
|
212
|
|
213 /* preplot.c */
|
|
214 extern void preplot(), cpreplot();
|
|
215 extern int setpppoints(), ppwhat();
|
|
216
|
|
217 /* procv.c */
|
|
218 extern int procv_nov(), procv_var();
|
|
219
|
|
220 /* startlf.c */
|
|
221 extern void set_flim(), set_scales(), nstartlf(), startlf(), lfit_init();
|
|
222 extern void fitoptions(), clocfit(), endfit(), startmodule();
|
|
223 extern int nofit(), initmodule();
|
|
224
|
|
225 extern void initsimple(), initstd(), inithatm(), initgam(), initallcf();
|
|
226 extern void initlscv(), initrband(), initscb(), initkappa(), initvord();
|
|
227
|
|
228 /* modkappa.c */
|
|
229 extern int constants();
|
|
230
|
|
231 /* modrband.c */
|
|
232 extern void rband();
|
|
233
|
|
234 /* modstd.c */
|
|
235 extern int procvstd();
|
|
236 #endif /* define I_LFEV_H */
|