spfkm {GSIF} | R Documentation |
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
.
## S4 method for signature ## 'formula,SpatialPointsDataFrame,SpatialPixelsDataFrame' spfkm(formulaString, observations, covariates, class.c = NULL, class.sd = NULL, fuzzy.e = 1.2)
formulaString |
formula string |
observations |
object of type |
covariates |
object of type |
class.c |
object of type |
class.sd |
object of type |
fuzzy.e |
object of type |
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).
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.
Tomislav Hengl and Bas Kempen
Burrough, P. A., Gaans, P.F.M., and Van Hootsmans, R., (1997) Continuous classification in soil survey: spatial correlation, confusion and boundaries. Geoderma, 77(2-4), 115–135.
Hengl T., Walvoort D.J.J., Brown, A., (2004) A double continuous approach to visualisation and analysis of categorical maps. Int. Jou. of Geographical Information Science, 18(2): 183-202.
spmultinom
, SpatialMemberships-class
, nnet::multinom
# 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)