<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content="Given two continuous numeric variables, calculate the bivariate Local Moran's I."><title>Compute the Local Bivariate Moran's I Statistic — local_moran_bv • sfdep</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/Noto_Sans_Display-0.4.8/font.css" rel="stylesheet"><link href="../deps/Noto_Sans_Mono-0.4.8/font.css" rel="stylesheet"><link href="../deps/Merriweather-0.4.8/font.css" rel="stylesheet"><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@v1.0.1/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Compute the Local Bivariate Moran's I Statistic — local_moran_bv"><meta property="og:description" content="Given two continuous numeric variables, calculate the bivariate Local Moran's I."><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
    

    <nav class="navbar fixed-top navbar-light navbar-expand-lg bg-light"><div class="container">
    
    <a class="navbar-brand me-2" href="../index.html">sfdep</a>

    <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">0.2.4</small>

    
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div id="navbar" class="collapse navbar-collapse ms-3">
      <ul class="navbar-nav me-auto"><li class="active nav-item">
  <a class="nav-link" href="../reference/index.html">Reference</a>
</li>
<li class="nav-item dropdown">
  <a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-vignettes">Vignettes</a>
  <div class="dropdown-menu" aria-labelledby="dropdown-vignettes">
    <a class="dropdown-item" href="../articles/basics-of-sfdep.html">Basics of sfdep</a>
    <a class="dropdown-item" href="../articles/spacetime-s3.html">spacetime and spacetime cubes</a>
    <a class="dropdown-item" href="../articles/colocation-analysis.html">Colocation Quotients</a>
    <a class="dropdown-item" href="../articles/conditional-permutation.html">Conditional permutation</a>
    <a class="dropdown-item" href="../articles/understanding-emerging-hotspots.html">Emerging Hot Spot Analysis</a>
  </div>
</li>
<li class="nav-item">
  <a class="nav-link" href="../news/index.html">Changelog</a>
</li>
<li class="nav-item dropdown">
  <a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-releases">Releases</a>
  <div class="dropdown-menu" aria-labelledby="dropdown-releases">
    <a class="dropdown-item" href="../articles/Version-0-2-0.html">Version 0.2.0</a>
  </div>
</li>
      </ul><form class="form-inline my-2 my-lg-0" role="search">
        <input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off"></form>

      <ul class="navbar-nav"><li class="nav-item">
  <a class="external-link nav-link" href="https://github.com/josiahparry/sfdep/" aria-label="github">
    <span class="fab fa fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul></div>

    
  </div>
</nav><div class="container template-reference-topic">
<div class="row">
  <main id="main" class="col-md-9"><div class="page-header">
      <img src="" class="logo" alt=""><h1>Compute the Local Bivariate Moran's I Statistic</h1>
      <small class="dont-index">Source: <a href="https://github.com/josiahparry/sfdep/blob/HEAD/R/local-moran-bv-impl.R" class="external-link"><code>R/local-moran-bv-impl.R</code></a></small>
      <div class="d-none name"><code>local_moran_bv.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Given two continuous numeric variables, calculate the bivariate Local Moran's I.</p>
    </div>

    <div class="section level2">
    <h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">local_moran_bv</span><span class="op">(</span><span class="va">x</span>, <span class="va">y</span>, <span class="va">nb</span>, <span class="va">wt</span>, nsim <span class="op">=</span> <span class="fl">499</span><span class="op">)</span></span></code></pre></div>
    </div>

    <div class="section level2">
    <h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
    <dl><dt>x</dt>
<dd><p>a numeric vector of same length as <code>y</code>.</p></dd>


<dt>y</dt>
<dd><p>a numeric vector of same length as <code>x</code>.</p></dd>


<dt>nb</dt>
<dd><p>a neighbor list object for example as created by <code><a href="st_contiguity.html">st_contiguity()</a></code>.</p></dd>


<dt>wt</dt>
<dd><p>a weights list as created by <code><a href="st_weights.html">st_weights()</a></code>.</p></dd>


<dt>nsim</dt>
<dd><p>the number of simulations to run.</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
    

<p>a <code>data.frame</code> containing two columns <code>Ib</code> and <code>p_sim</code> containing the local bivariate Moran's I and simulated p-values respectively.</p>
    </div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>The Bivariate Local Moran, like its global counterpart, evaluates the value
of x at observation i with its spatial neighbors' value of y. The value of $$I_i^B$$ is just xi * Wyi. Or, in simpler words the local bivariate Moran is the result of multiplying x by the spatial lag of y. Formally it is defined as</p>
<p>\(
I_i^B= cx_i\Sigma_j{w_{ij}y_j}
\)</p>
    </div>
    <div class="section level2">
    <h2 id="references">References<a class="anchor" aria-label="anchor" href="#references"></a></h2>
    <p><a href="https://geodacenter.github.io/workbook/6c_local_multi/lab6c.html#principle" class="external-link">Local Spatial Autocorrelation (3): Multivariate Local Spatial Autocorrelation, Luc Anselin</a></p>
    </div>
    <div class="section level2">
    <h2 id="see-also">See also<a class="anchor" aria-label="anchor" href="#see-also"></a></h2>
    <div class="dont-index"><p>Other global_moran: 
<code><a href="global_moran.html">global_moran</a>()</code>,
<code><a href="global_moran_bv.html">global_moran_bv</a>()</code>,
<code><a href="global_moran_perm.html">global_moran_perm</a>()</code>,
<code><a href="global_moran_test.html">global_moran_test</a>()</code></p></div>
    </div>

    <div class="section level2">
    <h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="va">x</span> <span class="op">&lt;-</span> <span class="va">guerry_nb</span><span class="op">$</span><span class="va">crime_pers</span></span></span>
<span class="r-in"><span><span class="va">y</span> <span class="op">&lt;-</span> <span class="va">guerry_nb</span><span class="op">$</span><span class="va">wealth</span></span></span>
<span class="r-in"><span><span class="va">nb</span> <span class="op">&lt;-</span> <span class="va">guerry_nb</span><span class="op">$</span><span class="va">nb</span></span></span>
<span class="r-in"><span><span class="va">wt</span> <span class="op">&lt;-</span> <span class="va">guerry_nb</span><span class="op">$</span><span class="va">wt</span></span></span>
<span class="r-in"><span><span class="fu">local_moran_bv</span><span class="op">(</span><span class="va">x</span>, <span class="va">y</span>, <span class="va">nb</span>, <span class="va">wt</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>              Ib p_sim</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1   0.093506129 0.416</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2  -0.840144689 0.002</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3   0.293390275 0.228</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4  -0.782969282 0.034</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5  -0.343051282 0.026</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6  -0.751763780 0.058</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7  -1.212286959 0.168</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8   0.494768137 0.346</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9   0.050875987 0.012</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10 -0.033508122 0.404</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 11  0.119135965 0.398</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 12 -0.027058053 0.482</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 13  0.189608296 0.120</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 14 -0.184931534 0.034</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 15  0.186274796 0.260</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 16 -0.042411941 0.302</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 17  0.006353979 0.488</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 18 -0.408271216 0.050</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 19 -0.115344980 0.440</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 20  0.130059701 0.444</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 21  1.683274652 0.036</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 22 -0.003842500 0.486</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 23 -1.004957821 0.122</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 24 -1.104136137 0.000</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 25  0.857180921 0.002</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 26 -0.169492824 0.004</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 27  0.834090623 0.186</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 28 -0.171464343 0.318</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 29 -0.034233828 0.348</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 30 -0.051026184 0.232</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 31 -0.046850788 0.440</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 32  0.334455413 0.270</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 33  0.080264717 0.242</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 34  0.685071940 0.178</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 35  0.001704856 0.498</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 36 -0.079714992 0.102</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 37  0.137434262 0.356</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 38  0.125025064 0.192</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 39 -0.068341930 0.192</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 40  0.504579881 0.096</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 41 -0.319036396 0.070</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 42 -0.016497540 0.352</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 43  0.225196989 0.026</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 44 -0.224572220 0.368</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 45 -0.003990683 0.442</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 46 -1.017640129 0.084</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 47  0.367618246 0.200</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 48 -0.550574797 0.248</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 49  0.441828404 0.032</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 50 -0.088146734 0.398</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 51 -0.190742450 0.336</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 52  0.537482661 0.112</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 53 -0.039104825 0.414</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 54  0.305236945 0.072</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 55 -0.337570608 0.330</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 56 -0.155974076 0.264</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 57 -0.526846963 0.182</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 58 -1.393680416 0.000</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 59 -0.832978265 0.024</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 60 -0.326847547 0.152</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 61 -0.269459435 0.038</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 62 -0.443421284 0.028</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 63 -0.158620813 0.392</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 64 -0.066683215 0.480</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 65 -0.790102037 0.074</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 66 -1.406140486 0.156</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 67 -0.058461082 0.228</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 68 -0.004884983 0.488</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 69 -0.125083947 0.342</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 70 -1.236566942 0.044</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 71  1.282709560 0.004</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 72  0.218277696 0.040</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 73 -0.366089264 0.000</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 74  1.371117985 0.002</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 75 -0.075151611 0.206</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 76 -1.560168225 0.024</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 77  0.658190968 0.078</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 78  0.246687028 0.236</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 79 -0.139720645 0.412</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 80 -0.206370145 0.294</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 81 -0.003905568 0.460</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 82 -0.205045471 0.178</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 83 -0.534172545 0.004</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 84 -0.046631364 0.216</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 85  0.279224938 0.008</span>
</code></pre></div>
    </div>
  </main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
    </nav></aside></div>


    <footer><div class="pkgdown-footer-left">
  <p></p><p>Developed by Josiah Parry, Dexter H Locke.</p>
</div>

<div class="pkgdown-footer-right">
  <p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>

    </footer></div>

  

  

  </body></html>

