[R-sig-eco] 3rd Order Habitat Selection in R with AdehabitatHS (function: WidesIII)

Lucy Ryan ljr540 at york.ac.uk
Mon Feb 20 12:40:07 CET 2017


Hi all,

I'm currently struggling with 3rd order habitat selection using the
adehabitat HS package.

My data consist of 15 GPS tracked birds and then I have two different
raster habitat maps at 5m resolution, one of which contains 10 of the
birds, the other contains 5. I can produce Manly Selection Ratios fine at
second order where I have used the code:

hab<-Hhab[,1]  ###Hhab is raster map###
hb<-slot(hab,"data")[,1]
av <- factor(hb,labels=c("Water","Wet peat","Wooded cover","Wetland
veg","Bracken","Heather","Scrub","Clearance","Grass","Building","Dry
peat"))
##changing numbers to factors to categorise habitats###
tav <- table(av)

to select the available habitat at site level (i.e. every pixel in the
raster map)

and then using:

image(hab)
HatUS<-join(Hattr,hab)
HatUSt <- table(slot(Hattr,"data")[,2],HatUS)
HatUSt
class(HatUSt)<-NULL
HatUSt<-as.data.frame(HatUSt)
colnames(HatUSt)<-names(tav)
colnames(ThoUSt)<-c("Water","Wet peat","Wooded cover","Wetland
Veg","Bracken","Heather","Scrub","Clearance","Grass","Building","Dry Peat")
rownames(HatUSt,do.NULL=TRUE)
tav<-as.vector(tav)
names(tav) <- names(HatUSt)
WiII <- widesII(HatUSt, tav)

to compute used values and then the selection ratios.

This works fine and I have informative selective ratios.

However, when I aim for third order selection, I am trying to use 95% home
range shapefiles/ Spatial Polygons Data frames for each of the birds to
estimate individual availability.
In the adehabitatHS vignette, the HRs are rasterized, but then no more is
said about how to use these.
I have used the HRs just as polygons, as it made more sense.

I tried to extract values from the raster (Hhab) by the HomeRanges as
polygons (mkdes):
ext<-extract(Hhab,mkdes)
which gives me a large list:
str(ext)
List of 10
 $ : num [1:628231] 3 3 3 3 3 3 3 3 3 3 ...
 $ : num [1:106986] 10 10 10 7 7 7 7 7 12 12 ...
 $ : num [1:123970] 7 7 7 7 12 12 3 3 3 3 ...
 $ : num [1:131545] 3 3 3 3 3 10 10 10 4 4 ...
 $ : num [1:183049] 7 7 7 12 7 7 7 7 7 7 ...
 $ : num [1:55967] 6 6 9 9 9 9 9 9 9 9 ...
 $ : num [1:466500] 3 3 3 3 3 3 3 3 3 3 ...
 $ : num [1:63629] 7 7 7 7 3 3 3 3 3 7 ...
 $ : num [1:77749] 11 11 11 11 11 9 9 9 9 9 ...
 $ : num [1:291833] 7 7 7 7 8 8 8 8 7 8 ...

where I can see that what seem like appropriate values have been extracted.

When I try to convert from number list to factor as was done for the whole
site availability, it doesn't work - note that I have to do it by each bird
hence the [[]] notation - my dataset is very big..

ext1av<-factor(ext[[1]],levels = 1:11,labels = c("Water","Wet Peat","Wooded
cover","Wetland
veg","Bracken","Heather","Scrub","Clearance","Grass","Building","Dry peat"))

It produces different figures from what I think it should - see list above,
in the 6th line there are some number 6's - these NEVER come up as
available, but in all birds, these don't appear.

Basically, it says certain habitats are not available for the birds when I
know they are.

Is there something I don't understand about the extract function or about
the factor function. And should I be using the raster home ranges or can I
stick with polygons??

Many thanks in advance.
Lucy

-- 
--------------
Lucy Ryan
PhD Student

Environment Department
Wentworth Way
University of York
Heslington
York
YO10 5DD

Email: ljr540 at york.ac.uk
https://uk.linkedin.com/pub/lucy-ryan/55/799/2b9

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list