R: Builds clusters with a given maximum size using a k-means...
build.clusters.spatial
R Documentation
Builds clusters with a given maximum size using a k-means clustering.
Description
Builds clusters from the spatial locations of sites using a k-means clustering,
to get a partition (of the sites) whose block sizes are at most 5 so that
the partition-composite likelihood for observations of a max-stable process at the sites
can be computed in a moderate time.
Usage
build.clusters.spatial(xy,max.size=5,plot=FALSE)
Arguments
xy
a matrix giving the coordinates of each location. Each row
corresponds to one location.
max.size
an integer giving the maximum size of the blocks of the
returned partition.
plot
Whether you also whant a plot or not.
Value
the return value is a vector of integers giving the index of the set
for each location.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(HiDimMaxStable)
Loading required package: copula
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HiDimMaxStable/build.clusters.spatial.Rd_%03d_medium.png", width=480, height=480)
> ### Name: build.clusters.spatial
> ### Title: Builds clusters with a given maximum size using a k-means
> ### clustering.
> ### Aliases: build.clusters.spatial
>
> ### ** Examples
>
> n.site<-10
> xy<-matrix(runif(2 * n.site, 0, 0.5), ncol = 2)
>
> param<-c(0.5,1.5)
> n.obs<-20
> library(SpatialExtremes)
Attaching package: 'SpatialExtremes'
The following object is masked from 'package:copula':
rcopula
> data<-t(rmaxstab(n.obs, xy, "whitmat",
+ nugget = 0, range = param[1], smooth = param[2]))
> cl<-build.clusters.spatial(xy)
> ## No test:
> d<-maxstable.l.clusters(data,clusters=cl,
+ params=param,
+ category="normal",
+ spatial=list(sites=xy,family=spatialWhittleMatern))
> ## End(No test)
>
>
>
>
>
> dev.off()
null device
1
>