-
Notifications
You must be signed in to change notification settings - Fork 1
/
the-geostatistical-approach.html
1127 lines (530 loc) · 38.4 KB
/
the-geostatistical-approach.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- Mirrored from www.admb-project.org/examples/spatial-models/the-geostatistical-approach by HTTrack Website Copier/3.x [XR&CO'2013], Mon, 22 Feb 2016 19:58:35 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Plone - http://plone.org" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<base /><!--[if lt IE 7]></base><![endif]-->
<meta content="This is what most people think of when you say "spatial statistics". You explicitly model the correlation matrix/function. Observations do not need to be on a grid; their correlation is typically determined by distance. This example takes you from simple examples with Gaussian observation noise to non-Gaussian response (GLMMs)." name="description" />
<link rel="stylesheet" type="text/css" media="screen" href="http://www.admb-project.org/portal_css/Plone Classic Theme/reset-cachekey-d64e97c57190745447eec68482868965.css" />
<style type="text/css" media="screen">@import url(http://www.admb-project.org/portal_css/Plone Classic Theme/base-cachekey-a6fa436c6a41fda7952093d7881ee663.css);</style>
<link rel="stylesheet" type="text/css" media="screen" href="http://www.admb-project.org/portal_css/Plone Classic Theme/resourcetinymce.stylesheetstinymce-cachekey-0cc0c7dc51feecf44a21ad7190210463.css" />
<style type="text/css">@import url(http://www.admb-project.org/portal_css/Plone Classic Theme/print-cachekey-72533b40995a552a32878fe67f8428ce.css);</style>
<link rel="stylesheet" type="text/css" media="screen" href="http://www.admb-project.org/portal_css/Plone Classic Theme/resourceplone.app.discussion.stylesheetsdiscussion-cachekey-e2e8d8b728e90bf6e40b831e9f80f05f.css" />
<style type="text/css" media="all">@import url(http://www.admb-project.org/portal_css/Plone Classic Theme/ploneCustom-cachekey-58135c753a27b076794372c332f25529.css);</style>
<style type="text/css">@import url(http://www.admb-project.org/portal_css/Plone Classic Theme/kupustyles-cachekey-37e63d9ec7e22c2a960d4462c313b4ff.css);</style>
<script type="text/javascript" src="http://www.admb-project.org/portal_javascripts/Plone Classic Theme/resourceplone.app.jquery-cachekey-38fad805d9c594612ca70fc683b6de50.js"></script>
<script type="text/javascript" src="http://www.admb-project.org/portal_javascripts/Plone Classic Theme/kupunoi18n-cachekey-323b76492cc544e495bf62f730f8f593.js"></script>
<script type="text/javascript" src="http://www.admb-project.org/portal_javascripts/Plone Classic Theme/kss-bbb-cachekey-3a4072cf126f870569155bfab16bb267.js"></script>
<title>Geostatistical approach — ADMB Project</title>
<link rel="shortcut icon" type="image/x-icon" href="http://www.admb-project.org/favicon.ico" />
<link rel="apple-touch-icon" href="http://www.admb-project.org/touch_icon.png" />
<link rel="search" href="http://www.admb-project.org/@@search" title="Search this site" />
<!-- Disable IE6 image toolbar -->
<meta http-equiv="imagetoolbar" content="no" />
</head>
<body class="template-document_view portaltype-document site-Plone section-examples subsection-spatial-models subsection-spatial-models-the-geostatistical-approach subsection-spatial-models-the-geostatistical-approach-the-geostatistical-approach icons-on userrole-anonymous" dir="ltr">
<div id="visual-portal-wrapper">
<div id="portal-top">
<div id="portal-header">
<p class="hiddenStructure">
<a accesskey="2" href="the-geostatistical-approach.html#content">Skip to content.</a> |
<a accesskey="6" href="the-geostatistical-approach.html#portal-globalnav">Skip to navigation</a>
</p>
<ul id="portal-siteactions">
<li id="siteaction-sitemap"><a href="http://www.admb-project.org/sitemap" accesskey="3" title="Site Map">Site Map</a></li>
<li id="siteaction-accessibility"><a href="http://www.admb-project.org/accessibility-info" accesskey="0" title="Accessibility">Accessibility</a></li>
<li id="siteaction-contact"><a href="http://www.admb-project.org/contact-info" accesskey="9" title="Contact">Contact</a></li>
</ul>
<div id="portal-searchbox" style="width: 250px; height: 100px;">
<form name="searchform" action="http://www.admb-project.org/search">
<label for="searchGadget" class="hiddenStructure">Search ADMB</label>
<div class="LSBox">
<input name="SearchableText" type="text" size="18" title="Search ADMB" accesskey="4" class="inputLabel" id="searchGadget" />
<input class="searchButton" type="submit" value="Search" />
<!--
<div class="searchSection">
<input id="searchbox_currentfolder_only"
class="noborder"
type="checkbox"
name="path"
tal:attributes="value view/folder_path"
/>
<label for="searchbox_currentfolder_only"
i18n:translate="label_searchbox_currentfolder_only"
style="cursor: pointer">
only in current section
</label>
</div>
-->
<div class="LSResult" id="LSResult" style=""><div class="LSShadow" id="LSShadow"></div></div>
</div>
</form>
<div id="portal-advanced-search" class="hiddenStructure">
<a href="http://www.admb-project.org/search_form" accesskey="5">
Advanced Search…
</a>
</div>
</div>
<a id="portal-logo" accesskey="1" href="http://www.admb-project.org/">
<!--
<img src="logo.jpg" alt=""
tal:replace="structure view/logo_tag" /></a>
<img src="image/logo-20080527.jpeg" alt="ADMB Project"/></a>
-->
<img src="http://www.soest.hawaii.edu/Illust/admb_dev/image/admb_banner_deep.jpg" alt="ADMB Project" /></a>
<p class="hiddenStructure">Navigation</p>
<ul id="portal-globalnav"><li id="portaltab-index_html" class="plain"><a href="http://www.admb-project.org/" title="">Home</a></li><li id="portaltab-downloads" class="plain"><a href="http://www.admb-project.org/downloads" title="">Downloads</a></li><li id="portaltab-documentation" class="plain"><a href="http://www.admb-project.org/documentation" title="">Documentation</a></li><li id="portaltab-examples" class="selected"><a href="http://www.admb-project.org/examples" title="Under construction">Examples</a></li><li id="portaltab-courses" class="plain"><a href="http://www.admb-project.org/courses" title="Information on ADMB related courses and potential instructors is provided as a public service. These are not products of the ADMB project and currently our policy is to freely announce courses and instructors based on information provided to us. If you would like to submit such information contact Jim Bence ([email protected]). ">Courses</a></li><li id="portaltab-tools" class="plain"><a
href="http://www.admb-project.org/tools" title="">Tools</a></li><li id="portaltab-developers" class="plain"><a href="http://www.admb-project.org/developers" title="Please contact [email protected] if you are interested in actively participating in development of ADMB.">Developers</a></li><li id="portaltab-users" class="plain"><a href="http://www.admb-project.org/users" title="This is the user's community page for ADMB. If you would like to contribute to this section, please email a request for an account to [email protected].">Users</a></li></ul>
</div>
<div id="portal-personaltools-wrapper">
<h5 class="hiddenStructure">Personal tools</h5>
<ul id="portal-personaltools" class="visualInline">
<li id="personaltools-login">
<a href="http://www.admb-project.org/login">Log in</a>
</li>
</ul>
</div>
<div id="portal-breadcrumbs">
<span id="breadcrumbs-you-are-here">You
are here:</span>
<span id="breadcrumbs-home">
<a href="http://www.admb-project.org/">Home</a>
<span class="breadcrumbSeparator">
›
</span>
</span>
<span id="breadcrumbs-1" dir="ltr">
<a href="http://www.admb-project.org/examples">Examples</a>
<span class="breadcrumbSeparator">
›
</span>
</span>
<span id="breadcrumbs-2" dir="ltr">
<a href="../spatial-models.html">Spatial models</a>
<span class="breadcrumbSeparator">
›
</span>
</span>
<span id="breadcrumbs-3" dir="ltr">
<span id="breadcrumbs-current">Geostatistical approach</span>
</span>
</div>
</div>
<div class="visualClear" id="clear-space-before-wrapper-table"><!-- --></div>
<table id="portal-columns">
<tbody>
<tr>
<td id="portal-column-one">
<div class="visualPadding">
<div class="portletWrapper" data-portlethash="706c6f6e652e6c656674636f6c756d6e0a636f6e746578740a2f506c6f6e650a6e617669676174696f6e" id="portletwrapper-706c6f6e652e6c656674636f6c756d6e0a636f6e746578740a2f506c6f6e650a6e617669676174696f6e">
<dl class="portlet portletNavigationTree">
<dt class="portletHeader hiddenStructure">
<span class="portletTopLeft"></span>
<a href="http://www.admb-project.org/sitemap" class="tile">Navigation</a>
<span class="portletTopRight"></span>
</dt>
<dd class="portletItem lastItem">
<ul class="navTree navTreeLevel0">
<li class="navTreeItem visualNoMarker navTreeFolderish section-new-examples">
<a href="../new-examples.html" class="state-published navTreeFolderish contenttype-topic" title="Examples created less than 1 year ago. In cases where a hierarchy of catalogues are created parent catalogues also show up">
<span>New examples</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-copy_of_new-examples">
<a href="../copy_of_new-examples.html" class="state-published navTreeFolderish contenttype-topic" title="All examples currently available in the website">
<span>All examples</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-by-field-of-application">
<a href="../by-field-of-application.html" class="state-published navTreeFolderish contenttype-folder" title="">
<span>By field of application</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-differential-equations">
<a href="../differential-equations.html" class="state-published navTreeFolderish contenttype-folder" title="">
<span>Differential equations</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-categorical-data">
<a href="../categorical-data.html" class="state-published navTreeFolderish contenttype-folder" title="">
<span>Categorical data</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-fisheries">
<a href="../fisheries.html" class="state-published navTreeFolderish contenttype-folder" title="Different uses of ADMB in fisheries stock assessments or other fisheries work">
<span>Fisheries</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-growth-models">
<a href="../growth-models.html" class="state-published navTreeFolderish contenttype-folder" title="">
<span>Growth models</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-glmm-generalized-linear-mixed-models">
<a href="../glmm-generalized-linear-mixed-models.html" class="state-published navTreeFolderish contenttype-folder" title="">
<span>GLM/GLMM/GAM</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-function-minimization">
<a href="../function-minimization.html" class="state-published navTreeFolderish contenttype-folder" title="Various tricks and techniques related to the function minimizer to improve convergence">
<span>Function minimizer</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-admb-tricks">
<a href="../admb-tricks.html" class="state-published navTreeFolderish contenttype-folder" title="Various undocumented techniques and tricks useful for developing ADMB programs">
<span>Math</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-mark-recapture">
<a href="../mark-recapture.html" class="state-published navTreeFolderish contenttype-folder" title="">
<span>Mark-recapture</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-r-stuff">
<a href="../r-stuff.html" class="state-published navTreeFolderish contenttype-folder" title="">
<span>R stuff</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-simple-examples">
<a href="../simple-examples.html" class="state-published navTreeFolderish contenttype-folder" title="">
<span>Simple examples</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-sampling">
<a href="../sampling.html" class="state-published navTreeFolderish contenttype-folder" title="Survey sampling related examples">
<span>Sampling</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeItemInPath navTreeFolderish section-spatial-models">
<a href="../spatial-models.html" class="state-published navTreeItemInPath navTreeFolderish contenttype-folder" title="ADMB supports both the geostatistical approach and Gaussian Markov random field approach to spatial modelling
">
<span>Spatial models</span>
</a>
<ul class="navTree navTreeLevel1">
<li class="navTreeItem visualNoMarker navTreeCurrentNode navTreeFolderish section-the-geostatistical-approach">
<a href="the-geostatistical-approach.html" class="state-published navTreeCurrentItem navTreeCurrentNode navTreeFolderish contenttype-folder" title="The approach to spatial modeling where you explicitly model the covariance function/matrix. First used in geology/mining (hence the name). Can be used with both Gaussian and non-Gaussian response for data.">
<span>Geostatistical approach</span>
</a>
<ul class="navTree navTreeLevel2">
<li class="navTreeItem visualNoMarker section-spatial_simple-tpl">
<a href="the-geostatistical-approach/spatial_simple.tpl/view.html" class="state-missing-value contenttype-file" title="">
<img width="16" height="16" src="http://www.admb-project.org/application.png" alt="File text/x-perl" />
<span>spatial_simple.tpl</span>
</a>
</li>
<li class="navTreeItem visualNoMarker section-spatial_simple-dat">
<a href="the-geostatistical-approach/spatial_simple.dat/view.html" class="state-missing-value contenttype-file" title="">
<img width="16" height="16" src="http://www.admb-project.org/unknown.png" alt="File chemical/x-mopac-input" />
<span>spatial_simple.dat</span>
</a>
</li>
<li class="navTreeItem visualNoMarker section-admbutils-s">
<a href="the-geostatistical-approach/ADMButils.s/view.html" class="state-missing-value contenttype-file" title="">
<img width="16" height="16" src="http://www.admb-project.org/application.png" alt="File" />
<span>ADMButils.s</span>
</a>
</li>
<li class="navTreeItem visualNoMarker section-spatial_simple-r">
<a href="the-geostatistical-approach/spatial_simple.R/view.html" class="state-missing-value contenttype-file" title="">
<img width="16" height="16" src="http://www.admb-project.org/application.png" alt="File" />
<span>spatial_simple.R</span>
</a>
</li>
<li class="navTreeItem visualNoMarker section-spatial_nonre-tpl">
<a href="the-geostatistical-approach/spatial_nonre.tpl/view.html" class="state-missing-value contenttype-file" title="">
<img width="16" height="16" src="http://www.admb-project.org/application.png" alt="File text/x-perl" />
<span>spatial_nonre.tpl</span>
</a>
</li>
<li class="navTreeItem visualNoMarker section-spatial_negbin-tpl">
<a href="the-geostatistical-approach/spatial_negbin.tpl/view.html" class="state-missing-value contenttype-file" title="">
<img width="16" height="16" src="http://www.admb-project.org/application.png" alt="File text/x-perl" />
<span>spatial_negbin.tpl</span>
</a>
</li>
<li class="navTreeItem visualNoMarker section-spatial_negbin-r">
<a href="the-geostatistical-approach/spatial_negbin.R/view.html" class="state-missing-value contenttype-file" title="">
<img width="16" height="16" src="http://www.admb-project.org/application.png" alt="File" />
<span>spatial_negbin.R</span>
</a>
</li>
</ul>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-glmm-with-spatial-structure-described-in-terms-of">
<a href="glmm-with-spatial-structure-described-in-terms-of-covariance-function.html" class="state-published navTreeFolderish contenttype-folder" title="An example of the geostatistical approach to spatial modelling. The response distribution is Poisson with an isotropic correlation function r(d), where "d" is the distiance between two locations.">
<span>Poisson GLMM</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-mgrf-car-model-for-the-scottish-lip-cancer-data">
<a href="mgrf-car-model-for-the-scottish-lip-cancer-data.html" class="state-published navTreeFolderish contenttype-folder" title="CAR model for the Scottish Lip Cancer Data">
<span>MGRF: simple CAR model</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-glmm2019s-on-large-spatial-grids">
<a href="glmm2019s-on-large-spatial-grids.html" class="state-published navTreeFolderish contenttype-folder" title="It has for a long time been possible to fit GLMMs (Generalized Linear Mixed Models) in ADMB-RE. A typical example is correlated count data with Poisson distribution. However, when the observation are located on a spatial grid the number of latent variables (random effects in the ADMB-RE terminology) grows quadratically in the number of grid points in each geographical direction. The large number of random effects causes a computational challenge.">
<span>Separable: Method explanation</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-separable-different-implementation">
<a href="separable-different-implementation.html" class="state-published navTreeFolderish contenttype-folder" title="Three different implementations of the same model with separable spatial covariance function in a fully Gaussian situation: i) Plain ADMB (non-random effect) ii) Geostatistical formulation iii) Hybrid approach. ">
<span>Comparison of approaches</span>
</a>
</li>
</ul>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-state-space-models">
<a href="../state-space-models.html" class="state-published navTreeFolderish contenttype-folder" title="">
<span>State-space models</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-survival-analysis">
<a href="../survival-analysis.html" class="state-published navTreeFolderish contenttype-folder" title="Lifetime data and survival analysis">
<span>Survival analysis</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-text-books">
<a href="../text-books.html" class="state-published navTreeFolderish contenttype-folder" title="Collections of examples taken from text books">
<span>Text books</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-winbugs">
<a href="../winbugs.html" class="state-published navTreeFolderish contenttype-folder" title="Comparison with the software package WinBUGS">
<span>WinBUGS</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-miscellaneous">
<a href="../miscellaneous.html" class="state-published navTreeFolderish contenttype-folder" title="Stuff that is hard to categorize, but still is useful">
<span>Miscellaneous</span>
</a>
</li>
<li class="navTreeItem visualNoMarker navTreeFolderish section-storage">
<a href="../storage.html" class="state-published navTreeFolderish contenttype-folder" title="Physical storage of individual examples with guarantied permanent URL">
<span>Storage</span>
</a>
</li>
</ul>
<span class="portletBottomLeft"></span>
<span class="portletBottomRight"></span>
</dd>
</dl>
</div>
</div>
</td>
<td id="portal-column-content">
<div id="viewlet-above-content"></div>
<div class="">
<span id="contentTopLeft"></span>
<span id="contentTopRight"></span>
<dl class="portalMessage info" id="kssPortalMessage" style="display:none">
<dt>Info</dt>
<dd></dd>
</dl>
<div id="content">
<h1 id="parent-fieldname-title" class="documentFirstHeading">
Geostatistical approach
</h1>
<div id="parent-fieldname-description" class="documentDescription">
This is what most people think of when you say "spatial statistics". You explicitly model the correlation matrix/function. Observations do not need to be on a grid; their correlation is typically determined by distance. This example takes you from simple examples with Gaussian observation noise to non-Gaussian response (GLMMs).
</div>
<div id="content-core">
<div class="" id="parent-fieldname-text-9b56bb0c-e62b-4632-a7ab-34d0403c9ca3">
<h2>Model description</h2>
<p>The key model component is a latent Gaussian random field u(x,y), where x and y are the spatial coordinates. We assume that the field is isotropic, i.e. that cor[u(x<sub>1</sub>,y<sub>1</sub>),u(x<sub>2</sub>,y<sub>2</sub>)] = ρ(r), where r = sqrt( (x<sub>1</sub>-x<sub>2</sub>)<sup>2</sup> + (y<sub>1</sub>-y<sub>2</sub>)<sup>2</sup>) is the Euclidean distance.</p>
<h3><br /></h3>
<h3>Gaussian measurement error<br /></h3>
<p>The random field is typically observed with measurement error (e). The observations (Y) are:</p>
<p> </p>
<p> Y<sub>i</sub> = β + σ*u(x<sub>i</sub>,y<sub>i</sub>) +e<sub>i</sub>, i = 1,...,n,</p>
<p> </p>
<p>where β is the expectation value. Marginally (at each point) u(x,y) ~ N(0,1), but note that we scale the field by a standard deviation σ. Further, we assume that e<sub>i</sub> ~ N(0,σ<sub>e</sub><sup>2</sup>), where σ<sub>e</sub> is often called the "nugget" effect, so that in total Y ~ N(β,σ<sup>2</sup> + σ<sub>e</sub><sup>2</sup>)</p>
<p> </p>
<h3>Specification of the covariance matrix<br /></h3>
<p>The correlation matrix is denoted by <em>M</em>, and is defined elementwise as M<sub>ij</sub> = ρ(d<sub>ij</sub>), where <em>d</em><sub>ij</sub> is the distance between observation i and j. In this example we use an exponential correlation function ρ(<em>d</em>) = exp(-<em>a*d</em>), where a is a parameter (to be estimated) that controls how quickly the correlation drops off.</p>
<p> </p>
<p>There is a special setup in ADMB that makes computations in geostatistical models efficient</p>
<pre>PARAMETER_SECTION
random_effects_vector u(1,n,2)
normal_prior M(u);
NORMAL_PRIOR_FUNCTION void get_M(const dvariable& _a)
// Function descript goes here ....
FUNCTION void evaluate_M(void)
get_M(a);</pre>
<p>In the beginning it is easiest if you use this templates, but the advanced user may change the names according to the following rules:</p>
<ul><li>
<p>The "normal_prior" associates <em>M</em> with the vector <em>u</em> of random effects</p>
</li>
<ul><li>You are free to name the correlation matrix anything you want; we use <em>M</em></li><li>The only use of <em>M</em> you should make is to assign a value to it inside NORMAL_PRIOR_FUNCTION (see examples).<br /></li></ul>
<li>NORMAL_PRIOR_FUNCTION</li>
<ul><li>Purpose: <br /></li>
<ul><li>Evaluate <em>M</em></li><li>Add contribution from u to objective function : -0.5*logdet(<em>M</em>) -0.5*<em>u</em>*inv(<em>M</em>)*<em>u</em><br /></li></ul>
<li>Define exactly 1 function of this type; called "get_M" in our case, but you can change the name</li><li>get_M() should end with an assignment to <em>M</em></li><li>get_M() can take more than more parameter, yielding more flexible correlation functions<br /></li></ul>
<li>evaluate_M()</li>
<ul><li>There must <strong>always</strong> be a function with this name, i.e. you can not change its name even if you change the name of <em>M</em></li><li>It should contain a call to get_M (or whatever you have called it).</li></ul>
</ul>
<p> </p>
<h3>Phases</h3>
<p>Each parameter to be estimated has an associated "phase" in ADMB. In latent variable models you should first estimate fixed effects (β) and measurement error (σ). In the second phase you estimate parameters associated with the latent random field (σ<sub>e</sub> and a). In the first phase σ<sub>e</sub> and a will be fixed to their initial values (whatever you set that to be).</p>
<p> </p>
<h2>Exercises: Modify the model<br /></h2>
<p>The code for the above model is given in "spatial_simple.tpl". You should try the following:</p>
<ul><li><strong>Plot variograms </strong>of Y. You can use the R library "geoR" (if you have this package install in R) using the command<br /></li></ul>
<pre> plot(variog(geodata=list(coords=Z,data=Y)))</pre>
<p>
Run the ADMB program (so that "spatial_simple.rep" containing residuals gets</p>
<p> produced) and then use the R commands</p>
<pre> r=scan("spatial_simple.rep")
plot(variog(geodata=list(coords=Z,data=r)))</pre>
<p> The residuals r should be close to uncorrelated, while the correlation in Y should</p>
<p> correspond to the correlation function (exponential) you have used to generate data.</p>
<ul><li><strong>Generating other datasets </strong>The R script "spatial_simple.R" generates the dat-file. Modify the script and run it using source("spatial_simple.R"), and see if the ADMB output changes accordingly. You also need to download "ADMButils.R").<br /></li><li><strong>Implement non-RE version.</strong> Because this is a fully Gaussian model it is possible to implement the likelihood directly without using the random effects features of ADMB. The key point is to notice that the (marginal) covariance matrix of Y is σ<sup>2</sup>M+σ<sub>e</sub><sup>2</sup>I, where I is the identity matrix (1's on the diagonal; 0's everywhere else). Either write your own tpl, or use "spatial_nonre.tpl". Compare results and run times.<br /></li><li><strong>Flexible correlation function</strong> Use a half-normal correlation function ρ(d) = a<sub>1</sub>exp{-(d/a<sub>2</sub>)<sup>2</sup>}, where -a<sub>1</sub> and a<sub>2 </sub>are parameters that you estimate.</li></ul>
<pre> tmpM(i,j)=a1*exp(-square(d(i,j)/a2));</pre>
<ul><li><strong>Experiment with phases </strong>and see if the use of phases affects run times. Go back to "spatial_simple.tpl" and use the command "time" in your operating system to measure the run time.</li>
<ul><li>Try to activate all parameters in phase 1</li><li>Try to activate "a" in phase 3</li></ul>
</ul>
<pre> time -est spatial_simple</pre>
<ul><li><strong>Linear predictor </strong>As in ordinary multiple regression we let X be a design matrix (that is constructed externally, using for instance "design.matrix()" in R)<br /></li>
<ul><li>Let β be a vector; read in covariate (design) matrix X<br /></li><li>Insert linear predictor in expectation value μ = X*beta + σ*u</li><li>Modify "spatial_simple.R" so that X is generated and written to the .dat file.</li></ul>
</ul>
<pre>DATA_SECTION
init_int p // Number of fixed effects (b's)
init_matrix X(1,n,1,p) // Covariate matrix
SEPARABLE_FUNCTION void normal_loglik()
dvariable mu = X(u)*beta + sigma*u_i;</pre>
<ul><li><strong>Negative binomial response </strong>Go back to "spatial_simple.tpl" and replace the Gaussian response with a negative binomial distribution. We now longer have an additive measurement error, but instead a GLMM, where it is natural to write the model in an hierarchical form</li></ul>
<p> Y | u = Neg. bin (μ,κ)</p>
<p> log(μ) = β + σ*u(x,y)</p>
<p> where Y|u denotes conditional probability (conditionally on u).</p>
<ul><li>The expectation μ must be positive, so we use a log-link, i.e. μ = exp{β + σ*u(x<sub>i</sub>,y<sub>i</sub>)}</li><li>τ = Var(Y)/E(Y) > 1 is the over dispersion. <br /></li>
<ul><li>For τ=1 the negative binomial distribution collapses to the Poisson distribution and τ=10 is a large deviation from Poisson (try to plot the probability function for τ=10).</li><li>τ should be given phase 2, while parameters governing the latent field (σ and a) should be postponed to phase 3<br /></li></ul>
</ul>
<pre>PARAMETER_SECTION
init_bounded_number tau(1.0,10,2) // Over dispersion
SEPARABLE_FUNCTION void negbin_loglik(...,const dvariable& tau)
dvariable sigma = exp(log_sigma);
dvariable mu = exp(beta + sigma*u_i); // Mean of Y
l -= log_negbinomial_density(Y(i),mu,tau);</pre>
<ul><li><strong>Code </strong>ADMB (spatial_negbin.tpl) and R code for (spatial_negbin.R) are provided.<br /></li></ul>
<p> </p>
<p><sub><br /></sub></p>
Α α Β β Γ γ Δ δ Ε ε Ζ ζ Η η Θ θ Ι ι Κ
κ Λ λ Μ μ Ν ν Ξ ξ Ο ο Π π Ρ ρ Σ σ ς Τ τ
Υ υ Φ φ Χ χ Ψ ψ Ω ω
</div>
</div>
<div class="visualClear"><!-- --></div>
<div class="documentActions">
</div>
</div>
<span id="contentBottomLeft"></span>
<span id="contentBottomRight"></span>
</div>
<div id="viewlet-below-content">
</div>