[R-sig-Geo] Using "Mask" for SDMs (Maxent) with Dismo

Johannes Radinger JRadinger at gmx.at
Wed Mar 7 11:22:47 CET 2012


Hi Rafael,
Hi Robert, 

-------- Original-Nachricht --------
> Datum: Tue, 6 Mar 2012 09:27:30 -0800
> Von: "Robert J. Hijmans" <r.hijmans at gmail.com>
> An: Johannes Radinger <JRadinger at gmx.at>
> CC: r-sig-geo at r-project.org
> Betreff: Re: [R-sig-Geo] Using "Mask" for SDMs (Maxent) with Dismo

> Johannes,
> 
> On Tue, Mar 6, 2012 at 5:45 AM, Johannes Radinger <JRadinger at gmx.at>
> wrote:
> 
> > Hi,
> >
> > I have several environmental rasters (loaded as stack/brick) in R which
> I
> > want to use as predictors for Species Distribution Models (preferably
> > Maxent) with the dismo-package. Some of the predictors are habitat
> specific
> > variables and are restricted to a river (like a line of raster cells,
> all
> > land is NA) while others cover the total spatial extent (climatic
> > variables). Thus I've also created a raster MASK which indicates the
> cells
> > that have values (that are non-NAs) in ALL maps.
> >
> > Now I've two questions:
> > 1) How can I use such a MASK within e.g. maxent to restrict my
> background
> > points and predictions etc. only to these cells?
> >
> 
> That is automatic. All cells with NA values are removed. However,
> background sampling might suffer in this case, and it could be good to
> make
> your own background sample using the "randomPoints" function (that takes a
> mask layer as argument).

Thank you for your answer. I used Rafaels approach (newstack<-mask(yourstack,yourmask)) to get "ready" maps which I'll use further on. And I'll use randomPoints to get my background samples...


> 
> 
> 
> > 2) How can I simply exclude presence points that are outside these
> masking
> > raster cells? I want only those samples (presences of my species) that
> are
> > sampled within my defined rivers.
> >
> >
> That is automatic, only points with values for all layers are maintained.
> If you are not sure, you can of course also extract the values for the
> points and remove all rows with NAs. Please see the help files and the
> vignette!

Also here I used Rafaels' approach:
df$index <- extract(mask,df)
df <- df[!is.na(df$index),]

That works really fine. Thank you for all your help!

/Johannes


> 
> Robert
> 
> 
> 
> > Thank you,
> >
> > Johannes
> > --
> >
> > Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >

-- 

Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a



More information about the R-sig-Geo mailing list