spfkm: Supervised fuzzy _k_-means on spatial pixels

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

Runs supervised fuzzy k-means (Hengl et al., 2004) 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 centres and variances based on the output from the nnet::multinom.

Usage

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

Arguments

formulaString

formula string

observations

object of type "SpatialPointsData"; occurrences of factors

covariates

object of type "SpatialPixelsData" or "RasterBrick"; list of covariate layers

class.c

object of type "matrix"; class centres (see examples below)

class.sd

object of type "matrix"; class deviations (see examples below)

fuzzy.e

object of type "numeric"; fuzzy exponent

Value

Returns an object of type "SpatialMemberships" with following slots: predicted (classes predicted either by the multinomial logistic regression or fuzzy k-means), model (the multinomial logistic regression model; if available), mu (memberships derived using the fuzzy k-means), class.c (submitted or derived class centres), class.sd (submitted or derived class deviations), confusion (confusion matrix).

Note

Although nnet::multinom is consider to be robust and suited for large data sets, function might not converge in some cases or result in artifacts. If this happens try setting up the class centres and variances manually.

Author(s)

Tomislav Hengl and Bas Kempen

References

See Also

spmultinom, SpatialMemberships-class, nnet::multinom

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# load data:
library(plotKML)
library(sp)

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)
## Not run: # plot memberships:
pal = seq(0, 1, 1/50)
spplot(eberg_sm@mu, col.regions=grey(rev(pal)))
# predict soil properties using memberships:
glm.formulaString = as.formula(paste("SNDMHT_A ~ ", 
    paste(names(eberg_sm@mu), collapse="+"), "-1"))
SNDMHT.m2 <- fit.gstatModel(observations=eberg, glm.formulaString, 
    covariates=eberg_sm@mu)
summary(SNDMHT.m2@regModel)
# Coefficients correspond to the class centres;

## End(Not run)

GSIF documentation built on May 2, 2019, 5:44 p.m.

Related to spfkm in GSIF...