spmultinom: Multinomial logistic regression on spatial objects

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

Description

Runs the multinomial logistic regression via nnet::multinom to produce spatial predictions of the target factor-type variable. It requires point locations of observed classes and a list of covariate layers provided as "SpatialPixelsDataFrame-class" object. The resulting predicted classes are then used to estimate class centres and variances per class.

Usage

1
2
3
4
## S4 method for signature 
## 'formula,SpatialPointsDataFrame,SpatialPixelsDataFrame'
spmultinom(formulaString,
     observations, covariates, class.stats = TRUE, predict.probs = TRUE, ...)

Arguments

formulaString

formula string

observations

object of type "SpatialPointsData"; occurrences of factors

covariates

object of type "SpatialPixelsData"; list of covariate layers

class.stats

logical; species wether to estimate class centres

predict.probs

logical; species wether to predict probabilities per class

...

optional arguments

Value

Returns an object of type "SpatialMemberships" with following slots: predicted (classes predicted by the multinomial logistic regression, model (the multinomial logistic regression model), mu (probabilities derived using the mutinom model), class.c (derived class centres), class.sd (derived class deviations), confusion (confusion matrix).

Author(s)

Bas Kempen and Tomislav Hengl

References

See Also

spfkm, SpatialMemberships-class

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
# 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 <- spmultinom(formulaString, eberg, eberg_spc@predicted)
## Not run: # plot memberships:
pal = seq(0, 1, 1/50)
spplot(eberg_sm@mu, col.regions=pal)
image(eberg_sm@mu[1], col=pal)
text(eberg@coords, paste(eberg$soiltype), cex=.6, col="black")
# classes predicted:
Ls = length(levels(eberg_sm@predicted$soiltype))
pnts = list("sp.points", eberg, pch="+", cex=.6, col="black")
spplot(eberg_sm@predicted, col.regions=rainbow(Ls)[rank(runif(Ls))], sp.layout=pnts)

## End(Not run)

GSIF documentation built on May 31, 2017, 4:57 a.m.

Related to spmultinom in GSIF...