This file is to play with ways to compare proportion of habitat used v available.

There are two matrices: one for availability (Habitat Availability.csv) and one for use (Habitat Use.csv). They are in Gondek, Matt -> Data _ Gondek

hu = read.csv("Habitat Use.csv", header=T)
ha = read.csv("Habitat Availability.csv", header=T)
hu
##   Open.water Forest Shrub.Scrub Grass   Ag Wood.wet Herb.wet
## 1      4.700  3.500         2.4 0.300 16.5      6.0     66.7
## 2      0.007  8.800        12.7 2.800 19.9      6.8     49.0
## 3      0.100  2.200         9.5 0.007 20.2      8.0     60.1
## 4      0.500  4.400         8.3 0.007  4.6     38.7     43.5
## 5     17.800  0.007         2.9 1.800 17.0      0.1     60.4
## 6      5.700  7.400        26.9 0.007 10.7     14.3     33.9
## 7      0.007  4.900        11.8 5.800 27.2      3.3     47.1
ha
##   Open.water Forest Shrub.Scrub Grass   Ag Wood.wet Herb.wet
## 1       0.90   11.6         4.8  1.00 10.8     17.9     52.7
## 2       0.21   17.3         9.5  8.40 12.7     14.2     38.0
## 3       2.00    8.4        15.2  1.30 20.4     12.3     41.7
## 4       4.40    8.2         6.9  0.10  6.1     42.5     31.9
## 5       5.70    0.3         2.3  7.10 19.7      0.2     64.6
## 6       2.50   10.8        25.2  0.24  6.5     25.4     29.6
## 7       0.02    9.1         8.5  9.80 20.1      9.0     43.6
## Loading required package: sp
## Loading required package: ade4
## Loading required package: adehabitatMA
## Registered S3 methods overwritten by 'adehabitatMA':
##   method                       from
##   print.SpatialPixelsDataFrame sp  
##   print.SpatialPixels          sp
## Loading required package: adehabitatHR
## Loading required package: deldir
## deldir 0.1-25
## Loading required package: adehabitatLT
## Loading required package: CircStats
## Loading required package: MASS
## Loading required package: boot
compana(hu, ha)
## ************ Compositional analysis of habitat use ***************
## 
## The analysis was carried out with 7 animals and 7 habitat types
## 1. Test of the habitat selection:
##    randomisation test
##      Lambda           P 
## 0.005747109 0.150000000 
## 
## 2. Ranking of habitats (profile):
##                                                                             
## habitat      Herb.wet  Ag  Shrub.Scrub  Wood.wet  Open.water  Forest  Grass 
## Herb.wet    ---------------------------          ------------               
## Ag          ---------------------------          ------------               
## Shrub.Scrub ---------------------------          ------------               
## Wood.wet                               ------------------------------       
## Open.water  ----------------------------------------------------------------
## Forest                                 -------------------------------------
## Grass                                            ---------------------------