1 Star 0 Fork 0

RStata 团队/spatial-analysis-r

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
spatially-continuous-data-i.html 146.96 KB
一键复制 编辑 原始数据 按行查看 历史
paezha 提交于 2021-12-14 01:26 . paezha published a site update
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Chapter 31 Spatially Continuous Data I | An Introduction to Spatial Data Analysis and Statistics: A Course in R</title>
<meta name="description" content="This book was created as a resource for teaching applied spatial statistics at McMaster University by Antonio Paez, with support from Anastassios Dardas, Rajveer Ubhi, Megan Coad, and Alexis Polidoro. The book is published with support of an Open Educational Resources grant from MacPherson Institute, McMaster University." />
<meta name="generator" content="bookdown 0.24 and GitBook 2.6.7" />
<meta property="og:title" content="Chapter 31 Spatially Continuous Data I | An Introduction to Spatial Data Analysis and Statistics: A Course in R" />
<meta property="og:type" content="book" />
<meta property="og:image" content="/images/cover.jpg" />
<meta property="og:description" content="This book was created as a resource for teaching applied spatial statistics at McMaster University by Antonio Paez, with support from Anastassios Dardas, Rajveer Ubhi, Megan Coad, and Alexis Polidoro. The book is published with support of an Open Educational Resources grant from MacPherson Institute, McMaster University." />
<meta name="github-repo" content="paezha/spatial-analysis-R" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Chapter 31 Spatially Continuous Data I | An Introduction to Spatial Data Analysis and Statistics: A Course in R" />
<meta name="twitter:description" content="This book was created as a resource for teaching applied spatial statistics at McMaster University by Antonio Paez, with support from Anastassios Dardas, Rajveer Ubhi, Megan Coad, and Alexis Polidoro. The book is published with support of an Open Educational Resources grant from MacPherson Institute, McMaster University." />
<meta name="twitter:image" content="/images/cover.jpg" />
<meta name="author" content="Antonio Paez" />
<meta name="date" content="2021-12-14" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="prev" href="activity-14-area-data-vi.html"/>
<link rel="next" href="activity-15-spatially-continuous-data-i.html"/>
<script src="libs/header-attrs-2.11/header-attrs.js"></script>
<script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.6/dist/fuse.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" />
<link href="libs/anchor-sections-1.0.1/anchor-sections.css" rel="stylesheet" />
<script src="libs/anchor-sections-1.0.1/anchor-sections.js"></script>
<script src="libs/htmlwidgets-1.5.4/htmlwidgets.js"></script>
<link href="libs/leaflet-1.3.1/leaflet.css" rel="stylesheet" />
<script src="libs/leaflet-1.3.1/leaflet.js"></script>
<link href="libs/leafletfix-1.0.0/leafletfix.css" rel="stylesheet" />
<script src="libs/proj4-2.6.2/proj4.min.js"></script>
<script src="libs/Proj4Leaflet-1.0.1/proj4leaflet.js"></script>
<link href="libs/rstudio_leaflet-1.3.1/rstudio_leaflet.css" rel="stylesheet" />
<script src="libs/leaflet-binding-2.0.4.1/leaflet.js"></script>
<link href="libs/leaflet-markercluster-1.0.5/MarkerCluster.css" rel="stylesheet" />
<link href="libs/leaflet-markercluster-1.0.5/MarkerCluster.Default.css" rel="stylesheet" />
<script src="libs/leaflet-markercluster-1.0.5/leaflet.markercluster.js"></script>
<script src="libs/leaflet-markercluster-1.0.5/leaflet.markercluster.freezable.js"></script>
<script src="libs/leaflet-markercluster-1.0.5/leaflet.markercluster.layersupport.js"></script>
<script src="libs/lfx-heat-0.1.0/lfx-heat-prod.js"></script>
<script src="libs/lfx-heat-0.1.0/lfx-heat-bindings.js"></script>
<script src="libs/plotly-binding-4.10.0/plotly.js"></script>
<script src="libs/typedarray-0.1/typedarray.min.js"></script>
<link href="libs/crosstalk-1.2.0/css/crosstalk.min.css" rel="stylesheet" />
<script src="libs/crosstalk-1.2.0/js/crosstalk.min.js"></script>
<link href="libs/plotly-htmlwidgets-css-2.5.1/plotly-htmlwidgets.css" rel="stylesheet" />
<script src="libs/plotly-main-2.5.1/plotly-latest.min.js"></script>
<link href="libs/colourpicker-1.1/colourpicker.min.css" rel="stylesheet" />
<script src="libs/colourpicker-1.1/colourpicker.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="libs/bootstrap-grid-3.4.1/bootstrap-grid.min.css" rel="stylesheet" />
<script src="libs/kePrint-0.0.1/kePrint.js"></script>
<link href="libs/lightable-0.0.1/lightable.css" rel="stylesheet" />
<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<style type="text/css">
/* Used with Pandoc 2.11+ new --citeproc when CSL is used */
div.csl-bib-body { }
div.csl-entry {
clear: both;
}
.hanging div.csl-entry {
margin-left:2em;
text-indent:-2em;
}
div.csl-left-margin {
min-width:2em;
float:left;
}
div.csl-right-inline {
margin-left:2em;
padding-left:1em;
}
div.csl-indent {
margin-left: 2em;
}
</style>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">
<div class="book-summary">
<nav role="navigation">
<ul class="summary">
<li><a href="./">Spatial Analysis in R</a></li>
<li class="divider"></li>
<li><a href="index.html#section"></a></li>
<li class="chapter" data-level="" data-path="front-matter.html"><a href="front-matter.html"><i class="fa fa-check"></i>Front Matter</a>
<ul>
<li class="chapter" data-level="" data-path="front-matter.html"><a href="front-matter.html#what-is-this-book-and-who-is-it-for"><i class="fa fa-check"></i>What is this book and who is it for?</a></li>
<li class="chapter" data-level="" data-path="front-matter.html"><a href="front-matter.html#allied-resources"><i class="fa fa-check"></i>Allied resources</a></li>
<li class="chapter" data-level="" data-path="front-matter.html"><a href="front-matter.html#contributing"><i class="fa fa-check"></i>Contributing</a>
<ul>
<li class="chapter" data-level="0.0.1" data-path="front-matter.html"><a href="front-matter.html#license"><i class="fa fa-check"></i><b>0.0.1</b> License</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="front-matter.html"><a href="front-matter.html#how-to-support-this-project"><i class="fa fa-check"></i>How to support this project</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="preface.html"><a href="preface.html"><i class="fa fa-check"></i>Preface</a>
<ul>
<li class="chapter" data-level="" data-path="preface.html"><a href="preface.html#spatial-analysis-and-spatial-statistics"><i class="fa fa-check"></i>Spatial Analysis and Spatial Statistics</a></li>
<li class="chapter" data-level="" data-path="preface.html"><a href="preface.html#why-this-text"><i class="fa fa-check"></i>Why this Text?</a></li>
<li class="chapter" data-level="" data-path="preface.html"><a href="preface.html#plan"><i class="fa fa-check"></i>Plan</a></li>
<li class="chapter" data-level="" data-path="preface.html"><a href="preface.html#audience"><i class="fa fa-check"></i>Audience</a></li>
<li class="chapter" data-level="" data-path="preface.html"><a href="preface.html#requisites"><i class="fa fa-check"></i>Requisites</a></li>
<li class="chapter" data-level="" data-path="preface.html"><a href="preface.html#words-of-appreciation"><i class="fa fa-check"></i>Words of Appreciation</a></li>
<li class="chapter" data-level="" data-path="preface.html"><a href="preface.html#versioning"><i class="fa fa-check"></i>Versioning</a></li>
</ul></li>
<li class="part"><span><b>I Part I: Getting to Know the Technology</b></span></li>
<li class="chapter" data-level="1" data-path="preliminaries-installing-r-and-rstudio.html"><a href="preliminaries-installing-r-and-rstudio.html"><i class="fa fa-check"></i><b>1</b> Preliminaries: Installing <code>R</code> and RStudio</a>
<ul>
<li class="chapter" data-level="1.1" data-path="preliminaries-installing-r-and-rstudio.html"><a href="preliminaries-installing-r-and-rstudio.html#introduction"><i class="fa fa-check"></i><b>1.1</b> Introduction</a></li>
<li class="chapter" data-level="1.2" data-path="preliminaries-installing-r-and-rstudio.html"><a href="preliminaries-installing-r-and-rstudio.html#learning-objectives"><i class="fa fa-check"></i><b>1.2</b> Learning Objectives</a></li>
<li class="chapter" data-level="1.3" data-path="preliminaries-installing-r-and-rstudio.html"><a href="preliminaries-installing-r-and-rstudio.html#r-the-open-statistical-computing-project"><i class="fa fa-check"></i><b>1.3</b> <code>R</code>: The Open Statistical Computing Project</a>
<ul>
<li class="chapter" data-level="1.3.1" data-path="preliminaries-installing-r-and-rstudio.html"><a href="preliminaries-installing-r-and-rstudio.html#what-is-r"><i class="fa fa-check"></i><b>1.3.1</b> What is <code>R</code>?</a></li>
<li class="chapter" data-level="1.3.2" data-path="preliminaries-installing-r-and-rstudio.html"><a href="preliminaries-installing-r-and-rstudio.html#the-rstudio-ide"><i class="fa fa-check"></i><b>1.3.2</b> The RStudio IDE</a></li>
</ul></li>
<li class="chapter" data-level="1.4" data-path="preliminaries-installing-r-and-rstudio.html"><a href="preliminaries-installing-r-and-rstudio.html#packages-in-r"><i class="fa fa-check"></i><b>1.4</b> Packages in R</a></li>
</ul></li>
<li class="chapter" data-level="2" data-path="basic-operations-and-data-structures-in-r.html"><a href="basic-operations-and-data-structures-in-r.html"><i class="fa fa-check"></i><b>2</b> Basic Operations and Data Structures in <code>R</code></a>
<ul>
<li class="chapter" data-level="2.1" data-path="basic-operations-and-data-structures-in-r.html"><a href="basic-operations-and-data-structures-in-r.html#learning-objectives-1"><i class="fa fa-check"></i><b>2.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="2.2" data-path="basic-operations-and-data-structures-in-r.html"><a href="basic-operations-and-data-structures-in-r.html#rstudio-ide"><i class="fa fa-check"></i><b>2.2</b> RStudio IDE</a></li>
<li class="chapter" data-level="2.3" data-path="basic-operations-and-data-structures-in-r.html"><a href="basic-operations-and-data-structures-in-r.html#some-basic-operations"><i class="fa fa-check"></i><b>2.3</b> Some Basic Operations</a></li>
<li class="chapter" data-level="2.4" data-path="basic-operations-and-data-structures-in-r.html"><a href="basic-operations-and-data-structures-in-r.html#data-classes-in-r"><i class="fa fa-check"></i><b>2.4</b> Data Classes in R</a></li>
<li class="chapter" data-level="2.5" data-path="basic-operations-and-data-structures-in-r.html"><a href="basic-operations-and-data-structures-in-r.html#data-types-in-r"><i class="fa fa-check"></i><b>2.5</b> Data Types in R</a></li>
<li class="chapter" data-level="2.6" data-path="basic-operations-and-data-structures-in-r.html"><a href="basic-operations-and-data-structures-in-r.html#indexing-and-data-transformations"><i class="fa fa-check"></i><b>2.6</b> Indexing and Data Transformations</a></li>
<li class="chapter" data-level="2.7" data-path="basic-operations-and-data-structures-in-r.html"><a href="basic-operations-and-data-structures-in-r.html#visualization"><i class="fa fa-check"></i><b>2.7</b> Visualization</a></li>
<li class="chapter" data-level="2.8" data-path="basic-operations-and-data-structures-in-r.html"><a href="basic-operations-and-data-structures-in-r.html#creating-a-simple-map"><i class="fa fa-check"></i><b>2.8</b> Creating a Simple Map</a></li>
<li class="chapter" data-level="2.9" data-path="basic-operations-and-data-structures-in-r.html"><a href="basic-operations-and-data-structures-in-r.html#references"><i class="fa fa-check"></i><b>2.9</b> References</a></li>
</ul></li>
<li class="part"><span><b>II Part II: Statistics and Maps</b></span></li>
<li class="chapter" data-level="3" data-path="introduction-to-mapping-in-r.html"><a href="introduction-to-mapping-in-r.html"><i class="fa fa-check"></i><b>3</b> Introduction to Mapping in <code>R</code></a>
<ul>
<li class="chapter" data-level="3.1" data-path="introduction-to-mapping-in-r.html"><a href="introduction-to-mapping-in-r.html#learning-objectives-2"><i class="fa fa-check"></i><b>3.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="3.2" data-path="introduction-to-mapping-in-r.html"><a href="introduction-to-mapping-in-r.html#suggested-readings"><i class="fa fa-check"></i><b>3.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="3.3" data-path="introduction-to-mapping-in-r.html"><a href="introduction-to-mapping-in-r.html#preliminaries"><i class="fa fa-check"></i><b>3.3</b> Preliminaries</a></li>
<li class="chapter" data-level="3.4" data-path="introduction-to-mapping-in-r.html"><a href="introduction-to-mapping-in-r.html#packages"><i class="fa fa-check"></i><b>3.4</b> Packages</a></li>
<li class="chapter" data-level="3.5" data-path="introduction-to-mapping-in-r.html"><a href="introduction-to-mapping-in-r.html#exploring-dataframes-and-a-simple-proportional-symbols-map"><i class="fa fa-check"></i><b>3.5</b> Exploring Dataframes and a Simple Proportional Symbols Map</a></li>
<li class="chapter" data-level="3.6" data-path="introduction-to-mapping-in-r.html"><a href="introduction-to-mapping-in-r.html#improving-on-the-proportional-symbols-map"><i class="fa fa-check"></i><b>3.6</b> Improving on the Proportional Symbols Map</a></li>
<li class="chapter" data-level="3.7" data-path="introduction-to-mapping-in-r.html"><a href="introduction-to-mapping-in-r.html#some-simple-spatial-analysis"><i class="fa fa-check"></i><b>3.7</b> Some Simple Spatial Analysis</a></li>
<li class="chapter" data-level="3.8" data-path="introduction-to-mapping-in-r.html"><a href="introduction-to-mapping-in-r.html#other-resources"><i class="fa fa-check"></i><b>3.8</b> Other Resources</a></li>
</ul></li>
<li class="chapter" data-level="4" data-path="activity-1-statistical-maps-i.html"><a href="activity-1-statistical-maps-i.html"><i class="fa fa-check"></i><b>4</b> Activity 1: Statistical Maps I</a>
<ul>
<li class="chapter" data-level="4.1" data-path="activity-1-statistical-maps-i.html"><a href="activity-1-statistical-maps-i.html#housekeeping-questions"><i class="fa fa-check"></i><b>4.1</b> Housekeeping Questions</a></li>
<li class="chapter" data-level="4.2" data-path="activity-1-statistical-maps-i.html"><a href="activity-1-statistical-maps-i.html#learning-objectives-3"><i class="fa fa-check"></i><b>4.2</b> Learning Objectives</a></li>
<li class="chapter" data-level="4.3" data-path="activity-1-statistical-maps-i.html"><a href="activity-1-statistical-maps-i.html#preliminaries-1"><i class="fa fa-check"></i><b>4.3</b> Preliminaries</a></li>
<li class="chapter" data-level="4.4" data-path="activity-1-statistical-maps-i.html"><a href="activity-1-statistical-maps-i.html#creating-a-simple-thematic-map"><i class="fa fa-check"></i><b>4.4</b> Creating a simple thematic map</a></li>
<li class="chapter" data-level="4.5" data-path="activity-1-statistical-maps-i.html"><a href="activity-1-statistical-maps-i.html#activity"><i class="fa fa-check"></i><b>4.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="5" data-path="mapping-in-r-continued.html"><a href="mapping-in-r-continued.html"><i class="fa fa-check"></i><b>5</b> Mapping in R: Continued</a>
<ul>
<li class="chapter" data-level="5.1" data-path="mapping-in-r-continued.html"><a href="mapping-in-r-continued.html#learning-objectives-4"><i class="fa fa-check"></i><b>5.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="5.2" data-path="mapping-in-r-continued.html"><a href="mapping-in-r-continued.html#suggested-readings-1"><i class="fa fa-check"></i><b>5.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="5.3" data-path="mapping-in-r-continued.html"><a href="mapping-in-r-continued.html#preliminaries-2"><i class="fa fa-check"></i><b>5.3</b> Preliminaries</a></li>
<li class="chapter" data-level="5.4" data-path="mapping-in-r-continued.html"><a href="mapping-in-r-continued.html#summarizing-a-dataframe"><i class="fa fa-check"></i><b>5.4</b> Summarizing a Dataframe</a></li>
<li class="chapter" data-level="5.5" data-path="mapping-in-r-continued.html"><a href="mapping-in-r-continued.html#factors"><i class="fa fa-check"></i><b>5.5</b> Factors</a></li>
<li class="chapter" data-level="5.6" data-path="mapping-in-r-continued.html"><a href="mapping-in-r-continued.html#subsetting-data"><i class="fa fa-check"></i><b>5.6</b> Subsetting Data</a></li>
<li class="chapter" data-level="5.7" data-path="mapping-in-r-continued.html"><a href="mapping-in-r-continued.html#pipe-operator"><i class="fa fa-check"></i><b>5.7</b> Pipe Operator</a></li>
<li class="chapter" data-level="5.8" data-path="mapping-in-r-continued.html"><a href="mapping-in-r-continued.html#more-on-visualization"><i class="fa fa-check"></i><b>5.8</b> More on Visualization</a></li>
</ul></li>
<li class="chapter" data-level="6" data-path="activity-2-statistical-maps-ii.html"><a href="activity-2-statistical-maps-ii.html"><i class="fa fa-check"></i><b>6</b> Activity 2: Statistical Maps II</a>
<ul>
<li class="chapter" data-level="6.1" data-path="activity-2-statistical-maps-ii.html"><a href="activity-2-statistical-maps-ii.html#housekeeping-questions-1"><i class="fa fa-check"></i><b>6.1</b> Housekeeping Questions</a></li>
<li class="chapter" data-level="6.2" data-path="activity-2-statistical-maps-ii.html"><a href="activity-2-statistical-maps-ii.html#learning-objectives-5"><i class="fa fa-check"></i><b>6.2</b> Learning objectives</a></li>
<li class="chapter" data-level="6.3" data-path="activity-2-statistical-maps-ii.html"><a href="activity-2-statistical-maps-ii.html#suggested-reading"><i class="fa fa-check"></i><b>6.3</b> Suggested reading</a></li>
<li class="chapter" data-level="6.4" data-path="activity-2-statistical-maps-ii.html"><a href="activity-2-statistical-maps-ii.html#preliminaries-3"><i class="fa fa-check"></i><b>6.4</b> Preliminaries</a></li>
<li class="chapter" data-level="6.5" data-path="activity-2-statistical-maps-ii.html"><a href="activity-2-statistical-maps-ii.html#activity-1"><i class="fa fa-check"></i><b>6.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="7" data-path="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html"><a href="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html"><i class="fa fa-check"></i><b>7</b> Maps as Processes: Null Landscapes, Spatial Processes, and Statistical Maps</a>
<ul>
<li class="chapter" data-level="7.1" data-path="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html"><a href="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html#learning-objectives-6"><i class="fa fa-check"></i><b>7.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="7.2" data-path="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html"><a href="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html#suggested-readings-2"><i class="fa fa-check"></i><b>7.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="7.3" data-path="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html"><a href="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html#preliminaries-4"><i class="fa fa-check"></i><b>7.3</b> Preliminaries</a></li>
<li class="chapter" data-level="7.4" data-path="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html"><a href="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html#random-numbers"><i class="fa fa-check"></i><b>7.4</b> Random Numbers</a></li>
<li class="chapter" data-level="7.5" data-path="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html"><a href="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html#null-landscapes"><i class="fa fa-check"></i><b>7.5</b> Null Landscapes</a></li>
<li class="chapter" data-level="7.6" data-path="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html"><a href="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html#stochastic-processes"><i class="fa fa-check"></i><b>7.6</b> Stochastic Processes</a></li>
<li class="chapter" data-level="7.7" data-path="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html"><a href="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html#simulating-spatial-processes"><i class="fa fa-check"></i><b>7.7</b> Simulating Spatial Processes</a></li>
<li class="chapter" data-level="7.8" data-path="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html"><a href="maps-as-processes-null-landscapes-spatial-processes-and-statistical-maps.html#processes-and-patterns"><i class="fa fa-check"></i><b>7.8</b> Processes and Patterns</a></li>
</ul></li>
<li class="chapter" data-level="8" data-path="activity-3-maps-as-processes.html"><a href="activity-3-maps-as-processes.html"><i class="fa fa-check"></i><b>8</b> Activity 3: Maps as Processes</a>
<ul>
<li class="chapter" data-level="8.1" data-path="activity-3-maps-as-processes.html"><a href="activity-3-maps-as-processes.html#practice-questions"><i class="fa fa-check"></i><b>8.1</b> Practice Questions</a></li>
<li class="chapter" data-level="8.2" data-path="activity-3-maps-as-processes.html"><a href="activity-3-maps-as-processes.html#learning-objectives-7"><i class="fa fa-check"></i><b>8.2</b> Learning Objectives</a></li>
<li class="chapter" data-level="8.3" data-path="activity-3-maps-as-processes.html"><a href="activity-3-maps-as-processes.html#suggested-reading-1"><i class="fa fa-check"></i><b>8.3</b> Suggested Reading</a></li>
<li class="chapter" data-level="8.4" data-path="activity-3-maps-as-processes.html"><a href="activity-3-maps-as-processes.html#preliminaries-5"><i class="fa fa-check"></i><b>8.4</b> Preliminaries</a></li>
<li class="chapter" data-level="8.5" data-path="activity-3-maps-as-processes.html"><a href="activity-3-maps-as-processes.html#activity-2"><i class="fa fa-check"></i><b>8.5</b> Activity</a></li>
</ul></li>
<li class="part"><span><b>III Part III: Analysis of Point Patterns</b></span></li>
<li class="chapter" data-level="9" data-path="point-pattern-analysis-i.html"><a href="point-pattern-analysis-i.html"><i class="fa fa-check"></i><b>9</b> Point Pattern Analysis I</a>
<ul>
<li class="chapter" data-level="9.1" data-path="point-pattern-analysis-i.html"><a href="point-pattern-analysis-i.html#learning-objectives-8"><i class="fa fa-check"></i><b>9.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="9.2" data-path="point-pattern-analysis-i.html"><a href="point-pattern-analysis-i.html#suggested-readings-3"><i class="fa fa-check"></i><b>9.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="9.3" data-path="point-pattern-analysis-i.html"><a href="point-pattern-analysis-i.html#preliminaries-6"><i class="fa fa-check"></i><b>9.3</b> Preliminaries</a></li>
<li class="chapter" data-level="9.4" data-path="point-pattern-analysis-i.html"><a href="point-pattern-analysis-i.html#point-patterns"><i class="fa fa-check"></i><b>9.4</b> Point Patterns</a></li>
<li class="chapter" data-level="9.5" data-path="point-pattern-analysis-i.html"><a href="point-pattern-analysis-i.html#processes-and-point-patterns"><i class="fa fa-check"></i><b>9.5</b> Processes and Point Patterns</a></li>
<li class="chapter" data-level="9.6" data-path="point-pattern-analysis-i.html"><a href="point-pattern-analysis-i.html#intensity-and-density"><i class="fa fa-check"></i><b>9.6</b> Intensity and Density</a></li>
<li class="chapter" data-level="9.7" data-path="point-pattern-analysis-i.html"><a href="point-pattern-analysis-i.html#quadrats-and-density-maps"><i class="fa fa-check"></i><b>9.7</b> Quadrats and Density Maps</a></li>
<li class="chapter" data-level="9.8" data-path="point-pattern-analysis-i.html"><a href="point-pattern-analysis-i.html#defining-the-region-for-analysis"><i class="fa fa-check"></i><b>9.8</b> Defining the Region for Analysis</a></li>
</ul></li>
<li class="chapter" data-level="10" data-path="activity-4-point-pattern-analysis-i.html"><a href="activity-4-point-pattern-analysis-i.html"><i class="fa fa-check"></i><b>10</b> Activity 4: Point Pattern Analysis I</a>
<ul>
<li class="chapter" data-level="10.1" data-path="activity-4-point-pattern-analysis-i.html"><a href="activity-4-point-pattern-analysis-i.html#practice-questions-1"><i class="fa fa-check"></i><b>10.1</b> Practice questions</a></li>
<li class="chapter" data-level="10.2" data-path="activity-4-point-pattern-analysis-i.html"><a href="activity-4-point-pattern-analysis-i.html#learning-objectives-9"><i class="fa fa-check"></i><b>10.2</b> Learning objectives</a></li>
<li class="chapter" data-level="10.3" data-path="activity-4-point-pattern-analysis-i.html"><a href="activity-4-point-pattern-analysis-i.html#suggested-reading-2"><i class="fa fa-check"></i><b>10.3</b> Suggested reading</a></li>
<li class="chapter" data-level="10.4" data-path="activity-4-point-pattern-analysis-i.html"><a href="activity-4-point-pattern-analysis-i.html#preliminaries-7"><i class="fa fa-check"></i><b>10.4</b> Preliminaries</a></li>
<li class="chapter" data-level="10.5" data-path="activity-4-point-pattern-analysis-i.html"><a href="activity-4-point-pattern-analysis-i.html#activity-3"><i class="fa fa-check"></i><b>10.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="11" data-path="point-pattern-analysis-ii.html"><a href="point-pattern-analysis-ii.html"><i class="fa fa-check"></i><b>11</b> Point Pattern Analysis II</a>
<ul>
<li class="chapter" data-level="11.1" data-path="point-pattern-analysis-ii.html"><a href="point-pattern-analysis-ii.html#learning-objectives-10"><i class="fa fa-check"></i><b>11.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="11.2" data-path="point-pattern-analysis-ii.html"><a href="point-pattern-analysis-ii.html#suggested-readings-4"><i class="fa fa-check"></i><b>11.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="11.3" data-path="point-pattern-analysis-ii.html"><a href="point-pattern-analysis-ii.html#preliminaries-8"><i class="fa fa-check"></i><b>11.3</b> Preliminaries</a></li>
<li class="chapter" data-level="11.4" data-path="point-pattern-analysis-ii.html"><a href="point-pattern-analysis-ii.html#a-quadrat-based-test-for-spatial-independence"><i class="fa fa-check"></i><b>11.4</b> A Quadrat-based Test for Spatial Independence</a></li>
<li class="chapter" data-level="11.5" data-path="point-pattern-analysis-ii.html"><a href="point-pattern-analysis-ii.html#limitations-of-quadrat-analysis-size-and-number-of-quadrats"><i class="fa fa-check"></i><b>11.5</b> Limitations of Quadrat Analysis: Size and Number of Quadrats</a></li>
<li class="chapter" data-level="11.6" data-path="point-pattern-analysis-ii.html"><a href="point-pattern-analysis-ii.html#limitations-of-quadrat-analysis-relative-position-of-events"><i class="fa fa-check"></i><b>11.6</b> Limitations of Quadrat Analysis: Relative Position of Events</a></li>
<li class="chapter" data-level="11.7" data-path="point-pattern-analysis-ii.html"><a href="point-pattern-analysis-ii.html#kernel-density"><i class="fa fa-check"></i><b>11.7</b> Kernel Density</a></li>
</ul></li>
<li class="chapter" data-level="12" data-path="activity-5-point-pattern-analysis-ii.html"><a href="activity-5-point-pattern-analysis-ii.html"><i class="fa fa-check"></i><b>12</b> Activity 5: Point Pattern Analysis II</a>
<ul>
<li class="chapter" data-level="12.1" data-path="activity-5-point-pattern-analysis-ii.html"><a href="activity-5-point-pattern-analysis-ii.html#practice-questions-2"><i class="fa fa-check"></i><b>12.1</b> Practice questions</a></li>
<li class="chapter" data-level="12.2" data-path="activity-5-point-pattern-analysis-ii.html"><a href="activity-5-point-pattern-analysis-ii.html#learning-objectives-11"><i class="fa fa-check"></i><b>12.2</b> Learning objectives</a></li>
<li class="chapter" data-level="12.3" data-path="activity-5-point-pattern-analysis-ii.html"><a href="activity-5-point-pattern-analysis-ii.html#suggested-reading-3"><i class="fa fa-check"></i><b>12.3</b> Suggested reading</a></li>
<li class="chapter" data-level="12.4" data-path="activity-5-point-pattern-analysis-ii.html"><a href="activity-5-point-pattern-analysis-ii.html#preliminaries-9"><i class="fa fa-check"></i><b>12.4</b> Preliminaries</a></li>
<li class="chapter" data-level="12.5" data-path="activity-5-point-pattern-analysis-ii.html"><a href="activity-5-point-pattern-analysis-ii.html#activity-4"><i class="fa fa-check"></i><b>12.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="13" data-path="point-pattern-analysis-iii.html"><a href="point-pattern-analysis-iii.html"><i class="fa fa-check"></i><b>13</b> Point Pattern Analysis III</a>
<ul>
<li class="chapter" data-level="13.1" data-path="point-pattern-analysis-iii.html"><a href="point-pattern-analysis-iii.html#learning-objectives-12"><i class="fa fa-check"></i><b>13.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="13.2" data-path="point-pattern-analysis-iii.html"><a href="point-pattern-analysis-iii.html#suggested-readings-5"><i class="fa fa-check"></i><b>13.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="13.3" data-path="point-pattern-analysis-iii.html"><a href="point-pattern-analysis-iii.html#preliminaries-10"><i class="fa fa-check"></i><b>13.3</b> Preliminaries</a></li>
<li class="chapter" data-level="13.4" data-path="point-pattern-analysis-iii.html"><a href="point-pattern-analysis-iii.html#motivation"><i class="fa fa-check"></i><b>13.4</b> Motivation</a></li>
<li class="chapter" data-level="13.5" data-path="point-pattern-analysis-iii.html"><a href="point-pattern-analysis-iii.html#nearest-neighbors"><i class="fa fa-check"></i><b>13.5</b> Nearest Neighbors</a></li>
<li class="chapter" data-level="13.6" data-path="point-pattern-analysis-iii.html"><a href="point-pattern-analysis-iii.html#g-function"><i class="fa fa-check"></i><b>13.6</b> <span class="math inline">\(G\)</span>-function</a></li>
</ul></li>
<li class="chapter" data-level="14" data-path="activity-6-point-pattern-analysis-iii.html"><a href="activity-6-point-pattern-analysis-iii.html"><i class="fa fa-check"></i><b>14</b> Activity 6: Point Pattern Analysis III</a>
<ul>
<li class="chapter" data-level="14.1" data-path="activity-6-point-pattern-analysis-iii.html"><a href="activity-6-point-pattern-analysis-iii.html#practice-questions-3"><i class="fa fa-check"></i><b>14.1</b> Practice questions</a></li>
<li class="chapter" data-level="14.2" data-path="activity-6-point-pattern-analysis-iii.html"><a href="activity-6-point-pattern-analysis-iii.html#learning-objectives-13"><i class="fa fa-check"></i><b>14.2</b> Learning objectives</a></li>
<li class="chapter" data-level="14.3" data-path="activity-6-point-pattern-analysis-iii.html"><a href="activity-6-point-pattern-analysis-iii.html#suggested-reading-4"><i class="fa fa-check"></i><b>14.3</b> Suggested reading</a></li>
<li class="chapter" data-level="14.4" data-path="activity-6-point-pattern-analysis-iii.html"><a href="activity-6-point-pattern-analysis-iii.html#preliminaries-11"><i class="fa fa-check"></i><b>14.4</b> Preliminaries</a></li>
<li class="chapter" data-level="14.5" data-path="activity-6-point-pattern-analysis-iii.html"><a href="activity-6-point-pattern-analysis-iii.html#activity-5"><i class="fa fa-check"></i><b>14.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="15" data-path="point-pattern-analysis-iv.html"><a href="point-pattern-analysis-iv.html"><i class="fa fa-check"></i><b>15</b> Point Pattern Analysis IV</a>
<ul>
<li class="chapter" data-level="15.1" data-path="point-pattern-analysis-iv.html"><a href="point-pattern-analysis-iv.html#learning-objectives-14"><i class="fa fa-check"></i><b>15.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="15.2" data-path="point-pattern-analysis-iv.html"><a href="point-pattern-analysis-iv.html#suggested-readings-6"><i class="fa fa-check"></i><b>15.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="15.3" data-path="point-pattern-analysis-iv.html"><a href="point-pattern-analysis-iv.html#preliminaries-12"><i class="fa fa-check"></i><b>15.3</b> Preliminaries</a></li>
<li class="chapter" data-level="15.4" data-path="point-pattern-analysis-iv.html"><a href="point-pattern-analysis-iv.html#motivation-1"><i class="fa fa-check"></i><b>15.4</b> Motivation</a></li>
<li class="chapter" data-level="15.5" data-path="point-pattern-analysis-iv.html"><a href="point-pattern-analysis-iv.html#f-function"><i class="fa fa-check"></i><b>15.5</b> F-function</a></li>
<li class="chapter" data-level="15.6" data-path="point-pattern-analysis-iv.html"><a href="point-pattern-analysis-iv.html#hatk-function"><i class="fa fa-check"></i><b>15.6</b> <span class="math inline">\(\hat{K}\)</span>-function</a></li>
</ul></li>
<li class="chapter" data-level="16" data-path="activity-7-point-pattern-analysis-iv.html"><a href="activity-7-point-pattern-analysis-iv.html"><i class="fa fa-check"></i><b>16</b> Activity 7: Point Pattern Analysis IV</a>
<ul>
<li class="chapter" data-level="16.1" data-path="activity-7-point-pattern-analysis-iv.html"><a href="activity-7-point-pattern-analysis-iv.html#practice-questions-4"><i class="fa fa-check"></i><b>16.1</b> Practice questions</a></li>
<li class="chapter" data-level="16.2" data-path="activity-7-point-pattern-analysis-iv.html"><a href="activity-7-point-pattern-analysis-iv.html#learning-objectives-15"><i class="fa fa-check"></i><b>16.2</b> Learning objectives</a></li>
<li class="chapter" data-level="16.3" data-path="activity-7-point-pattern-analysis-iv.html"><a href="activity-7-point-pattern-analysis-iv.html#suggested-reading-5"><i class="fa fa-check"></i><b>16.3</b> Suggested reading</a></li>
<li class="chapter" data-level="16.4" data-path="activity-7-point-pattern-analysis-iv.html"><a href="activity-7-point-pattern-analysis-iv.html#preliminaries-13"><i class="fa fa-check"></i><b>16.4</b> Preliminaries</a></li>
<li class="chapter" data-level="16.5" data-path="activity-7-point-pattern-analysis-iv.html"><a href="activity-7-point-pattern-analysis-iv.html#activity-6"><i class="fa fa-check"></i><b>16.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="17" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html"><i class="fa fa-check"></i><b>17</b> Point Pattern Analysis V</a>
<ul>
<li class="chapter" data-level="17.1" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html#learning-objectives-16"><i class="fa fa-check"></i><b>17.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="17.2" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html#suggested-readings-7"><i class="fa fa-check"></i><b>17.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="17.3" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html#preliminaries-14"><i class="fa fa-check"></i><b>17.3</b> Preliminaries</a></li>
<li class="chapter" data-level="17.4" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html#motivation-hypothesis-testing"><i class="fa fa-check"></i><b>17.4</b> Motivation: Hypothesis Testing</a></li>
<li class="chapter" data-level="17.5" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html#null-landscapes-revisited"><i class="fa fa-check"></i><b>17.5</b> Null Landscapes Revisited</a></li>
<li class="chapter" data-level="17.6" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html#simulation-envelopes"><i class="fa fa-check"></i><b>17.6</b> Simulation Envelopes</a></li>
<li class="chapter" data-level="17.7" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html#things-to-keep-in-mind"><i class="fa fa-check"></i><b>17.7</b> Things to Keep in Mind!</a>
<ul>
<li class="chapter" data-level="17.7.1" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html#definition-of-a-region"><i class="fa fa-check"></i><b>17.7.1</b> Definition of a Region</a></li>
<li class="chapter" data-level="17.7.2" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html#edge-effects"><i class="fa fa-check"></i><b>17.7.2</b> Edge Effects</a></li>
<li class="chapter" data-level="17.7.3" data-path="point-pattern-analysis-v.html"><a href="point-pattern-analysis-v.html#sampled-point-patterns"><i class="fa fa-check"></i><b>17.7.3</b> Sampled Point Patterns</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="18" data-path="activity-8-point-pattern-analysis-v.html"><a href="activity-8-point-pattern-analysis-v.html"><i class="fa fa-check"></i><b>18</b> Activity 8: Point Pattern Analysis V</a>
<ul>
<li class="chapter" data-level="18.1" data-path="activity-8-point-pattern-analysis-v.html"><a href="activity-8-point-pattern-analysis-v.html#practice-questions-5"><i class="fa fa-check"></i><b>18.1</b> Practice questions</a></li>
<li class="chapter" data-level="18.2" data-path="activity-8-point-pattern-analysis-v.html"><a href="activity-8-point-pattern-analysis-v.html#learning-objectives-17"><i class="fa fa-check"></i><b>18.2</b> Learning objectives</a></li>
<li class="chapter" data-level="18.3" data-path="activity-8-point-pattern-analysis-v.html"><a href="activity-8-point-pattern-analysis-v.html#suggested-reading-6"><i class="fa fa-check"></i><b>18.3</b> Suggested reading</a></li>
<li class="chapter" data-level="18.4" data-path="activity-8-point-pattern-analysis-v.html"><a href="activity-8-point-pattern-analysis-v.html#preliminaries-15"><i class="fa fa-check"></i><b>18.4</b> Preliminaries</a></li>
<li class="chapter" data-level="18.5" data-path="activity-8-point-pattern-analysis-v.html"><a href="activity-8-point-pattern-analysis-v.html#activity-7"><i class="fa fa-check"></i><b>18.5</b> Activity</a></li>
</ul></li>
<li class="part"><span><b>IV Part IV: Data in Areal Units</b></span></li>
<li class="chapter" data-level="19" data-path="area-data-i.html"><a href="area-data-i.html"><i class="fa fa-check"></i><b>19</b> Area Data I</a>
<ul>
<li class="chapter" data-level="19.1" data-path="area-data-i.html"><a href="area-data-i.html#learning-objectives-18"><i class="fa fa-check"></i><b>19.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="19.2" data-path="area-data-i.html"><a href="area-data-i.html#suggested-readings-8"><i class="fa fa-check"></i><b>19.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="19.3" data-path="area-data-i.html"><a href="area-data-i.html#preliminaries-16"><i class="fa fa-check"></i><b>19.3</b> Preliminaries</a></li>
<li class="chapter" data-level="19.4" data-path="area-data-i.html"><a href="area-data-i.html#area-data"><i class="fa fa-check"></i><b>19.4</b> Area Data</a></li>
<li class="chapter" data-level="19.5" data-path="area-data-i.html"><a href="area-data-i.html#processes-and-area-data"><i class="fa fa-check"></i><b>19.5</b> Processes and Area Data</a></li>
<li class="chapter" data-level="19.6" data-path="area-data-i.html"><a href="area-data-i.html#visualizing-area-data-choropleth-maps"><i class="fa fa-check"></i><b>19.6</b> Visualizing Area Data: Choropleth Maps</a></li>
<li class="chapter" data-level="19.7" data-path="area-data-i.html"><a href="area-data-i.html#visualizing-area-data-cartograms"><i class="fa fa-check"></i><b>19.7</b> Visualizing Area Data: Cartograms</a></li>
</ul></li>
<li class="chapter" data-level="20" data-path="activity-9-area-data-i.html"><a href="activity-9-area-data-i.html"><i class="fa fa-check"></i><b>20</b> Activity 9: Area Data I</a>
<ul>
<li class="chapter" data-level="20.1" data-path="activity-9-area-data-i.html"><a href="activity-9-area-data-i.html#practice-questions-6"><i class="fa fa-check"></i><b>20.1</b> Practice questions</a></li>
<li class="chapter" data-level="20.2" data-path="activity-9-area-data-i.html"><a href="activity-9-area-data-i.html#learning-objectives-19"><i class="fa fa-check"></i><b>20.2</b> Learning objectives</a></li>
<li class="chapter" data-level="20.3" data-path="activity-9-area-data-i.html"><a href="activity-9-area-data-i.html#suggested-reading-7"><i class="fa fa-check"></i><b>20.3</b> Suggested reading</a></li>
<li class="chapter" data-level="20.4" data-path="activity-9-area-data-i.html"><a href="activity-9-area-data-i.html#preliminaries-17"><i class="fa fa-check"></i><b>20.4</b> Preliminaries</a></li>
<li class="chapter" data-level="20.5" data-path="activity-9-area-data-i.html"><a href="activity-9-area-data-i.html#activity-8"><i class="fa fa-check"></i><b>20.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="21" data-path="area-data-ii.html"><a href="area-data-ii.html"><i class="fa fa-check"></i><b>21</b> Area Data II</a>
<ul>
<li class="chapter" data-level="21.1" data-path="area-data-ii.html"><a href="area-data-ii.html#learning-objectives-20"><i class="fa fa-check"></i><b>21.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="21.2" data-path="area-data-ii.html"><a href="area-data-ii.html#suggested-readings-9"><i class="fa fa-check"></i><b>21.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="21.3" data-path="area-data-ii.html"><a href="area-data-ii.html#preliminaries-18"><i class="fa fa-check"></i><b>21.3</b> Preliminaries</a></li>
<li class="chapter" data-level="21.4" data-path="area-data-ii.html"><a href="area-data-ii.html#proximity-in-area-data"><i class="fa fa-check"></i><b>21.4</b> Proximity in Area Data</a></li>
<li class="chapter" data-level="21.5" data-path="area-data-ii.html"><a href="area-data-ii.html#spatial-weights-matrices"><i class="fa fa-check"></i><b>21.5</b> Spatial Weights Matrices</a></li>
<li class="chapter" data-level="21.6" data-path="area-data-ii.html"><a href="area-data-ii.html#creating-spatial-weights-matrices-in-r"><i class="fa fa-check"></i><b>21.6</b> Creating Spatial Weights Matrices in <code>R</code></a></li>
<li class="chapter" data-level="21.7" data-path="area-data-ii.html"><a href="area-data-ii.html#spatial-moving-averages"><i class="fa fa-check"></i><b>21.7</b> Spatial Moving Averages</a></li>
<li class="chapter" data-level="21.8" data-path="area-data-ii.html"><a href="area-data-ii.html#other-criteria-for-coding-proximity"><i class="fa fa-check"></i><b>21.8</b> Other Criteria for Coding Proximity</a></li>
</ul></li>
<li class="chapter" data-level="22" data-path="activity-10-area-data-ii.html"><a href="activity-10-area-data-ii.html"><i class="fa fa-check"></i><b>22</b> Activity 10: Area Data II</a>
<ul>
<li class="chapter" data-level="22.1" data-path="activity-10-area-data-ii.html"><a href="activity-10-area-data-ii.html#practice-questions-7"><i class="fa fa-check"></i><b>22.1</b> Practice questions</a></li>
<li class="chapter" data-level="22.2" data-path="activity-10-area-data-ii.html"><a href="activity-10-area-data-ii.html#learning-objectives-21"><i class="fa fa-check"></i><b>22.2</b> Learning objectives</a></li>
<li class="chapter" data-level="22.3" data-path="activity-10-area-data-ii.html"><a href="activity-10-area-data-ii.html#suggested-reading-8"><i class="fa fa-check"></i><b>22.3</b> Suggested reading</a></li>
<li class="chapter" data-level="22.4" data-path="activity-10-area-data-ii.html"><a href="activity-10-area-data-ii.html#preliminaries-19"><i class="fa fa-check"></i><b>22.4</b> Preliminaries</a></li>
<li class="chapter" data-level="22.5" data-path="activity-10-area-data-ii.html"><a href="activity-10-area-data-ii.html#activity-9"><i class="fa fa-check"></i><b>22.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="23" data-path="area-data-iii.html"><a href="area-data-iii.html"><i class="fa fa-check"></i><b>23</b> Area Data III</a>
<ul>
<li class="chapter" data-level="23.1" data-path="area-data-iii.html"><a href="area-data-iii.html#learning-objectives-22"><i class="fa fa-check"></i><b>23.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="23.2" data-path="area-data-iii.html"><a href="area-data-iii.html#suggested-readings-10"><i class="fa fa-check"></i><b>23.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="23.3" data-path="area-data-iii.html"><a href="area-data-iii.html#preliminaries-20"><i class="fa fa-check"></i><b>23.3</b> Preliminaries</a></li>
<li class="chapter" data-level="23.4" data-path="area-data-iii.html"><a href="area-data-iii.html#spatial-moving-averages-and-simulation"><i class="fa fa-check"></i><b>23.4</b> Spatial Moving Averages and Simulation</a></li>
<li class="chapter" data-level="23.5" data-path="area-data-iii.html"><a href="area-data-iii.html#the-spatial-moving-average-as-a-smoother"><i class="fa fa-check"></i><b>23.5</b> The Spatial Moving Average as a Smoother</a></li>
<li class="chapter" data-level="23.6" data-path="area-data-iii.html"><a href="area-data-iii.html#spatial-moving-average-scatterplots"><i class="fa fa-check"></i><b>23.6</b> Spatial Moving Average Scatterplots</a></li>
<li class="chapter" data-level="23.7" data-path="area-data-iii.html"><a href="area-data-iii.html#spatial-autocorrelation-and-morans-i-coefficient"><i class="fa fa-check"></i><b>23.7</b> Spatial Autocorrelation and Moran’s <span class="math inline">\(I\)</span> coefficient</a></li>
<li class="chapter" data-level="23.8" data-path="area-data-iii.html"><a href="area-data-iii.html#morans-i-and-morans-scatterplot"><i class="fa fa-check"></i><b>23.8</b> Moran’s <span class="math inline">\(I\)</span> and Moran’s Scatterplot</a></li>
<li class="chapter" data-level="23.9" data-path="area-data-iii.html"><a href="area-data-iii.html#hypothesis-testing-for-spatial-autocorrelation"><i class="fa fa-check"></i><b>23.9</b> Hypothesis Testing for Spatial Autocorrelation</a></li>
</ul></li>
<li class="chapter" data-level="24" data-path="activity-11-area-data-iii.html"><a href="activity-11-area-data-iii.html"><i class="fa fa-check"></i><b>24</b> Activity 11: Area Data III</a>
<ul>
<li class="chapter" data-level="24.1" data-path="activity-11-area-data-iii.html"><a href="activity-11-area-data-iii.html#practice-questions-8"><i class="fa fa-check"></i><b>24.1</b> Practice questions</a></li>
<li class="chapter" data-level="24.2" data-path="activity-11-area-data-iii.html"><a href="activity-11-area-data-iii.html#learning-objectives-23"><i class="fa fa-check"></i><b>24.2</b> Learning objectives</a></li>
<li class="chapter" data-level="24.3" data-path="activity-11-area-data-iii.html"><a href="activity-11-area-data-iii.html#suggested-reading-9"><i class="fa fa-check"></i><b>24.3</b> Suggested reading</a></li>
<li class="chapter" data-level="24.4" data-path="activity-11-area-data-iii.html"><a href="activity-11-area-data-iii.html#preliminaries-21"><i class="fa fa-check"></i><b>24.4</b> Preliminaries</a></li>
<li class="chapter" data-level="24.5" data-path="activity-11-area-data-iii.html"><a href="activity-11-area-data-iii.html#activity-10"><i class="fa fa-check"></i><b>24.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="25" data-path="area-data-iv.html"><a href="area-data-iv.html"><i class="fa fa-check"></i><b>25</b> Area Data IV</a>
<ul>
<li class="chapter" data-level="25.1" data-path="area-data-iv.html"><a href="area-data-iv.html#learning-objectives-24"><i class="fa fa-check"></i><b>25.1</b> Learning objectives</a></li>
<li class="chapter" data-level="25.2" data-path="area-data-iv.html"><a href="area-data-iv.html#suggested-readings-11"><i class="fa fa-check"></i><b>25.2</b> Suggested readings</a></li>
<li class="chapter" data-level="25.3" data-path="area-data-iv.html"><a href="area-data-iv.html#preliminaries-22"><i class="fa fa-check"></i><b>25.3</b> Preliminaries</a></li>
<li class="chapter" data-level="25.4" data-path="area-data-iv.html"><a href="area-data-iv.html#decomposing-morans-i"><i class="fa fa-check"></i><b>25.4</b> Decomposing Moran’s <span class="math inline">\(I\)</span></a></li>
<li class="chapter" data-level="25.5" data-path="area-data-iv.html"><a href="area-data-iv.html#local-morans-i-and-mapping"><i class="fa fa-check"></i><b>25.5</b> Local Moran’s <span class="math inline">\(I\)</span> and Mapping</a></li>
<li class="chapter" data-level="25.6" data-path="area-data-iv.html"><a href="area-data-iv.html#a-quick-note-on-functions"><i class="fa fa-check"></i><b>25.6</b> A Quick Note on Functions</a></li>
<li class="chapter" data-level="25.7" data-path="area-data-iv.html"><a href="area-data-iv.html#a-concentration-approach-for-local-analysis-of-spatial-association"><i class="fa fa-check"></i><b>25.7</b> A Concentration approach for Local Analysis of Spatial Association</a></li>
<li class="chapter" data-level="25.8" data-path="area-data-iv.html"><a href="area-data-iv.html#a-short-note-on-hypothesis-testing"><i class="fa fa-check"></i><b>25.8</b> A Short Note on Hypothesis Testing</a></li>
<li class="chapter" data-level="25.9" data-path="area-data-iv.html"><a href="area-data-iv.html#detection-of-hot-and-cold-spots"><i class="fa fa-check"></i><b>25.9</b> Detection of Hot and Cold Spots</a></li>
<li class="chapter" data-level="25.10" data-path="area-data-iv.html"><a href="area-data-iv.html#other-resources-1"><i class="fa fa-check"></i><b>25.10</b> Other Resources</a></li>
</ul></li>
<li class="chapter" data-level="26" data-path="activity-12-area-data-iv.html"><a href="activity-12-area-data-iv.html"><i class="fa fa-check"></i><b>26</b> Activity 12: Area Data IV</a>
<ul>
<li class="chapter" data-level="26.1" data-path="activity-12-area-data-iv.html"><a href="activity-12-area-data-iv.html#practice-questions-9"><i class="fa fa-check"></i><b>26.1</b> Practice questions</a></li>
<li class="chapter" data-level="26.2" data-path="activity-12-area-data-iv.html"><a href="activity-12-area-data-iv.html#learning-objectives-25"><i class="fa fa-check"></i><b>26.2</b> Learning objectives</a></li>
<li class="chapter" data-level="26.3" data-path="activity-12-area-data-iv.html"><a href="activity-12-area-data-iv.html#suggested-reading-10"><i class="fa fa-check"></i><b>26.3</b> Suggested reading</a></li>
<li class="chapter" data-level="26.4" data-path="activity-12-area-data-iv.html"><a href="activity-12-area-data-iv.html#preliminaries-23"><i class="fa fa-check"></i><b>26.4</b> Preliminaries</a></li>
<li class="chapter" data-level="26.5" data-path="activity-12-area-data-iv.html"><a href="activity-12-area-data-iv.html#activity-11"><i class="fa fa-check"></i><b>26.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="27" data-path="area-data-v.html"><a href="area-data-v.html"><i class="fa fa-check"></i><b>27</b> Area Data V</a>
<ul>
<li class="chapter" data-level="27.1" data-path="area-data-v.html"><a href="area-data-v.html#learning-objectives-26"><i class="fa fa-check"></i><b>27.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="27.2" data-path="area-data-v.html"><a href="area-data-v.html#suggested-readings-12"><i class="fa fa-check"></i><b>27.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="27.3" data-path="area-data-v.html"><a href="area-data-v.html#preliminaries-24"><i class="fa fa-check"></i><b>27.3</b> Preliminaries</a></li>
<li class="chapter" data-level="27.4" data-path="area-data-v.html"><a href="area-data-v.html#regression-analysis-in-r"><i class="fa fa-check"></i><b>27.4</b> Regression Analysis in <code>R</code></a></li>
<li class="chapter" data-level="27.5" data-path="area-data-v.html"><a href="area-data-v.html#autocorrelation-as-a-model-diagnostic"><i class="fa fa-check"></i><b>27.5</b> Autocorrelation as a Model Diagnostic</a></li>
<li class="chapter" data-level="27.6" data-path="area-data-v.html"><a href="area-data-v.html#variable-transformations"><i class="fa fa-check"></i><b>27.6</b> Variable Transformations</a></li>
<li class="chapter" data-level="27.7" data-path="area-data-v.html"><a href="area-data-v.html#a-note-about-spatial-autocorrelation-in-regression-analysis"><i class="fa fa-check"></i><b>27.7</b> A Note about Spatial Autocorrelation in Regression Analysis</a></li>
</ul></li>
<li class="chapter" data-level="28" data-path="activity-13-area-data-v.html"><a href="activity-13-area-data-v.html"><i class="fa fa-check"></i><b>28</b> Activity 13: Area Data V</a>
<ul>
<li class="chapter" data-level="28.1" data-path="activity-13-area-data-v.html"><a href="activity-13-area-data-v.html#practice-questions-10"><i class="fa fa-check"></i><b>28.1</b> Practice questions</a></li>
<li class="chapter" data-level="28.2" data-path="activity-13-area-data-v.html"><a href="activity-13-area-data-v.html#learning-objectives-27"><i class="fa fa-check"></i><b>28.2</b> Learning objectives</a></li>
<li class="chapter" data-level="28.3" data-path="activity-13-area-data-v.html"><a href="activity-13-area-data-v.html#suggested-reading-11"><i class="fa fa-check"></i><b>28.3</b> Suggested reading</a></li>
<li class="chapter" data-level="28.4" data-path="activity-13-area-data-v.html"><a href="activity-13-area-data-v.html#preliminaries-25"><i class="fa fa-check"></i><b>28.4</b> Preliminaries</a></li>
<li class="chapter" data-level="28.5" data-path="activity-13-area-data-v.html"><a href="activity-13-area-data-v.html#activity-12"><i class="fa fa-check"></i><b>28.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="29" data-path="area-data-vi.html"><a href="area-data-vi.html"><i class="fa fa-check"></i><b>29</b> Area Data VI</a>
<ul>
<li class="chapter" data-level="29.1" data-path="area-data-vi.html"><a href="area-data-vi.html#learning-objectives-28"><i class="fa fa-check"></i><b>29.1</b> Learning Objectives</a></li>
<li class="chapter" data-level="29.2" data-path="area-data-vi.html"><a href="area-data-vi.html#suggested-readings-13"><i class="fa fa-check"></i><b>29.2</b> Suggested Readings</a></li>
<li class="chapter" data-level="29.3" data-path="area-data-vi.html"><a href="area-data-vi.html#preliminaries-26"><i class="fa fa-check"></i><b>29.3</b> Preliminaries</a></li>
<li class="chapter" data-level="29.4" data-path="area-data-vi.html"><a href="area-data-vi.html#residual-spatial-autocorrelation-revisited"><i class="fa fa-check"></i><b>29.4</b> Residual spatial autocorrelation revisited</a>
<ul>
<li class="chapter" data-level="29.4.1" data-path="area-data-vi.html"><a href="area-data-vi.html#incorrect-functional-form"><i class="fa fa-check"></i><b>29.4.1</b> Incorrect Functional Form</a></li>
<li class="chapter" data-level="29.4.2" data-path="area-data-vi.html"><a href="area-data-vi.html#omitted-variables"><i class="fa fa-check"></i><b>29.4.2</b> Omitted Variables</a></li>
</ul></li>
<li class="chapter" data-level="29.5" data-path="area-data-vi.html"><a href="area-data-vi.html#remedial-action"><i class="fa fa-check"></i><b>29.5</b> Remedial Action</a></li>
<li class="chapter" data-level="29.6" data-path="area-data-vi.html"><a href="area-data-vi.html#flexible-functional-forms-and-models-with-spatially-varying-coefficients"><i class="fa fa-check"></i><b>29.6</b> Flexible Functional Forms and Models with Spatially-varying Coefficients</a>
<ul>
<li class="chapter" data-level="29.6.1" data-path="area-data-vi.html"><a href="area-data-vi.html#trend-surface-analysis"><i class="fa fa-check"></i><b>29.6.1</b> Trend Surface Analysis</a></li>
<li class="chapter" data-level="29.6.2" data-path="area-data-vi.html"><a href="area-data-vi.html#models-with-spatially-varying-coefficients"><i class="fa fa-check"></i><b>29.6.2</b> Models with Spatially-varying Coefficients</a></li>
</ul></li>
<li class="chapter" data-level="29.7" data-path="area-data-vi.html"><a href="area-data-vi.html#spatial-error-model-sem"><i class="fa fa-check"></i><b>29.7</b> Spatial Error Model (SEM)</a></li>
</ul></li>
<li class="chapter" data-level="30" data-path="activity-14-area-data-vi.html"><a href="activity-14-area-data-vi.html"><i class="fa fa-check"></i><b>30</b> Activity 14: Area Data VI</a>
<ul>
<li class="chapter" data-level="30.1" data-path="activity-14-area-data-vi.html"><a href="activity-14-area-data-vi.html#practice-questions-11"><i class="fa fa-check"></i><b>30.1</b> Practice questions</a></li>
<li class="chapter" data-level="30.2" data-path="activity-14-area-data-vi.html"><a href="activity-14-area-data-vi.html#learning-objectives-29"><i class="fa fa-check"></i><b>30.2</b> Learning objectives</a></li>
<li class="chapter" data-level="30.3" data-path="activity-14-area-data-vi.html"><a href="activity-14-area-data-vi.html#suggested-reading-12"><i class="fa fa-check"></i><b>30.3</b> Suggested reading</a></li>
<li class="chapter" data-level="30.4" data-path="activity-14-area-data-vi.html"><a href="activity-14-area-data-vi.html#preliminaries-27"><i class="fa fa-check"></i><b>30.4</b> Preliminaries</a>
<ul>
<li class="chapter" data-level="30.4.1" data-path="activity-14-area-data-vi.html"><a href="activity-14-area-data-vi.html#new-york-leukemia-data"><i class="fa fa-check"></i><b>30.4.1</b> New York leukemia data</a></li>
<li class="chapter" data-level="30.4.2" data-path="activity-14-area-data-vi.html"><a href="activity-14-area-data-vi.html#pennsylvania-lung-cancer"><i class="fa fa-check"></i><b>30.4.2</b> Pennsylvania lung cancer</a></li>
</ul></li>
<li class="chapter" data-level="30.5" data-path="activity-14-area-data-vi.html"><a href="activity-14-area-data-vi.html#activity-13"><i class="fa fa-check"></i><b>30.5</b> Activity</a></li>
</ul></li>
<li class="part"><span><b>V Part V: Analysis and Prediction of Fields</b></span></li>
<li class="chapter" data-level="31" data-path="spatially-continuous-data-i.html"><a href="spatially-continuous-data-i.html"><i class="fa fa-check"></i><b>31</b> Spatially Continuous Data I</a>
<ul>
<li class="chapter" data-level="31.1" data-path="spatially-continuous-data-i.html"><a href="spatially-continuous-data-i.html#learning-objectives-30"><i class="fa fa-check"></i><b>31.1</b> Learning objectives</a></li>
<li class="chapter" data-level="31.2" data-path="spatially-continuous-data-i.html"><a href="spatially-continuous-data-i.html#suggested-readings-14"><i class="fa fa-check"></i><b>31.2</b> Suggested readings</a></li>
<li class="chapter" data-level="31.3" data-path="spatially-continuous-data-i.html"><a href="spatially-continuous-data-i.html#preliminaries-28"><i class="fa fa-check"></i><b>31.3</b> Preliminaries</a></li>
<li class="chapter" data-level="31.4" data-path="spatially-continuous-data-i.html"><a href="spatially-continuous-data-i.html#spatially-continuous-field-data"><i class="fa fa-check"></i><b>31.4</b> Spatially continuous (field) data</a></li>
<li class="chapter" data-level="31.5" data-path="spatially-continuous-data-i.html"><a href="spatially-continuous-data-i.html#exploratory-visualization"><i class="fa fa-check"></i><b>31.5</b> Exploratory visualization</a></li>
<li class="chapter" data-level="31.6" data-path="spatially-continuous-data-i.html"><a href="spatially-continuous-data-i.html#tile-based-methods"><i class="fa fa-check"></i><b>31.6</b> Tile-based methods</a></li>
<li class="chapter" data-level="31.7" data-path="spatially-continuous-data-i.html"><a href="spatially-continuous-data-i.html#inverse-distance-weighting-idw"><i class="fa fa-check"></i><b>31.7</b> Inverse distance weighting (IDW)</a></li>
<li class="chapter" data-level="31.8" data-path="spatially-continuous-data-i.html"><a href="spatially-continuous-data-i.html#k-point-means"><i class="fa fa-check"></i><b>31.8</b> <span class="math inline">\(k\)</span>-point means</a></li>
</ul></li>
<li class="chapter" data-level="32" data-path="activity-15-spatially-continuous-data-i.html"><a href="activity-15-spatially-continuous-data-i.html"><i class="fa fa-check"></i><b>32</b> Activity 15: Spatially Continuous Data I</a>
<ul>
<li class="chapter" data-level="32.1" data-path="activity-15-spatially-continuous-data-i.html"><a href="activity-15-spatially-continuous-data-i.html#practice-questions-12"><i class="fa fa-check"></i><b>32.1</b> Practice questions</a></li>
<li class="chapter" data-level="32.2" data-path="activity-15-spatially-continuous-data-i.html"><a href="activity-15-spatially-continuous-data-i.html#learning-objectives-31"><i class="fa fa-check"></i><b>32.2</b> Learning objectives</a></li>
<li class="chapter" data-level="32.3" data-path="activity-15-spatially-continuous-data-i.html"><a href="activity-15-spatially-continuous-data-i.html#suggested-reading-13"><i class="fa fa-check"></i><b>32.3</b> Suggested reading</a></li>
<li class="chapter" data-level="32.4" data-path="activity-15-spatially-continuous-data-i.html"><a href="activity-15-spatially-continuous-data-i.html#preliminaries-29"><i class="fa fa-check"></i><b>32.4</b> Preliminaries</a></li>
<li class="chapter" data-level="32.5" data-path="activity-15-spatially-continuous-data-i.html"><a href="activity-15-spatially-continuous-data-i.html#activity-14"><i class="fa fa-check"></i><b>32.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="33" data-path="spatially-continuous-data-ii.html"><a href="spatially-continuous-data-ii.html"><i class="fa fa-check"></i><b>33</b> Spatially Continuous Data II</a>
<ul>
<li class="chapter" data-level="33.1" data-path="spatially-continuous-data-ii.html"><a href="spatially-continuous-data-ii.html#learning-objectives-32"><i class="fa fa-check"></i><b>33.1</b> Learning objectives</a></li>
<li class="chapter" data-level="33.2" data-path="spatially-continuous-data-ii.html"><a href="spatially-continuous-data-ii.html#suggested-readings-15"><i class="fa fa-check"></i><b>33.2</b> Suggested readings</a></li>
<li class="chapter" data-level="33.3" data-path="spatially-continuous-data-ii.html"><a href="spatially-continuous-data-ii.html#preliminaries-30"><i class="fa fa-check"></i><b>33.3</b> Preliminaries</a></li>
<li class="chapter" data-level="33.4" data-path="spatially-continuous-data-ii.html"><a href="spatially-continuous-data-ii.html#uncertainty-in-the-predictions"><i class="fa fa-check"></i><b>33.4</b> Uncertainty in the predictions</a></li>
<li class="chapter" data-level="33.5" data-path="spatially-continuous-data-ii.html"><a href="spatially-continuous-data-ii.html#trend-surface-analysis-1"><i class="fa fa-check"></i><b>33.5</b> Trend surface analysis</a></li>
<li class="chapter" data-level="33.6" data-path="spatially-continuous-data-ii.html"><a href="spatially-continuous-data-ii.html#accuracy-and-precision"><i class="fa fa-check"></i><b>33.6</b> Accuracy and precision</a></li>
</ul></li>
<li class="chapter" data-level="34" data-path="activity-16-spatially-continuous-data-ii.html"><a href="activity-16-spatially-continuous-data-ii.html"><i class="fa fa-check"></i><b>34</b> Activity 16: Spatially Continuous Data II</a>
<ul>
<li class="chapter" data-level="34.1" data-path="activity-16-spatially-continuous-data-ii.html"><a href="activity-16-spatially-continuous-data-ii.html#practice-questions-13"><i class="fa fa-check"></i><b>34.1</b> Practice questions</a></li>
<li class="chapter" data-level="34.2" data-path="activity-16-spatially-continuous-data-ii.html"><a href="activity-16-spatially-continuous-data-ii.html#learning-objectives-33"><i class="fa fa-check"></i><b>34.2</b> Learning objectives</a></li>
<li class="chapter" data-level="34.3" data-path="activity-16-spatially-continuous-data-ii.html"><a href="activity-16-spatially-continuous-data-ii.html#suggested-reading-14"><i class="fa fa-check"></i><b>34.3</b> Suggested reading</a></li>
<li class="chapter" data-level="34.4" data-path="activity-16-spatially-continuous-data-ii.html"><a href="activity-16-spatially-continuous-data-ii.html#preliminaries-31"><i class="fa fa-check"></i><b>34.4</b> Preliminaries</a></li>
<li class="chapter" data-level="34.5" data-path="activity-16-spatially-continuous-data-ii.html"><a href="activity-16-spatially-continuous-data-ii.html#activity-15"><i class="fa fa-check"></i><b>34.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="35" data-path="spatially-continuous-data-iii.html"><a href="spatially-continuous-data-iii.html"><i class="fa fa-check"></i><b>35</b> Spatially Continuous Data III</a>
<ul>
<li class="chapter" data-level="35.1" data-path="spatially-continuous-data-iii.html"><a href="spatially-continuous-data-iii.html#learning-objectives-34"><i class="fa fa-check"></i><b>35.1</b> Learning objectives</a></li>
<li class="chapter" data-level="35.2" data-path="spatially-continuous-data-iii.html"><a href="spatially-continuous-data-iii.html#suggested-reading-15"><i class="fa fa-check"></i><b>35.2</b> Suggested reading</a></li>
<li class="chapter" data-level="35.3" data-path="spatially-continuous-data-iii.html"><a href="spatially-continuous-data-iii.html#preliminaries-32"><i class="fa fa-check"></i><b>35.3</b> Preliminaries</a></li>
<li class="chapter" data-level="35.4" data-path="spatially-continuous-data-iii.html"><a href="spatially-continuous-data-iii.html#residual-spatial-pattern"><i class="fa fa-check"></i><b>35.4</b> Residual spatial pattern</a></li>
<li class="chapter" data-level="35.5" data-path="spatially-continuous-data-iii.html"><a href="spatially-continuous-data-iii.html#measuring-spatial-dependence-in-spatially-continuous-data"><i class="fa fa-check"></i><b>35.5</b> Measuring spatial dependence in spatially continuous data</a></li>
<li class="chapter" data-level="35.6" data-path="spatially-continuous-data-iii.html"><a href="spatially-continuous-data-iii.html#variographic-analyisis"><i class="fa fa-check"></i><b>35.6</b> Variographic analyisis</a></li>
</ul></li>
<li class="chapter" data-level="36" data-path="activity-17-spatially-continuous-data-iii.html"><a href="activity-17-spatially-continuous-data-iii.html"><i class="fa fa-check"></i><b>36</b> Activity 17: Spatially Continuous Data III</a>
<ul>
<li class="chapter" data-level="36.1" data-path="activity-17-spatially-continuous-data-iii.html"><a href="activity-17-spatially-continuous-data-iii.html#practice-questions-14"><i class="fa fa-check"></i><b>36.1</b> Practice questions</a></li>
<li class="chapter" data-level="36.2" data-path="activity-17-spatially-continuous-data-iii.html"><a href="activity-17-spatially-continuous-data-iii.html#learning-objectives-35"><i class="fa fa-check"></i><b>36.2</b> Learning objectives</a></li>
<li class="chapter" data-level="36.3" data-path="activity-17-spatially-continuous-data-iii.html"><a href="activity-17-spatially-continuous-data-iii.html#suggested-reading-16"><i class="fa fa-check"></i><b>36.3</b> Suggested reading</a></li>
<li class="chapter" data-level="36.4" data-path="activity-17-spatially-continuous-data-iii.html"><a href="activity-17-spatially-continuous-data-iii.html#preliminaries-33"><i class="fa fa-check"></i><b>36.4</b> Preliminaries</a></li>
<li class="chapter" data-level="36.5" data-path="activity-17-spatially-continuous-data-iii.html"><a href="activity-17-spatially-continuous-data-iii.html#activity-16"><i class="fa fa-check"></i><b>36.5</b> Activity</a></li>
</ul></li>
<li class="chapter" data-level="37" data-path="spatially-continuous-data-iv.html"><a href="spatially-continuous-data-iv.html"><i class="fa fa-check"></i><b>37</b> Spatially Continuous Data IV</a>
<ul>
<li class="chapter" data-level="37.1" data-path="spatially-continuous-data-iv.html"><a href="spatially-continuous-data-iv.html#learning-objectives-36"><i class="fa fa-check"></i><b>37.1</b> Learning objectives</a></li>
<li class="chapter" data-level="37.2" data-path="spatially-continuous-data-iv.html"><a href="spatially-continuous-data-iv.html#suggested-reading-17"><i class="fa fa-check"></i><b>37.2</b> Suggested reading</a></li>
<li class="chapter" data-level="37.3" data-path="spatially-continuous-data-iv.html"><a href="spatially-continuous-data-iv.html#preliminaries-34"><i class="fa fa-check"></i><b>37.3</b> Preliminaries</a></li>
<li class="chapter" data-level="37.4" data-path="spatially-continuous-data-iv.html"><a href="spatially-continuous-data-iv.html#using-residual-spatial-pattern-to-estimate-prediction-errors"><i class="fa fa-check"></i><b>37.4</b> Using residual spatial pattern to estimate prediction errors</a></li>
<li class="chapter" data-level="37.5" data-path="spatially-continuous-data-iv.html"><a href="spatially-continuous-data-iv.html#kriging-a-method-for-optimal-prediction."><i class="fa fa-check"></i><b>37.5</b> Kriging: a method for optimal prediction.</a></li>
</ul></li>
<li class="chapter" data-level="38" data-path="activity-18-spatially-continuous-data-iv.html"><a href="activity-18-spatially-continuous-data-iv.html"><i class="fa fa-check"></i><b>38</b> Activity 18: Spatially Continuous Data IV</a>
<ul>
<li class="chapter" data-level="38.1" data-path="activity-18-spatially-continuous-data-iv.html"><a href="activity-18-spatially-continuous-data-iv.html#practice-questions-15"><i class="fa fa-check"></i><b>38.1</b> Practice questions</a></li>
<li class="chapter" data-level="38.2" data-path="activity-18-spatially-continuous-data-iv.html"><a href="activity-18-spatially-continuous-data-iv.html#learning-objectives-37"><i class="fa fa-check"></i><b>38.2</b> Learning objectives</a></li>
<li class="chapter" data-level="38.3" data-path="activity-18-spatially-continuous-data-iv.html"><a href="activity-18-spatially-continuous-data-iv.html#suggested-reading-18"><i class="fa fa-check"></i><b>38.3</b> Suggested reading</a></li>
<li class="chapter" data-level="38.4" data-path="activity-18-spatially-continuous-data-iv.html"><a href="activity-18-spatially-continuous-data-iv.html#preliminaries-35"><i class="fa fa-check"></i><b>38.4</b> Preliminaries</a></li>
<li class="chapter" data-level="38.5" data-path="activity-18-spatially-continuous-data-iv.html"><a href="activity-18-spatially-continuous-data-iv.html#activity-17"><i class="fa fa-check"></i><b>38.5</b> Activity</a></li>
</ul></li>
<li class="divider"></li>
<li><a href="https://github.com/paezha/spatial-analysis-R" target="blank">Published with bookdown</a></li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i><a href="./">An Introduction to Spatial Data Analysis and Statistics: A Course in <code>R</code></a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<section class="normal" id="section-">
<div id="spatially-continuous-data-i" class="section level1" number="31">
<h1><span class="header-section-number">Chapter 31</span> Spatially Continuous Data I</h1>
<p><em>NOTE</em>: You can download the source files for this book from <a href="https://github.com/paezha/Spatial-Statistics-Course">here</a>. The source files are in the format of R Notebooks. Notebooks are pretty neat, because the allow you execute code within the notebook, so that you can work interactively with the notes.</p>
<p>If you wish to work interactively with this chapter you will need the following:</p>
<ul>
<li><p>An R markdown notebook version of this document (the source file).</p></li>
<li><p>A package called <code>geog4ga3</code>.</p></li>
</ul>
<p>You will also use a custom function that is included in the package <code>geog4ga3</code> as follows:</p>
<p><code>kpointmeans(source_xy, z, target_xy, k, latlong)</code></p>
<p>This is a function to calculate k-point means. It takes a set of source coordinates (<code>source_xy</code>), that is, the coordinates of observations to be used for interpolation; a variable <code>z</code> to interpolate; a set of target coordinates (<code>target_xy</code>), the points to interpolate <code>z</code>; the number of nearest neighbors <code>k</code>; and a logical value to indicate whether the coordinates are latitude-longitude (the default is <code>FALSE</code>).</p>
<div id="learning-objectives-30" class="section level2" number="31.1">
<h2><span class="header-section-number">31.1</span> Learning objectives</h2>
<p>Previously, you learned about the analysis of area data. Starting with this practice, you will be introduced to another type of spatial data: continuous data, also called fields. In this practice, you will learn:</p>
<ol style="list-style-type: decimal">
<li>About spatially continuous data/fields.</li>
<li>Exploratory visualization.</li>
<li>The purpose of spatial interpolation.</li>
<li>The use of tile-based approaches.</li>
<li>Inverse distance weighting.</li>
<li>K-point means.</li>
</ol>
</div>
<div id="suggested-readings-14" class="section level2" number="31.2">
<h2><span class="header-section-number">31.2</span> Suggested readings</h2>
<ul>
<li>Bailey TC and Gatrell AC <span class="citation">(<a href="#ref-Bailey1995" role="doc-biblioref">1995</a>)</span> Interactive Spatial Data Analysis, Chapters 5 and 6. Longman: Essex.</li>
<li>Bivand RS, Pebesma E, and Gomez-Rubio V <span class="citation">(<a href="#ref-Bivand2008" role="doc-biblioref">2008</a>)</span> Applied Spatial Data Analysis with R, Chapter 8. Springer: New York.</li>
<li>Brunsdon C and Comber L <span class="citation">(<a href="#ref-Brunsdon2015R" role="doc-biblioref">2015</a>)</span> An Introduction to R for Spatial Analysis and Mapping, Chapter 6, Sections 6.7 and 6.8. Sage: Los Angeles.</li>
<li>Isaaks EH and Srivastava RM <span class="citation">(<a href="#ref-Isaaks1989applied" role="doc-biblioref">1989</a>)</span> An Introduction to Applied Geostatistics, <strong>CHAPTERS</strong>. Oxford University Press: Oxford.</li>
<li>O’Sullivan D and Unwin D <span class="citation">(<a href="#ref-Osullivan2010" role="doc-biblioref">2010</a>)</span> Geographic Information Analysis, 2nd Edition, Chapters 9 and 10. John Wiley &amp; Sons: New Jersey.</li>
</ul>
</div>
<div id="preliminaries-28" class="section level2" number="31.3">
<h2><span class="header-section-number">31.3</span> Preliminaries</h2>
<p>As usual, it is good practice to clear the working space to make sure that you do not have extraneous items there when you begin your work. The command in R to clear the workspace is <code>rm</code> (for “remove”), followed by a list of items to be removed. To clear the workspace from <em>all</em> objects, do the following:</p>
<div class="sourceCode" id="cb665"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb665-1"><a href="spatially-continuous-data-i.html#cb665-1" aria-hidden="true" tabindex="-1"></a><span class="fu">rm</span>(<span class="at">list =</span> <span class="fu">ls</span>())</span></code></pre></div>
<p>Note that <code>ls()</code> lists all objects currently on the workspace.</p>
<p>Load the libraries you will use in this activity:</p>
<div class="sourceCode" id="cb666"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb666-1"><a href="spatially-continuous-data-i.html#cb666-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(deldir)</span>
<span id="cb666-2"><a href="spatially-continuous-data-i.html#cb666-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(geog4ga3)</span>
<span id="cb666-3"><a href="spatially-continuous-data-i.html#cb666-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(plotly)</span>
<span id="cb666-4"><a href="spatially-continuous-data-i.html#cb666-4" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(spatstat)</span>
<span id="cb666-5"><a href="spatially-continuous-data-i.html#cb666-5" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(spdep)</span>
<span id="cb666-6"><a href="spatially-continuous-data-i.html#cb666-6" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tidyverse)</span></code></pre></div>
<p>Begin by loading the data you will need for this Chapter:</p>
<div class="sourceCode" id="cb667"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb667-1"><a href="spatially-continuous-data-i.html#cb667-1" aria-hidden="true" tabindex="-1"></a><span class="fu">data</span>(<span class="st">&quot;Walker_Lake&quot;</span>)</span></code></pre></div>
<p>You can verify the contents of the dataframe:</p>
<div class="sourceCode" id="cb668"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb668-1"><a href="spatially-continuous-data-i.html#cb668-1" aria-hidden="true" tabindex="-1"></a><span class="fu">summary</span>(Walker_Lake)</span></code></pre></div>
<pre><code>## ID X Y V
## Length:470 Min. : 8.0 Min. : 8.0 Min. : 0.0
## Class :character 1st Qu.: 51.0 1st Qu.: 80.0 1st Qu.: 182.0
## Mode :character Median : 89.0 Median :139.5 Median : 425.2
## Mean :111.1 Mean :141.3 Mean : 435.4
## 3rd Qu.:170.0 3rd Qu.:208.0 3rd Qu.: 644.4
## Max. :251.0 Max. :291.0 Max. :1528.1
##
## U T
## Min. : 0.00 1: 45
## 1st Qu.: 83.95 2:425
## Median : 335.00
## Mean : 613.27
## 3rd Qu.: 883.20
## Max. :5190.10
## NA&#39;s :195</code></pre>
<p>This dataframe includes a sample of of geocoded observations with false coordinates <code>X</code> and <code>Y</code>, of two quantitative variables <code>V</code>, <code>U</code>, and a factor variable <code>T</code>. The variables are generic, but you can think of them as measurements of pollutants. The Walker Lake dataset originally was used for teaching geostatistics in Isaaks and Srivastava’s <span class="citation">(<a href="#ref-Isaaks1989applied" role="doc-biblioref">1989</a>)</span> book <a href="https://books.google.ca/books?id=vC2dcXFLI3YC&amp;dq=introduction+to+applied+geostatistics+isaaks+and+srivastava&amp;hl=en&amp;sa=X&amp;ved=0ahUKEwiKg6_iyrXZAhUjp1kKHd_jAVcQ6AEIKTAA">An Introduction to Geostatistics</a>.</p>
</div>
<div id="spatially-continuous-field-data" class="section level2" number="31.4">
<h2><span class="header-section-number">31.4</span> Spatially continuous (field) data</h2>
<p>Previously in the book we discussed two types of data that are of interest in spatial analysis: points and events, and areas.</p>
<p>The last section of the course will deal with a third type of data that finds numerous applications in many disciplines.</p>
<p>We will begin by recalling that there are different <em>units of support</em> for spatial data. The unit of support is the type of spatial object that is used to represent a spatial phenomenon, and that is useful to understand the kind of process and the types of analysis that can be applied.</p>
<p>In the case of point pattern analysis, the unit of support is the point. Depending on the scale of the analysis, the point could be anything from the centroid of cells, the location of trees, the addresses of businesses, or the centers of cities at a much larger scale. Obviously, none of these objects are actual points (the point is a theoretical object). However, points are a reasonable representation for events when their size is minuscule compared to the area of the region under analysis. The most basic attribute of an event is whether it is present (e.g., is there a tree at this location?). Other attributes are conditional on that one.</p>
<p>In the case of areas, the unit of support is a zone. Data in this type of analysis may or not be generated by a discontinuous process, but once it has been cast in the form of statistics for areas, this will usually involve discontinuities at the edges of the areas.</p>
<p>An important difference between point pattern analysis and analysis of data in areas is the source of the randomness.</p>
<p>In the case of point pattern analysis, the coordinates of the event are assumed to be the outcome of a random process. In area data, the locations of the data are exogenously given, and the source of randomness instead is in the values of the attributes.</p>
<p>This brings us to spatially continuous data.</p>
<p>Superficially, spatially continuous data looks like points. This is because of how a field is measured at discrete locations. The underlying process, however, is not discrete, and a field can in principle be measured at any location in the space where the underlying phenomenon is in operation. Some obvious examples of this include temperature and elevation. Temperature is measured at discrete locations, but the phenomenon itself is extensive. Same thing with elevation.</p>
<p>The source of randomness in the case of fields is the inherent uncertainty of the outcome of the process at locations where it was not measured. Therefore, an essential task is to predict values at unmeasured locations. We call this task <em>spatial interpolation</em>. In addition, we often are interested in assessing the degree of uncertainty of predictions or interpolated values.</p>
<p>The study of continuous data has been heavily influenced by the work of South African mining engineer <a href="https://en.wikipedia.org/wiki/Danie_G._Krige">D.G. Krige</a>, who sought to estimate the distribution of minerals based on samples of boreholes. Since then, the study of fields has found applications in remote sensing, real estate appraisal, environmental science, hydrogeology, and many other disciplines.</p>
<p>We will define a field as a mixed spatial process that depends on the coordinates <span class="math inline">\(u_i\)</span> and <span class="math inline">\(v_i\)</span>, in addition to a vector of covariates <span class="math inline">\(\bf{x}_i\)</span>:
<span class="math display">\[
z_i = f(u_i, v_i, \bf{x}_i) + \epsilon_i
\]</span>
where <span class="math inline">\(i\)</span> is an arbitrary location in the region, and <span class="math inline">\(\epsilon_i\)</span> is the difference between the systematic description of the process (i.e., <span class="math inline">\(f(u_i, v_i, \bf{x}_i)\)</span>) and the value of the field <span class="math inline">\(z\)</span>.</p>
<p>More simply, a field could be the outcome of a purely spatial process as follows:
<span class="math display">\[
z_i = f(u_i, v_i) + \epsilon_i
\]</span></p>
<p>The value of a field is known at the locations <span class="math inline">\(i\)</span> where it is measured. In locations where the field was not measured (we will call any such location <span class="math inline">\(p\)</span>), there will be some uncertainty about the value of the field variable, which stems from our limited knowledge of the underlying process. As a consequence, there will be a random term associated with any prediction of the value of the field:
<span class="math display">\[
\hat{z}_p = \hat{f}(u_p, v_p) + \hat{\epsilon}_p
\]</span>
We use the hat notation to indicate that these are estimates of the true values.</p>
<p>A key task in the analysis of fields is to determine a suitable function for making predictions <span class="math inline">\(\hat{z}_p\)</span> and to estimate the uncertainty as well.</p>
<p>In this and upcoming sessions you will learn about methods to achieve this task.</p>
</div>
<div id="exploratory-visualization" class="section level2" number="31.5">
<h2><span class="header-section-number">31.5</span> Exploratory visualization</h2>
<p>We will begin our discussion of fields with techniques for exploratory visualization. The methods are very similar to those used for marked point patterns in point pattern analysis. Like we did there, we can use dot or proportional symbol maps. For example, we can create a proportional symbol map of the variable <code>V</code> in the Walker Lake dataset (with alpha = 0.5 for some transparency to mitigate the overplotting):</p>
<div class="sourceCode" id="cb670"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb670-1"><a href="spatially-continuous-data-i.html#cb670-1" aria-hidden="true" tabindex="-1"></a>ps1 <span class="ot">&lt;-</span> <span class="fu">ggplot</span>(<span class="at">data =</span> Walker_Lake, </span>
<span id="cb670-2"><a href="spatially-continuous-data-i.html#cb670-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span> (<span class="at">x =</span> X, <span class="at">y =</span> Y, <span class="at">color =</span> V, <span class="at">size =</span> V)) <span class="sc">+</span></span>
<span id="cb670-3"><a href="spatially-continuous-data-i.html#cb670-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(<span class="at">alpha =</span> <span class="fl">0.5</span>) <span class="sc">+</span> <span class="co"># `alpha` is used to control the transparency of the objects, with 1 being completely opaque and 0 completely transparent.</span></span>
<span id="cb670-4"><a href="spatially-continuous-data-i.html#cb670-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_distiller</span>(<span class="at">palette =</span> <span class="st">&quot;OrRd&quot;</span>, <span class="at">trans =</span> <span class="st">&quot;reverse&quot;</span>) <span class="sc">+</span></span>
<span id="cb670-5"><a href="spatially-continuous-data-i.html#cb670-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_equal</span>() <span class="co">#&#39;Coord_equal&#39; ensures that units in the x and y axis are displayed using the same lengths.</span></span>
<span id="cb670-6"><a href="spatially-continuous-data-i.html#cb670-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb670-7"><a href="spatially-continuous-data-i.html#cb670-7" aria-hidden="true" tabindex="-1"></a>ps1</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-470-1.png" width="672" /></p>
<p>The proportional symbols indicate the location where a measurement was made. There is no randomness in these locations, as they were selected by design. In particular, notice how a regular grid seems to have been used for part of the sampling, and then possibly there was further infill sampling at those places where the field appeared to vary more.</p>
<p>Imagine that the observations are of a contaminant. The task could be to calculate the total amount of the contaminant over the region. This would require you to obtain estimates of the contaminant in all the region, not just those places where measurements were made. If, as is typically the case, making more observations is expensive, other approaches must be adopted.</p>
<p>Before proceeding, remember that the package <code>plotly</code> can be used to enhance exploratory analysis by allowing user interactivity. Below is the same plot as before, but now as an interactive 3D scatterplot:</p>
<div class="sourceCode" id="cb671"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb671-1"><a href="spatially-continuous-data-i.html#cb671-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot_ly</span>(<span class="at">data =</span> Walker_Lake, <span class="at">x =</span> <span class="sc">~</span>X, <span class="at">y =</span> <span class="sc">~</span>Y, <span class="at">z =</span> <span class="sc">~</span>V,</span>
<span id="cb671-2"><a href="spatially-continuous-data-i.html#cb671-2" aria-hidden="true" tabindex="-1"></a> <span class="at">marker =</span> <span class="fu">list</span>(<span class="at">color =</span> <span class="sc">~</span>V, <span class="at">colorscale =</span> <span class="fu">c</span>(<span class="st">&quot;Orange&quot;</span>, <span class="st">&quot;Red&quot;</span>), </span>
<span id="cb671-3"><a href="spatially-continuous-data-i.html#cb671-3" aria-hidden="true" tabindex="-1"></a> <span class="at">showscale =</span> <span class="cn">TRUE</span>)) <span class="sc">%&gt;%</span> </span>
<span id="cb671-4"><a href="spatially-continuous-data-i.html#cb671-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">add_markers</span>() <span class="co">#adding traces to a plotly visualization</span></span></code></pre></div>
<div id="htmlwidget-ba15ac4a81feced183df" style="width:672px;height:480px;" class="plotly html-widget"></div>
<script type="application/json" data-for="htmlwidget-ba15ac4a81feced183df">{"x":{"visdat":{"28457fe7b214":["function () ","plotlyVisDat"]},"cur_data":"28457fe7b214","attrs":{"28457fe7b214":{"x":{},"y":{},"z":{},"marker":{"color":{},"colorscale":["Orange","Red"],"showscale":true},"alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"scatter3d","mode":"markers","inherit":true}},"layout":{"margin":{"b":40,"l":60,"t":25,"r":10},"scene":{"xaxis":{"title":"X"},"yaxis":{"title":"Y"},"zaxis":{"title":"V"}},"hovermode":"closest","showlegend":false},"source":"A","config":{"modeBarButtonsToAdd":["hoverclosest","hovercompare"],"showSendToCloud":false},"data":[{"x":[11,8,9,8,9,10,9,11,10,8,9,10,11,10,8,31,29,28,31,28,30,28,28,30,28,31,28,30,31,31,49,49,51,49,50,51,48,49,51,48,50,49,51,50,51,71,71,70,68,69,68,68,69,69,70,69,69,68,71,71,91,91,90,91,91,91,89,88,89,89,90,90,88,88,88,109,111,108,109,108,110,109,110,111,111,110,109,109,109,111,130,131,130,128,129,131,129,131,131,129,128,130,131,128,131,148,149,150,151,150,150,150,150,149,151,148,150,149,149,148,168,171,169,168,168,171,168,171,171,169,170,170,169,168,168,190,191,191,190,190,188,191,189,190,190,188,191,190,189,189,211,209,211,210,209,210,211,208,209,208,210,211,211,208,208,231,231,230,230,229,229,230,228,229,231,231,229,231,231,230,249,250,249,251,251,248,249,248,250,250,251,251,249,248,250,40,21,28,29,41,18,39,18,41,21,31,41,21,60,40,51,59,41,59,51,50,59,60,60,38,50,50,61,39,61,38,61,39,49,58,39,60,40,51,60,40,58,38,50,61,39,59,41,49,51,59,39,59,38,78,60,70,70,78,61,78,80,58,71,70,79,80,61,79,71,78,80,69,79,80,70,81,100,80,90,88,100,80,101,101,79,90,100,81,100,80,91,101,81,98,81,90,100,98,90,99,121,111,108,120,119,158,140,150,151,161,141,160,139,178,159,169,170,180,178,158,219,198,211,208,221,199,220,198,220,200,208,210,221,198,219,200,239,218,229,239,218,238,218,231,230,240,221,239,218,35,24,34,23,54,46,55,45,53,46,55,43,55,44,55,46,54,43,73,64,75,64,73,64,75,63,73,64,93,86,93,84,93,86,96,85,93,86,114,106,155,145,174,166,215,205,215,204,236,223,236,226,35,24,36,26,16,43,15,46,36,54,46,54,43,65,33,36,53,44,65,34,33,55,46,63,34,65,35,46,36,35,53,46,45,35,35,84,84,75,73,63,84,76,84,86,73,76,94,85,104,93,75,94,85,104,75,95,83,94,103,114,104,196,215,204,196,195,216,225,214,245,233,226,213],"y":[8,30,48,68,90,110,129,150,170,188,209,231,250,269,288,11,29,51,68,88,110,130,150,171,190,209,229,250,269,289,11,29,48,68,88,109,129,151,168,190,211,231,250,268,290,9,29,51,70,90,110,128,148,169,191,208,229,250,268,288,11,29,49,68,91,111,130,149,170,188,211,230,249,269,288,11,31,49,68,88,109,129,148,169,191,208,230,249,268,291,9,31,48,70,90,109,128,148,169,191,209,231,248,269,288,8,29,49,69,89,109,129,151,169,190,208,228,251,271,291,8,29,49,69,91,109,131,150,171,191,210,230,249,271,290,11,28,48,69,89,111,129,149,169,189,210,231,248,270,290,11,30,49,70,90,111,130,151,168,191,211,228,250,268,289,10,28,50,71,91,110,131,148,169,191,208,228,249,268,291,9,30,48,69,91,109,130,150,169,190,208,229,251,270,291,71,69,80,59,81,80,60,60,90,90,101,100,100,8,11,18,20,21,90,101,81,101,81,151,148,160,138,158,160,139,140,170,170,179,179,181,191,190,198,198,200,208,209,221,220,221,268,271,278,260,281,279,258,260,28,29,41,21,41,41,20,131,128,140,121,138,119,121,149,160,159,168,181,181,188,198,200,48,49,58,39,60,59,38,68,70,79,78,81,91,89,99,100,98,111,108,120,118,130,140,138,131,140,121,141,118,228,229,241,218,241,240,218,220,211,209,221,198,218,201,198,88,90,100,80,99,98,81,78,150,150,159,140,160,161,139,139,8,8,19,18,18,229,228,239,221,239,241,220,218,71,71,88,91,10,11,89,89,150,148,168,170,191,191,211,211,269,271,29,31,129,129,149,151,171,168,188,191,48,48,70,69,90,89,111,108,131,131,131,130,229,230,208,211,89,89,148,151,9,9,229,230,80,79,61,58,80,60,88,99,99,80,81,161,161,160,160,170,179,180,181,180,191,199,198,201,201,210,208,220,219,271,258,260,281,278,259,30,41,40,141,140,138,159,161,169,199,51,61,60,38,41,90,101,100,109,110,121,119,140,139,120,118,91,101,101,101,149,11,19,19,231,220,221,218],"z":[0,0,224.4,434.4,412.1,587.2,192.3,31.3,388.5,174.6,187.8,82.1,81.1,124.3,188,28.7,78.1,292.1,895.2,702.6,490.3,136.1,335,277,206.1,24.5,198.1,60.3,312.6,240.9,653.3,96.4,105,37.8,820.8,450.7,190.4,773.3,971.9,762.4,968.3,394.7,343,863.8,159.6,445.8,673.3,252.6,537.5,0,329.1,646.3,616.2,761.3,918,97.4,0,0,0,2.4,368.3,91.6,654.7,645.5,907.2,826.3,975.3,551.1,155.5,10.7,0,0,0,12.1,62.2,399.6,176.6,402,260.6,192,237.6,702,38.5,22.1,2.7,17.9,174.2,12.9,187.8,268.8,572.5,29.1,75.2,399.9,243.1,0,244.7,185.2,26,0,100.3,530.3,107.4,159.3,70.7,260.2,326,332.7,531.3,547.2,482.7,84.1,4.7,180.6,0,342.4,602.3,209.1,79.4,104.1,446,189.9,280.4,0,499.3,457.3,341.2,0,208.3,99.7,636.6,173.1,17,283.1,30.9,348.5,22.4,59.1,0,326,325.1,114.7,481.6,324.1,10.9,332.9,184.4,146.6,92,2.5,358.1,473.3,308.8,406.8,812.1,339.7,223.9,673.5,141,61.8,258.3,590.3,166.9,125.2,29.3,617.6,425.9,295.7,224.9,31.7,377.4,333.3,351,0,137.6,451.2,639.5,119.9,27.2,2.1,167.7,147.8,442.7,487.7,0,28.2,0,18.3,266.3,502.3,0,240.9,234.4,22.4,45.6,76.2,284.3,606.8,772.7,269.5,1036.7,783.8,519.4,414.9,601.4,579.2,601.4,594.6,550.1,99.4,233.6,14.4,115.9,506.2,502.4,608,363.9,385.6,1521.1,340.9,879.1,413.4,868.9,657.4,477,268.5,806.4,914.4,811.5,1113.6,1008,1528.1,970.9,1109,1203.9,641.3,720.6,665.3,543.3,101.1,615.9,543.1,868.8,583,670.7,148.8,798,194.9,635.2,781.6,238.6,472,58.1,600.3,64.9,505.9,801.6,158.8,606.3,30.7,730.1,421.2,104.8,44.1,801.1,742,689.1,424.6,184.3,245.2,630,0,48.7,757.4,739.8,520.7,0,0,730.5,383.1,508.8,573.3,372.4,585.8,397.2,614.5,734.9,599.3,181.2,744.8,1022.3,899.3,363.7,513.2,648.8,645.4,13,190.3,893,104.7,150.4,558.4,558,318.5,394.3,141.9,112.5,580.4,535.9,398.2,517.3,427.2,367.6,374.7,144.8,169.8,235.1,611.7,746.4,436.6,540.9,801,272.1,204.1,543.9,606.2,356,440.9,301.8,369.4,166.8,230.9,240.3,737.1,518.6,390.7,797.4,602.6,430.8,354.1,602.4,172.6,324.8,420.1,763.5,687.8,735.8,86.9,817,637.9,512.3,423.4,569.6,858,234,876,1082.8,1392.6,646.6,889.7,509.2,613.1,767.8,649.4,235.4,782.8,227.3,722.9,974.5,512.2,1215.8,687.1,1259.9,684.5,471.9,512.1,963.9,874,582.4,553.2,937.3,883.6,879,268.4,651.5,386.4,33.2,339.2,600.3,595.2,809.6,293.3,697.3,515.9,613.2,665.3,813.6,174.8,891.8,699.6,39.5,915.6,584,610,566.8,38.1,483,542.6,959.3,631.9,928.3,431,672.3,1003.4,876.4,734.1,366,296.5,1069.2,804.3,731.1,318.1,238.6,428.9,737.4,429.1,597.4,442.6,765.2,605.5,795.9,235,562,411.4,696.7,790.9,696.5,687.3,597.5,437.4,317.4,470.7,498.7,778.7,523.3,617.1,395.3,518.9,383.7,704.1,562.3,655.3,823.6,847.7,607.5,491.2,319.5,594,433.5,209.6,533.8,592.4,478.7,660.2,832.2,242.5,161.2,626,800.1,482.6],"marker":{"color":[0,0,224.4,434.4,412.1,587.2,192.3,31.3,388.5,174.6,187.8,82.1,81.1,124.3,188,28.7,78.1,292.1,895.2,702.6,490.3,136.1,335,277,206.1,24.5,198.1,60.3,312.6,240.9,653.3,96.4,105,37.8,820.8,450.7,190.4,773.3,971.9,762.4,968.3,394.7,343,863.8,159.6,445.8,673.3,252.6,537.5,0,329.1,646.3,616.2,761.3,918,97.4,0,0,0,2.4,368.3,91.6,654.7,645.5,907.2,826.3,975.3,551.1,155.5,10.7,0,0,0,12.1,62.2,399.6,176.6,402,260.6,192,237.6,702,38.5,22.1,2.7,17.9,174.2,12.9,187.8,268.8,572.5,29.1,75.2,399.9,243.1,0,244.7,185.2,26,0,100.3,530.3,107.4,159.3,70.7,260.2,326,332.7,531.3,547.2,482.7,84.1,4.7,180.6,0,342.4,602.3,209.1,79.4,104.1,446,189.9,280.4,0,499.3,457.3,341.2,0,208.3,99.7,636.6,173.1,17,283.1,30.9,348.5,22.4,59.1,0,326,325.1,114.7,481.6,324.1,10.9,332.9,184.4,146.6,92,2.5,358.1,473.3,308.8,406.8,812.1,339.7,223.9,673.5,141,61.8,258.3,590.3,166.9,125.2,29.3,617.6,425.9,295.7,224.9,31.7,377.4,333.3,351,0,137.6,451.2,639.5,119.9,27.2,2.1,167.7,147.8,442.7,487.7,0,28.2,0,18.3,266.3,502.3,0,240.9,234.4,22.4,45.6,76.2,284.3,606.8,772.7,269.5,1036.7,783.8,519.4,414.9,601.4,579.2,601.4,594.6,550.1,99.4,233.6,14.4,115.9,506.2,502.4,608,363.9,385.6,1521.1,340.9,879.1,413.4,868.9,657.4,477,268.5,806.4,914.4,811.5,1113.6,1008,1528.1,970.9,1109,1203.9,641.3,720.6,665.3,543.3,101.1,615.9,543.1,868.8,583,670.7,148.8,798,194.9,635.2,781.6,238.6,472,58.1,600.3,64.9,505.9,801.6,158.8,606.3,30.7,730.1,421.2,104.8,44.1,801.1,742,689.1,424.6,184.3,245.2,630,0,48.7,757.4,739.8,520.7,0,0,730.5,383.1,508.8,573.3,372.4,585.8,397.2,614.5,734.9,599.3,181.2,744.8,1022.3,899.3,363.7,513.2,648.8,645.4,13,190.3,893,104.7,150.4,558.4,558,318.5,394.3,141.9,112.5,580.4,535.9,398.2,517.3,427.2,367.6,374.7,144.8,169.8,235.1,611.7,746.4,436.6,540.9,801,272.1,204.1,543.9,606.2,356,440.9,301.8,369.4,166.8,230.9,240.3,737.1,518.6,390.7,797.4,602.6,430.8,354.1,602.4,172.6,324.8,420.1,763.5,687.8,735.8,86.9,817,637.9,512.3,423.4,569.6,858,234,876,1082.8,1392.6,646.6,889.7,509.2,613.1,767.8,649.4,235.4,782.8,227.3,722.9,974.5,512.2,1215.8,687.1,1259.9,684.5,471.9,512.1,963.9,874,582.4,553.2,937.3,883.6,879,268.4,651.5,386.4,33.2,339.2,600.3,595.2,809.6,293.3,697.3,515.9,613.2,665.3,813.6,174.8,891.8,699.6,39.5,915.6,584,610,566.8,38.1,483,542.6,959.3,631.9,928.3,431,672.3,1003.4,876.4,734.1,366,296.5,1069.2,804.3,731.1,318.1,238.6,428.9,737.4,429.1,597.4,442.6,765.2,605.5,795.9,235,562,411.4,696.7,790.9,696.5,687.3,597.5,437.4,317.4,470.7,498.7,778.7,523.3,617.1,395.3,518.9,383.7,704.1,562.3,655.3,823.6,847.7,607.5,491.2,319.5,594,433.5,209.6,533.8,592.4,478.7,660.2,832.2,242.5,161.2,626,800.1,482.6],"colorscale":["Orange","Red"],"showscale":true,"line":{"color":"rgba(31,119,180,1)"}},"type":"scatter3d","mode":"markers","error_y":{"color":"rgba(31,119,180,1)"},"error_x":{"color":"rgba(31,119,180,1)"},"line":{"color":"rgba(31,119,180,1)"},"frame":null}],"highlight":{"on":"plotly_click","persistent":false,"dynamic":false,"selectize":false,"opacityDim":0.2,"selected":{"opacity":1},"debounce":0},"shinyEvents":["plotly_hover","plotly_click","plotly_selected","plotly_relayout","plotly_brushed","plotly_brushing","plotly_clickannotation","plotly_doubleclick","plotly_deselect","plotly_afterplot","plotly_sunburstclick"],"base_url":"https://plot.ly"},"evals":[],"jsHooks":[]}</script>
</div>
<div id="tile-based-methods" class="section level2" number="31.6">
<h2><span class="header-section-number">31.6</span> Tile-based methods</h2>
<p>Another common approach to visualize fields is by means of tile-based methods. These methods take a set of points and convert them into a tessellation, thus giving them the aspect of “tiles”.</p>
<p>A widely used algorithm to convert points into tiles is called Voronoi polygons, after <a href="https://en.wikipedia.org/wiki/Georgy_Voronoy">Georgy Voronoi</a>, the mathematician that discovered it. To illustrate how Voronoi polygons are created, we will use a simple example.</p>
<ol style="list-style-type: decimal">
<li>Given a set of generating points <span class="math inline">\(p_g\)</span> with coordinates <span class="math inline">\((u_g, u_g)\)</span> (for <span class="math inline">\(g = 1,...,n\)</span>) and values of a variable <span class="math inline">\(z_{p_g}\)</span>:</li>
</ol>
<div class="sourceCode" id="cb672"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb672-1"><a href="spatially-continuous-data-i.html#cb672-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Create a set of coordinates for the example</span></span>
<span id="cb672-2"><a href="spatially-continuous-data-i.html#cb672-2" aria-hidden="true" tabindex="-1"></a>uv_coords <span class="ot">&lt;-</span> <span class="fu">matrix</span>(<span class="fu">c</span>(<span class="fl">0.7</span>, <span class="fl">5.2</span>, <span class="fl">3.3</span>, <span class="fl">1.3</span>, <span class="fl">5.4</span>, <span class="fl">0.5</span>, <span class="fl">1.8</span>, <span class="fl">2.3</span>, <span class="fl">4.8</span>, <span class="fl">5.5</span>), <span class="fu">c</span>(<span class="dv">5</span>, <span class="dv">2</span>)) <span class="sc">%&gt;%</span> </span>
<span id="cb672-3"><a href="spatially-continuous-data-i.html#cb672-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">st_multipoint</span>(<span class="st">&quot;XY&quot;</span>)</span>
<span id="cb672-4"><a href="spatially-continuous-data-i.html#cb672-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb672-5"><a href="spatially-continuous-data-i.html#cb672-5" aria-hidden="true" tabindex="-1"></a><span class="co"># Create a window for the points, this is similar to the windows used in `spatstat` for spatial point pattern analysis</span></span>
<span id="cb672-6"><a href="spatially-continuous-data-i.html#cb672-6" aria-hidden="true" tabindex="-1"></a>box <span class="ot">=</span> <span class="fu">st_polygon</span>(<span class="fu">list</span>(<span class="fu">rbind</span>(<span class="fu">c</span>(<span class="dv">0</span>,<span class="dv">0</span>),<span class="fu">c</span>(<span class="dv">6</span>,<span class="dv">0</span>),<span class="fu">c</span>(<span class="dv">6</span>,<span class="dv">6</span>),<span class="fu">c</span>(<span class="dv">0</span>,<span class="dv">6</span>),<span class="fu">c</span>(<span class="dv">0</span>,<span class="dv">0</span>))))</span>
<span id="cb672-7"><a href="spatially-continuous-data-i.html#cb672-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb672-8"><a href="spatially-continuous-data-i.html#cb672-8" aria-hidden="true" tabindex="-1"></a><span class="co"># Create a plot of the coordinates and the window</span></span>
<span id="cb672-9"><a href="spatially-continuous-data-i.html#cb672-9" aria-hidden="true" tabindex="-1"></a>p <span class="ot">&lt;-</span> <span class="fu">ggplot</span>(<span class="at">data =</span> uv_coords) <span class="sc">+</span> </span>
<span id="cb672-10"><a href="spatially-continuous-data-i.html#cb672-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">size =</span> <span class="dv">2</span>) <span class="sc">+</span></span>
<span id="cb672-11"><a href="spatially-continuous-data-i.html#cb672-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">data =</span> box, <span class="at">fill =</span> <span class="cn">NA</span>)</span>
<span id="cb672-12"><a href="spatially-continuous-data-i.html#cb672-12" aria-hidden="true" tabindex="-1"></a>p</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-472-1.png" width="672" /></p>
<ol start="2" style="list-style-type: decimal">
<li>Each point is connected by means of straight lines to its two nearest neighbors to create a triangulation:</li>
</ol>
<div class="sourceCode" id="cb673"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb673-1"><a href="spatially-continuous-data-i.html#cb673-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Create a triangulation that connect each point to its two nearest neighbors. The function `st_triangulate()` from the `sf` package does this. The output can be polygons (triangles) or lines only. We set bOnlyEdges = TRUE to obtain only the lines.</span></span>
<span id="cb673-2"><a href="spatially-continuous-data-i.html#cb673-2" aria-hidden="true" tabindex="-1"></a>l2n <span class="ot">&lt;-</span> <span class="fu">st_triangulate</span>(uv_coords, <span class="at">bOnlyEdges =</span> <span class="cn">TRUE</span>)</span>
<span id="cb673-3"><a href="spatially-continuous-data-i.html#cb673-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb673-4"><a href="spatially-continuous-data-i.html#cb673-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot the triangulation, i.e., the lines between nearest neighbors</span></span>
<span id="cb673-5"><a href="spatially-continuous-data-i.html#cb673-5" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>(<span class="at">data =</span> uv_coords) <span class="sc">+</span> </span>
<span id="cb673-6"><a href="spatially-continuous-data-i.html#cb673-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">size =</span> <span class="dv">2</span>) <span class="sc">+</span></span>
<span id="cb673-7"><a href="spatially-continuous-data-i.html#cb673-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">data =</span> box, </span>
<span id="cb673-8"><a href="spatially-continuous-data-i.html#cb673-8" aria-hidden="true" tabindex="-1"></a> <span class="at">fill =</span> <span class="cn">NA</span>) <span class="sc">+</span></span>
<span id="cb673-9"><a href="spatially-continuous-data-i.html#cb673-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">data =</span> l2n, </span>
<span id="cb673-10"><a href="spatially-continuous-data-i.html#cb673-10" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> <span class="st">&quot;gray&quot;</span>, </span>
<span id="cb673-11"><a href="spatially-continuous-data-i.html#cb673-11" aria-hidden="true" tabindex="-1"></a> <span class="at">linetype =</span> <span class="st">&quot;dashed&quot;</span>)</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-473-1.png" width="672" /></p>
<p>Notice that the plot above is already a tessellation, with the points at the vertices of the triangles.</p>
<ol start="3" style="list-style-type: decimal">
<li>The perpendicular bisectors of each triangle are found and extended, until they intersect. The resulting tessellation is a set of Voronoi polygons:</li>
</ol>
<div class="sourceCode" id="cb674"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb674-1"><a href="spatially-continuous-data-i.html#cb674-1" aria-hidden="true" tabindex="-1"></a><span class="co"># The function `st_voronoi()` from the `sf` package is used to create Voronoi polygons</span></span>
<span id="cb674-2"><a href="spatially-continuous-data-i.html#cb674-2" aria-hidden="true" tabindex="-1"></a>vor <span class="ot">&lt;-</span> <span class="fu">st_voronoi</span>(uv_coords) <span class="co">#Calculates voronoi polygons based on a set of spatial points.</span></span>
<span id="cb674-3"><a href="spatially-continuous-data-i.html#cb674-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb674-4"><a href="spatially-continuous-data-i.html#cb674-4" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>(<span class="at">data =</span> uv_coords) <span class="sc">+</span></span>
<span id="cb674-5"><a href="spatially-continuous-data-i.html#cb674-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">size =</span> <span class="dv">2</span>) <span class="sc">+</span> </span>
<span id="cb674-6"><a href="spatially-continuous-data-i.html#cb674-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">data =</span> l2n, </span>
<span id="cb674-7"><a href="spatially-continuous-data-i.html#cb674-7" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> <span class="st">&quot;gray&quot;</span>, </span>
<span id="cb674-8"><a href="spatially-continuous-data-i.html#cb674-8" aria-hidden="true" tabindex="-1"></a> <span class="at">linetype =</span> <span class="st">&quot;dashed&quot;</span>) <span class="sc">+</span> </span>
<span id="cb674-9"><a href="spatially-continuous-data-i.html#cb674-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">data =</span> vor, <span class="at">fill =</span> <span class="cn">NA</span>) <span class="sc">+</span> </span>
<span id="cb674-10"><a href="spatially-continuous-data-i.html#cb674-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_sf</span>(<span class="at">xlim =</span> <span class="fu">c</span>(<span class="dv">0</span>, <span class="dv">6</span>), <span class="at">y =</span> <span class="fu">c</span>(<span class="dv">0</span>, <span class="dv">6</span>))</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-474-1.png" width="672" /></p>
<p>The triangulation was used to generate a second tessellation, i.e., the Voronoi polygons. These polygons have the property that any point <span class="math inline">\(p_i\)</span> inside the polygon with generating point <span class="math inline">\(p_g\)</span> in it, is closer to <span class="math inline">\(p_g\)</span> than to any other generating point <span class="math inline">\(p_k\)</span> on the plane. For this reason, Voronoi polygons are used to obtain areas of influence, among other applications.</p>
<p>There are other ways of obtaining Voronoi polygons, as Figure 1 below illustrates. Voronoi polygons in the figure are created by radial growth. The basic concept is the same, but implemented in a different way: find every point that is closest to <span class="math inline">\(p_g\)</span>. When two circles touch, they become the boundary between all points that are closer to <span class="math inline">\(p_g\)</span> and <span class="math inline">\(p_k\)</span> respectively. Continue growing until the plane is fully covered.</p>
<div class="figure">
<img src="Voronoi_growth_euclidean.gif" alt="" />
<p class="caption">Figure 1. Voronoi polygons by radial growth (source: The Internet)</p>
</div>
<p>The Voronoi polygons for the sample data set can be obtained in <code>R</code> as follows.</p>
<p>First, we will convert the <code>Walker_Lake</code> dataframe to a simple features object using as follows:</p>
<div class="sourceCode" id="cb675"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb675-1"><a href="spatially-continuous-data-i.html#cb675-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Function `st_as_sf()` takes a foreign object (foreign to the `sf` package) and converts it into a simple features object. If the foreign object is points, the coordinates can be named by means of the argument `coords`. </span></span>
<span id="cb675-2"><a href="spatially-continuous-data-i.html#cb675-2" aria-hidden="true" tabindex="-1"></a>Walker_Lake.sf <span class="ot">&lt;-</span> Walker_Lake <span class="sc">%&gt;%</span> </span>
<span id="cb675-3"><a href="spatially-continuous-data-i.html#cb675-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">st_as_sf</span>(<span class="at">coords =</span> <span class="fu">c</span>(<span class="st">&quot;X&quot;</span>, <span class="st">&quot;Y&quot;</span>))</span></code></pre></div>
<p>Once we have an <code>sf</code> object of the points, the geometry can be used to create the Voronoi polygons:</p>
<div class="sourceCode" id="cb676"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb676-1"><a href="spatially-continuous-data-i.html#cb676-1" aria-hidden="true" tabindex="-1"></a><span class="co"># The function `do.call(what, arg)` applies a function `what` to the argument `arg`. In this case, we extract the geometry of the `sf` object (i.e., the coordinates of the points) and apply the function `c()` to concatenate the coordinates to obtain a MULTIPOINT object. </span></span>
<span id="cb676-2"><a href="spatially-continuous-data-i.html#cb676-2" aria-hidden="true" tabindex="-1"></a>vpolygons <span class="ot">&lt;-</span> <span class="fu">do.call</span>(c, <span class="fu">st_geometry</span>(Walker_Lake.sf)) <span class="sc">%&gt;%</span> <span class="co"># The pipe operator passes the MuLTIPOINT object to function `st_voronoi()`</span></span>
<span id="cb676-3"><a href="spatially-continuous-data-i.html#cb676-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">st_voronoi</span>() <span class="sc">%&gt;%</span> <span class="co"># The output of `st_voronoi()` is a collection of geometries, which we pass to the following function for extraction.</span></span>
<span id="cb676-4"><a href="spatially-continuous-data-i.html#cb676-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">st_collection_extract</span>()</span></code></pre></div>
<p>After the step above we already have the Voronoi polygons:</p>
<div class="sourceCode" id="cb677"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb677-1"><a href="spatially-continuous-data-i.html#cb677-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>(vpolygons) <span class="sc">+</span> </span>
<span id="cb677-2"><a href="spatially-continuous-data-i.html#cb677-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">fill =</span> <span class="cn">NA</span>)</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-477-1.png" width="672" /></p>
<p>However, these polygons are just the geometry and lack other attributes that we originally had for the points. See:</p>
<div class="sourceCode" id="cb678"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb678-1"><a href="spatially-continuous-data-i.html#cb678-1" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(vpolygons)</span></code></pre></div>
<pre><code>## Geometry set for 6 features
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: -275 ymin: -19.79545 xmax: 39.35 ymax: 232.9318
## CRS: NA
## First 5 geometries:</code></pre>
<pre><code>## POLYGON ((-275 91.88636, -275 109.5, -180.5 109...</code></pre>
<pre><code>## POLYGON ((-275 49, -275 91.88636, 4.207317 79.1...</code></pre>
<pre><code>## POLYGON ((-275 -19.79545, -275 49, -171.5 49, 1...</code></pre>
<pre><code>## POLYGON ((20.40385 52.61538, 18.36567 50.35075,...</code></pre>
<pre><code>## POLYGON ((18.36567 50.35075, 20.40385 52.61538,...</code></pre>
<p>For this reason, we need to join the Voronoi polygons to the attributes of the points. To do this, we will first copy the <code>sf</code> object with the original points to a new dataframe, and then replace the geometry of the points with the geometry of the polygons:</p>
<div class="sourceCode" id="cb685"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb685-1"><a href="spatially-continuous-data-i.html#cb685-1" aria-hidden="true" tabindex="-1"></a>Walker_Lake.v <span class="ot">&lt;-</span> Walker_Lake.sf</span>
<span id="cb685-2"><a href="spatially-continuous-data-i.html#cb685-2" aria-hidden="true" tabindex="-1"></a>Walker_Lake.v<span class="sc">$</span>geometry <span class="ot">&lt;-</span> vpolygons[<span class="fu">unlist</span>(<span class="fu">st_intersects</span>(Walker_Lake.sf, vpolygons))] </span></code></pre></div>
<p>The new <code>Walker_Lake.v</code> object now includes the attributes of the original points as well as the geometry of the polygons:</p>
<div class="sourceCode" id="cb686"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb686-1"><a href="spatially-continuous-data-i.html#cb686-1" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(Walker_Lake.v)</span></code></pre></div>
<pre><code>## Simple feature collection with 6 features and 4 fields
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: -275 ymin: -275 xmax: 35.5 ymax: 120
## CRS: NA
## # A tibble: 6 × 5
## ID V U T geometry
## &lt;chr&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;fct&gt; &lt;POLYGON&gt;
## 1 1 0 NA 2 ((35.5 -275, -275 -275, -275 -19.79545, 18.05556 20.1…
## 2 2 0 NA 2 ((-275 -19.79545, -275 49, -171.5 49, 18.9248 38.4208…
## 3 3 224. NA 2 ((-171.5 49, 8.1875 57.98438, 18.36567 50.35075, 20.0…
## 4 4 434. NA 2 ((-275 49, -275 91.88636, 4.207317 79.19512, 14.18919…
## 5 5 412. NA 2 ((-275 91.88636, -275 109.5, -180.5 109.5, 10.8913 99…
## 6 6 587. NA 2 ((-180.5 109.5, 19 120, 20 119.1, 20 109.95, 10.8913 …</code></pre>
<p>We can now plot the attributes as the polygons. The value of <span class="math inline">\(z\)</span> for a tile is the same as the value of the variable for its corresponding generating point, or <span class="math inline">\(z_{p_g}\)</span>. This is the plot for the current example:</p>
<div class="sourceCode" id="cb688"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb688-1"><a href="spatially-continuous-data-i.html#cb688-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>(Walker_Lake.v) <span class="sc">+</span> </span>
<span id="cb688-2"><a href="spatially-continuous-data-i.html#cb688-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="fu">aes</span>(<span class="at">fill =</span> V)) <span class="sc">+</span></span>
<span id="cb688-3"><a href="spatially-continuous-data-i.html#cb688-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_distiller</span>(<span class="at">palette =</span> <span class="st">&quot;OrRd&quot;</span>, <span class="at">direction =</span> <span class="dv">1</span>)</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-481-1.png" width="672" /></p>
<p>We can see that the Voronoi polygons extend well beyond the extent of the original points, and in the plot add a large amount of unnecessary area. We can improve the plot in two ways, by limiting the extent for plotting, or by clipping the polygons. Here we will try the latter, with a bounding box that covers the region of interest:</p>
<div class="sourceCode" id="cb689"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb689-1"><a href="spatially-continuous-data-i.html#cb689-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Function `st_polygon()` creates an `sf` object with a polygon or polygons. In this case, we create a single polygon, a rectangle with corners given by the coordinates in the function. </span></span>
<span id="cb689-2"><a href="spatially-continuous-data-i.html#cb689-2" aria-hidden="true" tabindex="-1"></a>W.bbox <span class="ot">&lt;-</span> <span class="fu">st_polygon</span>(<span class="fu">list</span>(<span class="fu">rbind</span>(<span class="fu">c</span>(<span class="dv">0</span>,<span class="dv">0</span>),<span class="fu">c</span>(<span class="dv">259</span>,<span class="dv">0</span>),<span class="fu">c</span>(<span class="dv">259</span>, <span class="dv">299</span>),<span class="fu">c</span>(<span class="dv">0</span>, <span class="dv">299</span>),<span class="fu">c</span>(<span class="dv">0</span>,<span class="dv">0</span>))))</span></code></pre></div>
<p>The intersection of the polygons with the box clips the polygons:</p>
<div class="sourceCode" id="cb690"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb690-1"><a href="spatially-continuous-data-i.html#cb690-1" aria-hidden="true" tabindex="-1"></a>Walker_Lake.v <span class="ot">&lt;-</span> Walker_Lake.v <span class="sc">%&gt;%</span></span>
<span id="cb690-2"><a href="spatially-continuous-data-i.html#cb690-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">st_intersection</span>(W.bbox)</span></code></pre></div>
<pre><code>## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries</code></pre>
<p>This is the plot after fixing this issue:</p>
<div class="sourceCode" id="cb692"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb692-1"><a href="spatially-continuous-data-i.html#cb692-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>(Walker_Lake.v) <span class="sc">+</span> </span>
<span id="cb692-2"><a href="spatially-continuous-data-i.html#cb692-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="fu">aes</span>(<span class="at">fill =</span> V)) <span class="sc">+</span> </span>
<span id="cb692-3"><a href="spatially-continuous-data-i.html#cb692-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">data =</span> Walker_Lake.sf, <span class="at">size =</span> <span class="fl">0.1</span>) <span class="sc">+</span></span>
<span id="cb692-4"><a href="spatially-continuous-data-i.html#cb692-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_distiller</span>(<span class="at">palette =</span> <span class="st">&quot;OrRd&quot;</span>, <span class="at">direction =</span> <span class="dv">1</span>)</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-484-1.png" width="672" /></p>
<p>As you can see, the points in the sample have been converted to a surface from which the value of <span class="math inline">\(z\)</span> can be estimated at any point as desired, from the value of <span class="math inline">\(z\)</span> of the closest point used to generate the tiles. This can be expressed as follows:
<span class="math display">\[
\hat{z}_p = z_{p_g}\text{ for } p_g\text{ with } d_{pp_g}&lt;d_{pp_k}\forall{k}
\]</span></p>
</div>
<div id="inverse-distance-weighting-idw" class="section level2" number="31.7">
<h2><span class="header-section-number">31.7</span> Inverse distance weighting (IDW)</h2>
<p>The tile-based approach above assumes that the field is flat within each polygon (see Figure 2). This is in most cases an unrealistic assumption. Other approaches to interpolate a spatial variable allow the estimated value of <span class="math inline">\(z_p\)</span> to vary with proximity to observations. Such is the case of IDW.</p>
<div class="figure">
<img src="Figure%202.%20Voronoi%20polygons%20field.jpg" alt="" />
<p class="caption">Figure 2. A field according to Voronoi polygons</p>
</div>
<p>Inverse distance weighting takes the following form:
<span class="math display">\[
\hat{z}_p = \frac{\sum_{i=1}^n{w_{pi}z_i}}{\sum_{i=1}^n{w_{pi}}}
\]</span></p>
<p>This will probably look familiar to you, because it is formally identical to the spatial moving average. The difference is in how the “spatial weights” <span class="math inline">\(w_{pi}\)</span> are defined. For IDW, the spatial weights are given by a function of the inverse power of distance, as follows:
<span class="math display">\[
w_{pi} = \frac{1}{d_{pi}^\gamma}
\]</span>
In the expression above, parameter <span class="math inline">\(\gamma\)</span> controls the steepness of the decay function, with smaller values giving greater weight to more distant locations. Large values of <span class="math inline">\(\gamma\)</span> converge to a 1-point average (so that the interpolated value is identical to the nearest observation; you can verify this).</p>
<p>We can see that inverse distance weighting is a weighted average of <em>all</em> observations in the sample, but with greater weight given to more proximate observations. This approach is implemented in <code>R</code> in the package <code>spatstat</code> with the function <code>idw</code>. To use this function, the points must be converted into a <code>ppp</code> object. This necessitates that we define a window object, which we do based on the bounding box that we created for the Voronoi polygons:</p>
<div class="sourceCode" id="cb693"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb693-1"><a href="spatially-continuous-data-i.html#cb693-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Function `as.owin()` takes the polygon with the bounding box we created above and converts it into an `owin` object for use with the `spatstat` package. </span></span>
<span id="cb693-2"><a href="spatially-continuous-data-i.html#cb693-2" aria-hidden="true" tabindex="-1"></a>W.owin <span class="ot">&lt;-</span> <span class="fu">as.owin</span>(W.bbox)</span>
<span id="cb693-3"><a href="spatially-continuous-data-i.html#cb693-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb693-4"><a href="spatially-continuous-data-i.html#cb693-4" aria-hidden="true" tabindex="-1"></a><span class="co"># We can create a `ppp` object with the coordinates of the points</span></span>
<span id="cb693-5"><a href="spatially-continuous-data-i.html#cb693-5" aria-hidden="true" tabindex="-1"></a>Walker_Lake.ppp <span class="ot">&lt;-</span> <span class="fu">as.ppp</span>(<span class="at">X =</span> Walker_Lake[,<span class="dv">2</span><span class="sc">:</span><span class="dv">4</span>], <span class="at">W =</span> W.owin)</span></code></pre></div>
<p>The call to the function requires a <code>ppp</code> object and the argument for the power to use in the inverse distance function. In this call, the power is set to 1:</p>
<div class="sourceCode" id="cb694"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb694-1"><a href="spatially-continuous-data-i.html#cb694-1" aria-hidden="true" tabindex="-1"></a>z_p.idw1 <span class="ot">&lt;-</span> <span class="fu">idw</span>(Walker_Lake.ppp, <span class="at">power =</span> <span class="dv">1</span>)</span></code></pre></div>
<p>The value (output) of this function is an <code>im</code> object. Objects of this type are used by the package <code>spatstat</code> to work with raster data. It can be simply plotted as follows:</p>
<div class="sourceCode" id="cb695"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb695-1"><a href="spatially-continuous-data-i.html#cb695-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(z_p.idw1)</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-487-1.png" width="672" /></p>
<p>Or the information can be extracted for greater control of the aspect of the plot in <code>ggplot2</code>:</p>
<div class="sourceCode" id="cb696"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb696-1"><a href="spatially-continuous-data-i.html#cb696-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>(<span class="at">data =</span> <span class="fu">data.frame</span>(<span class="fu">expand.grid</span>(<span class="at">X=</span> z_p.idw1<span class="sc">$</span>xcol, <span class="at">Y =</span> z_p.idw1<span class="sc">$</span>yrow),</span>
<span id="cb696-2"><a href="spatially-continuous-data-i.html#cb696-2" aria-hidden="true" tabindex="-1"></a> <span class="at">V =</span> <span class="fu">as.vector</span>(<span class="fu">t</span>(z_p.idw1<span class="sc">$</span>v))), <span class="co"># transpose matrix</span></span>
<span id="cb696-3"><a href="spatially-continuous-data-i.html#cb696-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">aes</span>(<span class="at">x =</span> X, <span class="at">y =</span> Y, <span class="at">fill =</span> V)) <span class="sc">+</span> </span>
<span id="cb696-4"><a href="spatially-continuous-data-i.html#cb696-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_tile</span>() <span class="sc">+</span></span>
<span id="cb696-5"><a href="spatially-continuous-data-i.html#cb696-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_distiller</span>(<span class="at">palette =</span> <span class="st">&quot;OrRd&quot;</span>, <span class="at">direction =</span> <span class="dv">1</span>) <span class="sc">+</span></span>
<span id="cb696-6"><a href="spatially-continuous-data-i.html#cb696-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_equal</span>()</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-488-1.png" width="672" /></p>
<p>Notice the dots where the observations are - the value of the field is known there. We can explore the effect of changing the parameter for the power, by using <span class="math inline">\(\gamma = 0.5, 1, 2, \text{ and } 5\)</span>:</p>
<div class="sourceCode" id="cb697"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb697-1"><a href="spatially-continuous-data-i.html#cb697-1" aria-hidden="true" tabindex="-1"></a>z_p.idw05 <span class="ot">&lt;-</span> <span class="fu">idw</span>(Walker_Lake.ppp, <span class="at">power =</span> <span class="fl">0.5</span>)</span>
<span id="cb697-2"><a href="spatially-continuous-data-i.html#cb697-2" aria-hidden="true" tabindex="-1"></a>z_p.idw2 <span class="ot">&lt;-</span> <span class="fu">idw</span>(Walker_Lake.ppp, <span class="at">power =</span> <span class="dv">2</span>)</span>
<span id="cb697-3"><a href="spatially-continuous-data-i.html#cb697-3" aria-hidden="true" tabindex="-1"></a>z_p.idw5 <span class="ot">&lt;-</span> <span class="fu">idw</span>(Walker_Lake.ppp, <span class="at">power =</span> <span class="dv">5</span>)</span>
<span id="cb697-4"><a href="spatially-continuous-data-i.html#cb697-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb697-5"><a href="spatially-continuous-data-i.html#cb697-5" aria-hidden="true" tabindex="-1"></a><span class="co">#Inverse distance weighting for walker lake using three different gamma variables </span></span></code></pre></div>
<p>For ease of comparison, we will collect the information into a single dataframe:</p>
<div class="sourceCode" id="cb698"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb698-1"><a href="spatially-continuous-data-i.html#cb698-1" aria-hidden="true" tabindex="-1"></a>z_p.idw05.df <span class="ot">&lt;-</span> <span class="fu">data.frame</span>(<span class="fu">expand.grid</span>(<span class="at">X=</span> z_p.idw05<span class="sc">$</span>xcol, <span class="at">Y =</span> z_p.idw05<span class="sc">$</span>yrow),</span>
<span id="cb698-2"><a href="spatially-continuous-data-i.html#cb698-2" aria-hidden="true" tabindex="-1"></a> <span class="at">V =</span> <span class="fu">as.vector</span>(<span class="fu">t</span>(z_p.idw05<span class="sc">$</span>v)), <span class="at">Power =</span> <span class="st">&quot;P05&quot;</span>)</span>
<span id="cb698-3"><a href="spatially-continuous-data-i.html#cb698-3" aria-hidden="true" tabindex="-1"></a>z_p.idw1.df <span class="ot">&lt;-</span> <span class="fu">data.frame</span>(<span class="fu">expand.grid</span>(<span class="at">X=</span> z_p.idw1<span class="sc">$</span>xcol, <span class="at">Y =</span> z_p.idw1<span class="sc">$</span>yrow),</span>
<span id="cb698-4"><a href="spatially-continuous-data-i.html#cb698-4" aria-hidden="true" tabindex="-1"></a> <span class="at">V =</span> <span class="fu">as.vector</span>(<span class="fu">t</span>(z_p.idw1<span class="sc">$</span>v)), <span class="at">Power =</span> <span class="st">&quot;P1&quot;</span>)</span>
<span id="cb698-5"><a href="spatially-continuous-data-i.html#cb698-5" aria-hidden="true" tabindex="-1"></a>z_p.idw2.df <span class="ot">&lt;-</span> <span class="fu">data.frame</span>(<span class="fu">expand.grid</span>(<span class="at">X=</span> z_p.idw2<span class="sc">$</span>xcol, <span class="at">Y =</span> z_p.idw2<span class="sc">$</span>yrow),</span>
<span id="cb698-6"><a href="spatially-continuous-data-i.html#cb698-6" aria-hidden="true" tabindex="-1"></a> <span class="at">V =</span> <span class="fu">as.vector</span>(<span class="fu">t</span>(z_p.idw2<span class="sc">$</span>v)), <span class="at">Power =</span> <span class="st">&quot;P2&quot;</span>)</span>
<span id="cb698-7"><a href="spatially-continuous-data-i.html#cb698-7" aria-hidden="true" tabindex="-1"></a>z_p.idw5.df <span class="ot">&lt;-</span> <span class="fu">data.frame</span>(<span class="fu">expand.grid</span>(<span class="at">X=</span> z_p.idw5<span class="sc">$</span>xcol, <span class="at">Y =</span> z_p.idw5<span class="sc">$</span>yrow),</span>
<span id="cb698-8"><a href="spatially-continuous-data-i.html#cb698-8" aria-hidden="true" tabindex="-1"></a> <span class="at">V =</span> <span class="fu">as.vector</span>(<span class="fu">t</span>(z_p.idw5<span class="sc">$</span>v)), <span class="at">Power =</span> <span class="st">&quot;P5&quot;</span>)</span>
<span id="cb698-9"><a href="spatially-continuous-data-i.html#cb698-9" aria-hidden="true" tabindex="-1"></a>idw_df <span class="ot">&lt;-</span> <span class="fu">rbind</span>(z_p.idw05.df, z_p.idw1.df, z_p.idw2.df, z_p.idw5.df)</span></code></pre></div>
<p>We can now plot using the <code>facet_wrap</code> function to compare the results side by side:</p>
<div class="sourceCode" id="cb699"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb699-1"><a href="spatially-continuous-data-i.html#cb699-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>(<span class="at">data =</span> idw_df, <span class="fu">aes</span>(<span class="at">x =</span> X, <span class="at">y =</span> Y, <span class="at">fill =</span> V)) <span class="sc">+</span> </span>
<span id="cb699-2"><a href="spatially-continuous-data-i.html#cb699-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_tile</span>() <span class="sc">+</span></span>
<span id="cb699-3"><a href="spatially-continuous-data-i.html#cb699-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_distiller</span>(<span class="at">palette =</span> <span class="st">&quot;OrRd&quot;</span>, <span class="at">direction =</span> <span class="dv">1</span>) <span class="sc">+</span></span>
<span id="cb699-4"><a href="spatially-continuous-data-i.html#cb699-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_equal</span>() <span class="sc">+</span> </span>
<span id="cb699-5"><a href="spatially-continuous-data-i.html#cb699-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">facet_wrap</span>(<span class="sc">~</span> Power, <span class="at">ncol =</span> <span class="dv">2</span>)</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-491-1.png" width="672" /></p>
<p>Notice how smaller values of <span class="math inline">\(\gamma\)</span> “flatten” the predictions, in the extreme tending towards to global average, as all observations are weighted equally. Larger values, on the other hand, tend to be the average of a single point, the closest one. In fact, this replicates the Voronoi polygons, as seen in the following plot that combines the Voronoi polygons (without filling!) and the predictions from the IDW algorithm with <span class="math inline">\(\gamma = 5\)</span>:</p>
<div class="sourceCode" id="cb700"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb700-1"><a href="spatially-continuous-data-i.html#cb700-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb700-2"><a href="spatially-continuous-data-i.html#cb700-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_tile</span>(<span class="at">data =</span> <span class="fu">subset</span>(idw_df, <span class="at">Power =</span> <span class="st">&quot;P5&quot;</span>), <span class="fu">aes</span>(<span class="at">x =</span> X, <span class="at">y =</span> Y, <span class="at">fill =</span> V)) <span class="sc">+</span></span>
<span id="cb700-3"><a href="spatially-continuous-data-i.html#cb700-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">data =</span> Walker_Lake.v, </span>
<span id="cb700-4"><a href="spatially-continuous-data-i.html#cb700-4" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> <span class="st">&quot;white&quot;</span>, <span class="at">fill =</span> <span class="cn">NA</span>) <span class="sc">+</span></span>
<span id="cb700-5"><a href="spatially-continuous-data-i.html#cb700-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_distiller</span>(<span class="at">palette =</span> <span class="st">&quot;OrRd&quot;</span>, <span class="at">direction =</span> <span class="dv">1</span>)</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-492-1.png" width="672" /></p>
<p>Clearly, selection of a value for <span class="math inline">\(\gamma\)</span> is an important modeling decision when using IDW.</p>
</div>
<div id="k-point-means" class="section level2" number="31.8">
<h2><span class="header-section-number">31.8</span> <span class="math inline">\(k\)</span>-point means</h2>
<p>Another interpolation technique that is based on the idea of moving averages is <span class="math inline">\(k\)</span>-point means. Again, this will look familiar to you, because it is also formally identical to the spatial moving average:
<span class="math display">\[
\hat{z}_p = \frac{\sum_{i=1}^n{w_{pi}z_i}}{\sum_{i=1}^n{w_{pi}}}
\]</span></p>
<p>The spatial weights in this case, however, are defined in terms of <span class="math inline">\(k\)</span>-nearest neighbors:
<span class="math display">\[
w_{pi} = \bigg\{\begin{array}{ll}
1 &amp; \text{if } i \text{ is one of } k \text{th nearest neighbors of } p \text{ for a given }k \\
0 &amp; otherwise \\
\end{array}
\]</span></p>
<p>Clearly, the above becomes:
<span class="math display">\[
\hat{z}_p = \sum_{i=1}^n {w_{pi}^{st}z_i}
\]</span></p>
<p>If row-standardized spatial weights are used.</p>
<p>We can calculate <span class="math inline">\(k\)</span>-point means using the example. For this, we need to define a set of “target” coordinates, that is, the points where we wish to interpolate. In addition, we create a matrix with the coordinates of the “source” points, the observations used for interpolation:</p>
<div class="sourceCode" id="cb701"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb701-1"><a href="spatially-continuous-data-i.html#cb701-1" aria-hidden="true" tabindex="-1"></a>target_xy <span class="ot">=</span> <span class="fu">expand.grid</span>(<span class="at">x =</span> <span class="fu">seq</span>(<span class="fl">0.5</span>, <span class="fl">259.5</span>, <span class="fl">2.2</span>), <span class="at">y =</span> <span class="fu">seq</span>(<span class="fl">0.5</span>, <span class="fl">299.5</span>, <span class="fl">2.2</span>))</span>
<span id="cb701-2"><a href="spatially-continuous-data-i.html#cb701-2" aria-hidden="true" tabindex="-1"></a>source_xy <span class="ot">=</span> <span class="fu">cbind</span>(<span class="at">x =</span> Walker_Lake<span class="sc">$</span>X, <span class="at">y =</span> Walker_Lake<span class="sc">$</span>Y) <span class="co">#Combines columns or rows of matrix data</span></span></code></pre></div>
<p>The value (output) of the function is a dataframe with the coordinates of the target points, as well as estimated values of <span class="math inline">\(\hat{z_p}\)</span> at those points. Using the three nearest neighbors:</p>
<div class="sourceCode" id="cb702"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb702-1"><a href="spatially-continuous-data-i.html#cb702-1" aria-hidden="true" tabindex="-1"></a>kpoint<span class="fl">.3</span> <span class="ot">&lt;-</span> <span class="fu">kpointmean</span>(<span class="at">source_xy =</span> source_xy, <span class="at">z =</span> Walker_Lake<span class="sc">$</span>V, <span class="at">target_xy =</span> target_xy, <span class="at">k =</span><span class="dv">3</span>) <span class="sc">%&gt;%</span> </span>
<span id="cb702-2"><a href="spatially-continuous-data-i.html#cb702-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">rename</span>(<span class="at">X=</span>x, <span class="at">Y=</span>y, <span class="at">V=</span>z)</span></code></pre></div>
<p>We can plot the interpolated field now:</p>
<div class="sourceCode" id="cb703"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb703-1"><a href="spatially-continuous-data-i.html#cb703-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>() <span class="sc">+</span></span>
<span id="cb703-2"><a href="spatially-continuous-data-i.html#cb703-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_tile</span>(<span class="at">data =</span> kpoint<span class="fl">.3</span>, <span class="fu">aes</span>(<span class="at">x =</span> X, <span class="at">y =</span> Y, <span class="at">fill =</span> V)) <span class="sc">+</span></span>
<span id="cb703-3"><a href="spatially-continuous-data-i.html#cb703-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_distiller</span>(<span class="at">palette =</span> <span class="st">&quot;OrRd&quot;</span>, <span class="at">direction =</span> <span class="dv">1</span>) <span class="sc">+</span></span>
<span id="cb703-4"><a href="spatially-continuous-data-i.html#cb703-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">coord_equal</span>()</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-495-1.png" width="672" /></p>
<p>As with other spatially moving averages, the crucial aspect of implementing <span class="math inline">\(k\)</span>-point means is the selection of <span class="math inline">\(k\)</span>. A large value will tend towards the global average, whereas a value of 1 will tend to replicate the Voronoi polygons (see below):</p>
<div class="sourceCode" id="cb704"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb704-1"><a href="spatially-continuous-data-i.html#cb704-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Calculate k-point means using only one point. Rename the variables to match </span></span>
<span id="cb704-2"><a href="spatially-continuous-data-i.html#cb704-2" aria-hidden="true" tabindex="-1"></a>kpoint<span class="fl">.1</span> <span class="ot">&lt;-</span> <span class="fu">kpointmean</span>(<span class="at">source_xy =</span> source_xy, <span class="at">z =</span> Walker_Lake<span class="sc">$</span>V, <span class="at">target_xy =</span> target_xy, <span class="at">k =</span> <span class="dv">1</span>) <span class="sc">%&gt;%</span> </span>
<span id="cb704-3"><a href="spatially-continuous-data-i.html#cb704-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">rename</span>(<span class="at">X=</span>x, <span class="at">Y=</span>y, <span class="at">V=</span>z)</span></code></pre></div>
<p>This is the plot with the Voronoi polygons:</p>
<div class="sourceCode" id="cb705"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb705-1"><a href="spatially-continuous-data-i.html#cb705-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot and overlay the Voronoi polygons</span></span>
<span id="cb705-2"><a href="spatially-continuous-data-i.html#cb705-2" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>() <span class="sc">+</span> </span>
<span id="cb705-3"><a href="spatially-continuous-data-i.html#cb705-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_tile</span>(<span class="at">data =</span> kpoint<span class="fl">.1</span>, <span class="fu">aes</span>(<span class="at">x =</span> X, <span class="at">y =</span> Y, <span class="at">fill =</span> V)) <span class="sc">+</span></span>
<span id="cb705-4"><a href="spatially-continuous-data-i.html#cb705-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>(<span class="at">data =</span> Walker_Lake.v, </span>
<span id="cb705-5"><a href="spatially-continuous-data-i.html#cb705-5" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> <span class="st">&quot;white&quot;</span>, <span class="at">fill =</span> <span class="cn">NA</span>) <span class="sc">+</span></span>
<span id="cb705-6"><a href="spatially-continuous-data-i.html#cb705-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_fill_distiller</span>(<span class="at">palette =</span> <span class="st">&quot;OrRd&quot;</span>, <span class="at">direction =</span> <span class="dv">1</span>)</span></code></pre></div>
<p><img src="spatial-analysis-R_files/figure-html/unnamed-chunk-497-1.png" width="672" /></p>
<p>This shows that Voronoi polygons can be seen as a special case of IDW or <span class="math inline">\(k\)</span>-point means depending on the way these two techniques are implemented.</p>
</div>
</div>
<h3>References</h3>
<div id="refs" class="references csl-bib-body hanging-indent">
<div id="ref-Bailey1995" class="csl-entry">
Bailey, T. C., and A. C. Gatrell. 1995. <em>Interactive Spatial Data Analysis</em>. Book. Essex: Addison Wesley Longman.
</div>
<div id="ref-Bivand2008" class="csl-entry">
Bivand, R. S., E. J. Pebesma, and V. Gómez-Rubio. 2008. <em>Applied Spatial Data Analysis with r</em>. Book. New York: Springer Science+Business Media.
</div>
<div id="ref-Brunsdon2015R" class="csl-entry">
Brunsdon, Chris, and Lex Comber. 2015. <em>An Introduction to r for Spatial Analysis and Mapping</em>. Book. Sage.
</div>
<div id="ref-Isaaks1989applied" class="csl-entry">
Isaaks, E. H., and R. M. Srivastava. 1989. <em>Applied Geostatistics</em>. Book. New York: Oxford University Press.
</div>
<div id="ref-Osullivan2010" class="csl-entry">
O’Sullivan, David, and David Unwin. 2010. <em>Geographic Information Analysis</em>. Book. 2nd. Edition. Hoboken, New Jersey: John Wiley &amp; Sons.
</div>
</div>
</section>
</div>
</div>
</div>
<a href="activity-14-area-data-vi.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="activity-15-spatially-continuous-data-i.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": false,
"facebook": true,
"twitter": true,
"linkedin": false,
"weibo": false,
"instapaper": false,
"vk": false,
"whatsapp": false,
"all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": "https://github.com/paezha/spatial-analysis-R/edit/main/31-Spatially-Continuous-Data-I.Rmd",
"text": "Edit"
},
"history": {
"link": null,
"text": null
},
"view": {
"link": null,
"text": null
},
"download": ["spatial-analysis-R.pdf", "spatial-analysis-R.epub"],
"search": {
"engine": "fuse",
"options": null
},
"toc": {
"collapse": "subsection"
}
});
});
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
var src = "true";
if (src === "" || src === "true") src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML";
if (location.protocol !== "file:")
if (/^https?:/.test(src))
src = src.replace(/^https?:/, '');
script.src = src;
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tidyfriday/spatial-analysis-r.git
git@gitee.com:tidyfriday/spatial-analysis-r.git
tidyfriday
spatial-analysis-r
spatial-analysis-r
gh-pages

搜索帮助