-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
68 lines (53 loc) · 2.66 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: "spqdata"
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# spqdata
<!-- badges: start -->
[![R-CMD-check](https://github.com/f8l5h9/spqdep/workflows/R-CMD-check/badge.svg)](https://github.com/f8l5h9/spqdep/actions)
[![CRAN status](https://www.r-pkg.org/badges/version-ago/spqdep)
[![CRAN downloads-last-month](https://cranlogs.r-pkg.org/badges/last-month/spqdep)
[![CRAN downloads-grand-total](https://cranlogs.r-pkg.org/badges/grand-total/spqdep)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
<!-- badges: end -->
The goal of spqdep is to provide tools for the analysis of spatial qualitative data.
## Installation
You can install the released version of spqdata from [CRAN](https://CRAN.R-project.org) with:
``` r
#install.packages("spqdata")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
#devtools::install_github("f8l5h9/spqdata")
```
## Abstract
Qualitative spatial variables are important in many fields of research. However, unlike the decades-worth of research devoted to the spatial association of quantitative variables, the exploratory analysis of spatial qualitative variables is relatively less developed. The objective of the present paper is to present a new R-package to test for spatial dependence in categorical spatial data. Several tests have been proposed, namely, the classical joint count statistics, the Q-test based on symbolic dynamics, the Scan-test based on scan methodology and a new spatial test based on spatial-runs. All tests can be applied to categorical spatial cross-section data with two or more categories and asymptotic and bootstrap permutation distribution are implemented. The R package is completely documented, including several examples and an user-guide is available as a vignette. The package spqdep is available in CRAN and is ideal for research and teaching activities.
## Example
This is a basic example which shows you how to solve a common problem
```{r example, collapse = FALSE}
library(spqdep)
N <- 200
set.seed(1234)
cx <- runif(N)
cy <- runif(N)
listw <- spdep::knearneigh(cbind(cx,cy), k = 10)
p <- c(1/3,2/3)
rho <- 0.9
control <- list(seedinit = 1234)
fx <- dgp.spq(p = p, listw = listw, rho = rho,control = control)
scan <- scan.test(fx = fx, nsim = 199, case = "A", nv = 100, coor = cbind(cx,cy),
distr = "bernoulli", windows="elliptic")
print(scan)
summary(scan)
plot(scan)
```