Hi Agus,

You can use the index argument for that (but I admit that the function
should detect this automatically). If you expect two numbers for each cell,
you can do

predict(object=PCAtoMedian_6yrs,model=srndpc20000lda, index=1:2)

Robert

On Sat, Sep 24, 2011 at 2:48 AM, Agustin Lobo <alobolistas@gmail.com> wrote:

> I'm using raster::predict using predict.lda():
>
> > srndpc20000lda <- lda(srndpcclasses[,1:5],srndpcclasses[,37])
> > PCAtoMedian_6yrsclass20000 <-
> predict(object=PCAtoMedian_6yrs,model=srndpc20000lda)
> > PCAtoMedian_6yrsclass20000
> 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.
> From the help page of MASS::predict.lda():
>
> 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
>

	[[alternative HTML version deleted]]

