make_kmeans: Calculate location for knots approximating spatial variation

View source: R/make_kmeans.R

make_kmeansR Documentation

Calculate location for knots approximating spatial variation

Description

make_kmeans determines the location for a set of knots for approximating spatial variation

Usage

make_kmeans(
  n_x,
  loc_orig,
  nstart = 100,
  randomseed = 1,
  iter.max = 1000,
  DirPath = getwd(),
  Save_Results = TRUE,
  kmeans_purpose = "spatial",
  backwards_compatible_kmeans = FALSE
)

Arguments

n_x

the number of knots to select

loc_orig

a matrix with two columns where each row gives the 2-dimensional coordinates to be approximated

nstart

the number of times that the k-means algorithm is run while searching for the best solution (default=100)

randomseed

a random number seed

iter.max

the number of iterations used per k-means algorithm (default=1000)

DirPath

a directory where the function looks for a previously-saved output (default is working directory)

Save_Results

a boolean stating whether to save the output (Default=TRUE)

kmeans_purpose

a character representing whether the call is to calculate "extrapolation" or "spatial" information

backwards_compatible_kmeans

a boolean stating how to deal with changes in the kmeans algorithm implemented in R version 3.6.0, where backwards_compatible_kmeans==TRUE modifies the default algorithm to maintain backwards compatibility, and where backwards_compatible_kmeans==FALSE breaks backwards compatibility between R versions prior to and after R 3.6.0.

Value

Tagged list containing outputs

centers

a matrix with 2 columns and n_x rows

cluster

A vector with length nrow(loc_orig) specifying which row of centers corresponds to each row of loc_orig


James-Thorson/FishStatsUtils documentation built on Feb. 6, 2024, 4:26 a.m.