# Stratification

### Description

Methods for partitioning a spatial object into compact strata by means of *k*-means. The objective function to minimize is the mean squared shortest distance (MSSD). Optionally, the strata may be forced to be of equal size. This facilitates field work in case of stratified simple random sampling for composites. Another option is spatial infill sampling, a variant of spatial coverage sampling where existing sampling points are taken into account. Use `nTry > 1`

, to reduce the risk of ending up in an unfavorable local optimum. Better results will generally be obtained by increasing the ratio `nGridCells/nStrata`

and by increasing `nTry`

.

### Usage

1 2 3 4 5 6 7 8 9 | ```
## S4 method for signature 'SpatialPixels'
stratify(object, nStrata, priorPoints = NULL, maxIterations = 1000, nTry = 1,
equalArea = FALSE, verbose = getOption("verbose"))
## S4 method for signature 'SpatialGrid'
stratify(object, nStrata, priorPoints = NULL, maxIterations = 1000, nTry = 1,
equalArea = FALSE, verbose = getOption("verbose"))
## S4 method for signature 'SpatialPolygons'
stratify(object, nStrata, priorPoints = NULL, maxIterations = 1000, nTry = 1,
nGridCells = 2500, cellSize, equalArea = FALSE, verbose = getOption("verbose"))
``` |

### Arguments

`object` |
an object of class |

`nStrata` |
number of strata ( |

`priorPoints` |
object of class |

`maxIterations` |
maximum number of iterations. |

`nTry` |
the |

`nGridCells` |
in case |

`cellSize` |
in case |

`equalArea` |
If |

`verbose` |
if |

### Methods

- object = "SpatialPixels"
Stratify a raster representation of the study area.

- object = "SpatialPolygons"
Stratify a vector representation of the study area.

### Note

The `stratify`

method may raise an error when the projection attributes (`"CRS"`

) have been set. A solution is to remove these attributes by calling the following function from the sp-package: `proj4string(myMap) <- NA_character_`

, where `myMap`

is the map to be stratified.

### References

Brus, D. J., Spatjens, L. E. E. M., and de Gruijter, J. J. (1999). A sampling scheme for estimating the mean extractable phosphorus concentration of fields for environmental regulation. Geoderma 89:129-148

de Gruijter, J. J., Brus, D. J., Bierkens, M. F. P., and Knotters, M. (2006) *Sampling for Natural Resource Monitoring* Berlin: Springer-Verlag.

Walvoort, D., Brus, D. and de Gruijter, J. (2009). Spatial Coverage Sampling on Various Spatial Scales. Pedometron 26:20-22

Walvoort, D. J. J., Brus, D. J. and de Gruijter, J. J. (2010). An R package for spatial coverage sampling and random sampling from compact geographical strata by *k*-means. Computers & Geosciences 36: 1261-1267 (http://dx.doi.org/10.1016/j.cageo.2010.04.005)

### See Also

`spsample`

for sampling, and `estimate`

for inference.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
# Note: the example below requires the 'rgdal'-package
# You may consider the 'maptools'-package as an alternative
if (require(rgdal)) {
# read a vector representation of the `Farmsum' field
shpFarmsum <- readOGR(
dsn = system.file("maps", package = "spcosa"),
layer = "farmsum"
)
# stratify `Farmsum' into 50 strata
# NB: increase argument 'nTry' to get better results
set.seed(314)
myStratification <- stratify(shpFarmsum, nStrata = 50, nTry = 1)
# plot the resulting stratification
plot(myStratification)
}
``` |