dgp.spq: Generation of qualitative process with spatial structure

Description Usage Arguments Details Value Control arguments Author(s) References See Also Examples

View source: R/dgp.spq.R

Description

The purpose of the function dgp.spq is to generate a random dataset with the dimensions and spatial structure decided by the user. This function may be useful in pure simulation experiments or with the aim of showing specific properties and characteristics of a spatial qualitative dataset ...

Usage

1
dgp.spq(listw = listw, p = p,  rho = rho, control = list())

Arguments

listw

A listw object of the class nb, knn, listw o matrix created for example by nb2listw from spatialreg package; if nb2listw not given, set to the same spatial weights as the listw argument. It can also be a spatial weighting matrix of order (NxN) instead of a listw object. Default = NULL.

p

a vector with the percentage of elements of each categories. The lengths must be the number of categories. The sum of the elements of vector must be 1.

rho

the level of spatial dependence (values between -1 y 1)

control

List of additional control arguments. See control argument section.

Details

Aquí Antonio escribe una linda historia ...

La forma de generar datos es la descrita en Páez et al. 2010 (pag 291)

$$ Y = (I- rho W)^-1 epsilon $$

where $epsilon$ = N(0,1) and where I is the N x N identity matrix, q is a parameter of spatial dependence, and W is a connectivity matrix that determines the set of spatial relationships among points. the continuous spatially autocorrelated variable Y is used to define a discrete spatial process as follows. Let $b_ij$ be defined by ...

Value

a factor of length N with levels the fist natural numbers.

Control arguments

seedinit

seed to generate the data sets

Author(s)

Fernando López fernando.lopez@upct.es
Román Mínguez roman.minguez@uclm.es
Antonio Páez paezha@gmail.com
Manuel Ruiz manuel.ruiz@upct.es

References

See Also

qtest, sp.runs.test, m_surr_no

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#
rm(list = ls())
N <- 10
cx <- runif(N)
cy <- runif(N)
coor <- cbind(cx,cy)
p <- c(1/6,3/6,2/6)
rho = 0.5
listw <- spdep::nb2listw(knn2nb(knearneigh(cbind(cx,cy), k = 4)))
xf <- dgp.spq(list = listw, p = p, rho = rho)

rm(list = ls())
data(Spain)
listw <- spdep::poly2nb(spain.sf, queen = FALSE)
p <- c(1/6,3/6,2/6)
rho = 0.9
xf <- dgp.spq(p = p, listw = listw, rho = rho)
spain.sf$xf <- xf
plot(spain.sf["xf"])

rominsal/spqdata documentation built on Jan. 24, 2021, 11:11 a.m.