Pages

Saturday, November 22, 2008

Spatial Statistics. Part I.

Spatial Statistics. Part I.

Ripley's K(r) function

Spatial statistics are becoming an important tool for population ecologists. These techniques allow researchers to answer questions regarding the spatial arrangements of individuals within a population and the causal factors that may be influencing spatial distributions. I will detail some basic spatial statistics using the spatstat library.
library(spatstat)
The first approach to a planar point pattern (ppp) is to describe the size of the plot, the number of individuals (i.e. points) and the density of such occurrences or instances. In spatial statistics density is usually referred to as intensity. We will be using the bei data-set included in the spatstat library. From the help page: «The dataset bei gives the positions of 3605 trees of the species Beilschmiedia pendula (Lauraceae) in a 1000 by 500 metre rectangular sampling region in the tropical rainforest of Barro Colorado Island.» The following code invokes the bei data-set and requests some summary statistics:
> data(bei) > summary(bei)
Planar point pattern: 3604 points Average intensity 0.00721 points per square metre Window: rectangle = [0, 1000] x [0, 500] metres Window area = 5e+05 square metres Unit of length: 1 metre
> plot(bei)
The previous results show a total of 3604 points in a 50 ha plot. The average intensity (i.e. density) is 0.00721 points per square meter or 72.1 trees per hectare. The position of the trees is shown in the following graph produced by the plot(bei) command:


The plot evidently shows that this species --B. pendula -- is located more commonly in certain areas of the plot, while absent in others. This suggests an aggregated spatial distribution, which is commonplace for tropical trees. To assess the spatial distribution of these points, we will use Ripley's K(r) function. This method, also known as Ripley's second moment reduced function, estimates the expected number of random points within a distance r of a randomly chosen point within a plot (Ripley 1976). Ripley's K(r) function is generally transformed as follows:
The L(r) function transforms the theoretically expected value for a random distribution into a horizontal line intersecting the P(0,0) point, thus it is more easily interpreted than the exponential K(r) function. Ripley's K(r) function is produced by the Kest() command in R. Given the large number of points in the bei data-set, calculations may take a while in computers with slow processors. The L(r) transformation is performed on-the-fly by the plot() command.
> a1 <- Kest(bei, correction="isotropic", nlarge=Inf) > plot(a1, sqrt(./pi)-r~r, ylab="L(r)")
The previous code request Ripley's K(r) function using the bie data-set. We specifically request the isotropic correction for edge effects. Spatstat's Kest() function has a restriction for data-sets larger than 3000 points. In order to circumvent this restriction we must include the nlarge=Inf option in the command. Results are stored in the a1 object.

Ripley's L(r) function is shown in the previous graph. The x-axis show the automatically selected radii (r) for which abundances are calculated, while the y-axis shows the L(r) function. The dotted red line is the expected value for a random distribution and the black solid line is the observed count. If observed values lie above the zero line (i.e. random expectation) one should suspect an aggregated distibution. Nevertheless, we need to assess if this deviation is large enough to reject the null hipothesis of a random spatial distribution or CSR (complete spatial randomness). To answer this question we need to create confidence intervals for the null hypothesis using the envelope() command. These calculations require a lot of computer resources given the large number of points in the bei data-set, therefore I reduced the number of simulations to 50 from the default nsim=99:
> sobre <- envelope(bei, Kest, nlarge=Inf, nsim=50)
Generating 50 simulations of CSR ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50.
Done. > sobre
Pointwise critical envelopes for K(r) Obtained from 50 simulations of simulations of CSR Significance level of pointwise Monte Carlo test: 2/51 = 0.0392156862745098 Data: bei Function value object (class 'fv') for the function r -> K(r) Entries: id     label     description --      -----     ----------- r      r      distance argument r obs      obs(r)      function value for data pattern theo      theo(r)      theoretical value for CSR lo      lo(r)      lower pointwise envelope of simulations hi      hi(r)      upper pointwise envelope of simulations -------------------------------------- Default plot formula: . ~ r Recommended range of argument r: [0, 125] Unit of length: 1 metre
> plot(sobre, sqrt(./pi)-r~r, lty=c(1,2,3,3), col=c(1,2,3,3), ylab="L(t)")
The resulting graph is as follows:

Given that the observed count (black solid line) is above the confidence interval (green doted lines) we can conclude that the spatial distribution of B. pendula trees significantly deviates from random expectations.

Conclusion

As expected for a tropical tree (Condit, 2000), Ripley's K(t) shows that B. pendula is spatially aggregated. References:
Condit R, Ashton PS, Baker P, Bunyavejchewin S, Gunatilleke S, Gunatilleke N, Hubbell SP, Foster RB, Itoh A, LaFrankie JV, Lee HS, Losos E, Manokaran N, Sukumar R, Yamakura T (2000) Spatial patterns in the distribution of tropical tree species. Science 288:1414―1418.
Ripley BD (1976) The second-order analysis of stationary point processes. Journal of Applied Probability 13:255-256.
Ripley BD (1977) Modeling spatial patterns. Journal of the Royal Statistical Society, B. 39:172-212.

16 comments:

  1. Making Money: How to Make Money at Slots with Bitcoin
    to make money playing slots หาเงินออนไลน์ online of the best options to make money is to deccasino take advantage of all of the available 바카라 사이트 bonuses in our guide below.

    ReplyDelete
  2. If your coinbase account restricted, it could be due to various reasons, such as unusual account activity, failure to complete verification, or violating Coinbase's terms of service. To resolve this issue, log into your account and check for any notifications or requests for additional information. Completing any pending verifications or updating your information might help restore access. If the issue persists, contact Coinbase support for assistance. They can guide you through the necessary steps to lift the restriction and regain full access to your account.

    ReplyDelete
  3. You'll first need to link a common bank account to both apps to transfer money from Venmo to Cash App. Transfer the desired amount from your Venmo balance to your linked bank account. Once the funds appear in your bank account, you can then transfer them from the bank to your Cash App balance. This process typically takes one to three business days for each transfer. While there isn't a direct way to transfer money between Venmo and Cash App, a linked bank account provides an efficient workaround.

    ReplyDelete
  4. To recover your MyEtherWallet (MEW) account, you must use your private key, recovery phrase, or Keystore file. If you have these, visit the MEW website, select "Access My Wallet," and follow the prompts. These recovery details are necessary for access to be recovered, as MEW cannot restore accounts for security reasons. Always store your recovery information securely.

    ReplyDelete
  5. To Transfer Money From Crypto.com To Bank Account, first, sell your crypto for fiat in the app. Then, go to the "Transfer" option, select "Withdraw," choose "Fiat," and pick your bank account. Enter the amount to transfer and confirm. The funds should arrive in your bank within 3-5 business days.

    ReplyDelete
  6. If your coinbase balance not showing, first check if the app or website is up to date. Ensure you're connected to the internet and try refreshing the page or restarting the app. If the problem persists, clear your browser cache or app data. You can also check Coinbase's status page for outages or contact their support for further assistance.

    ReplyDelete
  7. If you're experiencing a "No Connection" coinomi no connection, it typically indicates a problem with your internet or the app's servers. To resolve this, ensure you have a stable internet connection and try restarting the app. If the problem persists, check for app updates or visit Coinomi's support page for further assistance.

    ReplyDelete
  8. To Withdraw Money from Crypto DeFi Wallet, connect the wallet to a compatible decentralized exchange (DEX). Select the cryptocurrency you wish to convert to fiat, execute the swap, and transfer the converted funds to a centralized exchange. From there, you can withdraw the money to your bank account. Always double-check wallet addresses to avoid errors.

    ReplyDelete
  9. If your Coinbase Account Under Review, it may be due to suspicious activity, verification issues, or security concerns. During this period, account access might be limited. To resolve the issue, check your email for instructions from Coinbase, and provide any requested information. Contact Coinbase support for further assistance, and ensure your account details are up to date.

    ReplyDelete
  10. If your coinbase balance not showing, it could be due to a temporary glitch, account synchronization issues, or an update delay. Ensure you're using the latest app version and try refreshing the page or logging out and back in. If the problem persists, contact Coinbase support for further assistance to resolve the issue and access your funds.

    ReplyDelete
  11. If your Coinomi wallet is experiencing a "coinomi no connection" issue, ensure your internet connection is stable and try restarting the app. Clear the app's cache, update to the latest version, or check if the Coinomi server is down. If the problem persists, consider switching networks or reinstalling the app for a fresh start.

    ReplyDelete
  12. To Transfer Money From Crypto.com To Bank Account, first, sell your cryptocurrency for fiat currency within the app. Once the funds are in your fiat wallet, select the "Withdraw" option and choose your linked bank account. Enter the amount you'd like to transfer, confirm the details, and submit the request. The transfer process typically takes 2-5 business days, depending on your bank’s processing times.

    ReplyDelete
  13. If your Coinbase Account Under Review, it typically means the platform is conducting a routine check to ensure compliance with its security policies. Unusual activity or verification requirements can trigger reviews. During this period, certain account functions may be temporarily restricted. Contact Coinbase support for more information or wait for the review process to be completed.

    ReplyDelete
  14. If your coinbase balance not showing, it could be due to a temporary glitch or an issue with account synchronization. Ensure that your app or browser is updated, and try refreshing your account. If the problem persists, contact Coinbase support to investigate the issue and restore your balance visibility quickly.

    ReplyDelete
  15. To Fix Internal JSON-RPC Error in Metamask first try clearing your browser's cache or the app’s cache if you're using the mobile version. Ensure MetaMask and your browser are updated to the latest versions. If the issue persists, switch networks or reset your MetaMask account under settings. This won’t affect your funds but may resolve the error.

    ReplyDelete
  16. To Withdraw Money from Crypto DeFi Wallet, first, connect the wallet to a centralized exchange that supports your cryptocurrency. Transfer the desired amount from your DeFi wallet to the exchange, where you can sell your crypto for fiat currency. Once sold, initiate a withdrawal to your linked bank account. Always double-check transaction details to avoid errors.

    ReplyDelete