Skip to content
Prev 12919 / 29559 Next

raster::predict: more than one single output

I'm using raster::predict using predict.lda():
class       : RasterLayer
dimensions  : 1289, 1289, 1661521  (nrow, ncol, ncell)
resolution  : 0.008928571, 0.008928571  (x, y)
extent      : 30.99554, 42.50446, 1.495536, 13.00446  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0
values      : in memory
min value   : 1
max value   : 4

But I would also need the rest of the output provided by
predict.lda(), in particular a layer with the posterior
probabilities to mask out those pixels which do not have a high
probability for any of the classes.
Value
 a list with components

class   The MAP classification (a factor)
posterior   posterior probabilities for the classes
x   the scores of test cases on up to dimen discriminant variables

As far as I  understand, only "class" is returned by raster::predict.
Am I wrong and there is actually a way to get the posteriors?
Otherwise, could that be added in the future?

Thanks

Agus