Movatterモバイル変換


[0]ホーム

URL:


spqdata

spqdata

R-CMD-check [CRAN status [CRAN downloads-last-month [CRAN downloads-grand-totalLifecycle: stable

The goal of spqdep is to provide tools for the analysis of spatialqualitative data.

Installation

You can install the released version of spqdata fromCRAN with:

#install.packages("spqdata")

And the development version fromGitHub with:

# install.packages("devtools")#devtools::install_github("f8l5h9/spqdata")

Abstract

Qualitative spatial variables are important in many fields ofresearch. However, unlike the decades-worth of research devoted to thespatial association of quantitative variables, the exploratory analysisof spatial qualitative variables is relatively less developed. Theobjective of the present paper is to present a new R-package to test forspatial dependence in categorical spatial data. Several tests have beenproposed, namely, the classical joint count statistics, the Q-test basedon symbolic dynamics, the Scan-test based on scan methodology and a newspatial test based on spatial-runs. All tests can be applied tocategorical spatial cross-section data with two or more categories andasymptotic and bootstrap permutation distribution are implemented. The Rpackage is completely documented, including several examples and anuser-guide is available as a vignette. The package spqdep is availablein CRAN and is ideal for research and teaching activities.

Example

This is a basic example which shows you how to solve a commonproblem

library(spqdep)N<-200set.seed(1234)cx<-runif(N)cy<-runif(N)listw<- spdep::knearneigh(cbind(cx,cy),k =10)p<-c(1/3,2/3)rho<-0.9control<-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)
#> #>  Scan test. Distribution: bernoulli#> #> data:  fx#> scan-loglik = 12.727, p-value < 2.2e-16#> alternative hypothesis: High#> sample estimates:#>                                         #> Total observations in the MLC =    21.00#> Expected cases in the MLC =       103.85#> Observed cases in the MLC =        17.00
summary(scan)
#> #> Summary of data:#> Distribution....................: bernoulli#> Type of cluster (alternative)...: High#> Number of locations.............: 200#> Cathegory case..................: A#> Total number of observations....: 67#> Names of cathegories............: A B#> Total per category..............: 67 133#> Percent per category............: 0.34 0.66#> ---------------------------------#> #> Scan statistic: Most Likely Cluster#> Total observations in the MLC........: 21#> Names of cathegories.................: A B#> Percent per category total...........: 0.34 0.66#> Percent per category inside cluster..: 0.81 0.19#> Value of statisitic (loglik ratio)...: 12.7268#> p-value..............................: 0#> #> IDs of cluster detect:#> Location IDs included...:  110 112 1 193 165 95 89 91 59 35 85 78 37 51 152 19 83 32 30 133 105#> ---------------------------------#> #> #> Secondary Cluster. Number 1 #> Total observations in secondary cluster.:  5 #> Names of cathegories.................: A B#> Percent per category total...........: 0.34 0.66#> Percent per category inside cluster..: 0 1#> Value of statisitic (loglik ratio)...: 4.4561#> p-value..............................: 0.75#> Location IDs included................:  62 69 75 186 98#> #> #> Secondary Cluster. Number 2 #> Total observations in secondary cluster.:  4 #> Names of cathegories.................: A B#> Percent per category total...........: 0.34 0.66#> Percent per category inside cluster..: 0 1#> Value of statisitic (loglik ratio)...: 3.3265#> p-value..............................: 0.975#> Location IDs included................:  116 124 117 185#> #> #> Secondary Cluster. Number 3 #> Total observations in secondary cluster.:  6 #> Names of cathegories.................: A B#> Percent per category total...........: 0.34 0.66#> Percent per category inside cluster..: 0.17 0.83#> Value of statisitic (loglik ratio)...: 2.343#> p-value..............................: 0.995#> Location IDs included................:  38 164 43 8 88 79#> #> #> Secondary Cluster. Number 4 #> Total observations in secondary cluster.:  6 #> Names of cathegories.................: A B#> Percent per category total...........: 0.34 0.66#> Percent per category inside cluster..: 0.67 0.33#> Value of statisitic (loglik ratio)...: 2.343#> p-value..............................: 0.995#> Location IDs included................:  44 191 70 160 11 84#> #> #> Secondary Cluster. Number 5 #> Total observations in secondary cluster.:  6 #> Names of cathegories.................: A B#> Percent per category total...........: 0.34 0.66#> Percent per category inside cluster..: 0.67 0.33#> Value of statisitic (loglik ratio)...: 2.343#> p-value..............................: 0.995#> Location IDs included................:  129 177 162 56 31 77
plot(scan)


[8]ページ先頭

©2009-2025 Movatter.jp