packages

library(plyr)

data

Dataset created to validate used locations by roe and red deer. For each of the five roe and red deer population 100 points were compared with a satellite layer (i.e., ground-truth). Hence, in total we did a validation of 500 points per species. For some locations we were not able to determine the ground-truth due to inclarity of the satellite layer. These locations have a missing value (NA) in the column ‘satellite’.

# load data 
roe <- read.csv("../data/3_validation_gps/roe.csv",header=T, sep=',') 
red <- read.csv("../data/3_validation_gps/red.csv",header=T, sep=',')

# change 0 and 1 to open and forest, respectively  
roe[which(roe$tcd==1),]$tcd <- 'forest'
roe[which(roe$tcd==0),]$tcd <- 'open'
red[which(red$tcd==1),]$tcd <- 'forest'
red[which(red$tcd==0),]$tcd <- 'open'
roe[which(roe$satellite==1),]$satellite <- 'forest'
roe[which(roe$satellite==0),]$satellite <- 'open'
red[which(red$satellite==1),]$satellite <- 'forest'
red[which(red$satellite==0),]$satellite <- 'open'
roe$punto <- NULL
red$punto <- NULL

head(roe)
##   population animals_id latitude longitude yearx    tcd clc satellite correct
## 1          1        784 45.99947  11.08740  2006 forest   0    forest     tcd
## 2          1        795 46.01295  11.08614  2005 forest   0      <NA>    <NA>
## 3          1        768 46.00790  11.04297  2006 forest   0      open     clc
## 4          1        800 46.06284  11.08369  2005 forest   0      open     clc
## 5          1        776 45.96659  10.95757  2006 forest   0    forest     tcd
## 6          1        784 45.99813  11.08744  2007 forest   0    forest     tcd
nrow(roe)
## [1] 500
head(red)
##   population animals_id latitude longitude yearx    tcd clc satellite correct
## 1          3        130 46.36950  10.68811  2005 forest   0    forest     tcd
## 2          3        137 46.36474  10.67057  2011 forest   0      open     clc
## 3          3        129 46.39063  10.67036  2007 forest   0    forest     tcd
## 4          3        135 46.47717  10.48563  2011   open   1      open     tcd
## 5          3        116 46.53655  10.28553  2010 forest   0    forest     tcd
## 6          3        116 46.53581  10.30131  2011 forest   0    forest     tcd
nrow(red)
## [1] 500

table 3b: validation of mismatching points

## confusion matrices 

#### roe ####

### absolute 
(roe_t <- table(roe[,c('tcd','satellite')]))
##         satellite
## tcd      forest open
##   forest    270   66
##   open       58   74
### proportion
(roe_p <- prop.table(roe_t))
##         satellite
## tcd         forest      open
##   forest 0.5769231 0.1410256
##   open   0.1239316 0.1581197
#### red ####

#### absolute 
(red_t <- table(red[,c('tcd','satellite')]))
##         satellite
## tcd      forest open
##   forest    228   43
##   open       46  158
#### proportion 
(red_p <- prop.table(red_t))
##         satellite
## tcd          forest       open
##   forest 0.48000000 0.09052632
##   open   0.09684211 0.33263158