lfcons.h 6.1 KB

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