spfkm: Fit a supervised fuzzy kmeans model and predict memberships

Description Usage Arguments Value Author(s) Examples

Description

Runs supervised fuzzy k-means (Hengl et al., 2004; doi: 10.1080/13658810310001620924) using a list of covariates layers provided as "SpatialPixelsDataFrame-class" object. If class centres and variances are not provided, it first fits a multinomial logistic regression model (spmultinom), then predicts the class centers and variances based on the output from the nnet::multinom.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S4 method for signature 
## 'formula,SpatialPointsDataFrame,SpatialPixelsDataFrame'
spfkm(
  formulaString,
  observations,
  covariates,
  class.c = NULL,
  class.sd = NULL,
  fuzzy.e = 1.2
)

Arguments

formulaString

formula.

observations

SpatialPointsDataFrame.

covariates

SpatialPixelsDataFrame.

class.c

class centers (per variable).

class.sd

class standard deviation (per variable).

fuzzy.e

fuzzy coefficient.

Value

A fuzzy kmeans model

Author(s)

Tom Hengl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
if(requireNamespace("plotKML")){
library(plotKML)
library(sp)
library(nnet)
data(eberg)
# subset to 20%:
eberg <- eberg[runif(nrow(eberg))<.2,]
data(eberg_grid)
coordinates(eberg) <- ~X+Y
proj4string(eberg) <- CRS("+init=epsg:31467")
gridded(eberg_grid) <- ~x+y
proj4string(eberg_grid) <- CRS("+init=epsg:31467")
# derive soil predictive components:
eberg_spc <- spc(eberg_grid, ~PRMGEO6+DEMSRT6+TWISRT6+TIRAST6)
# predict memberships:
formulaString = soiltype ~ PC1+PC2+PC3+PC4+PC5+PC6+PC7+PC8+PC9+PC10
eberg_sm <- spfkm(formulaString, eberg, eberg_spc@predicted)
# plot memberships:
  pal = seq(0, 1, 1/50)
  spplot(eberg_sm@mu, col.regions=grey(rev(pal)))
}

landmap documentation built on Oct. 14, 2021, 5:24 p.m.

Related to spfkm in landmap...