Hi,
I have a model that appears to work very nicely ( according to chat values and bootstrap analysis).
I wanted to offset the area of my transect line.
When I used predict my values are a lot high then would be expected for this species.
Could I have made an error in my code while offsetting the transect size?
Thank you. Any help would be appreciated.
Ian
umf <- unmarkedFrameGDS(y=as.matrix(yDat), siteCovs=data.frame(sc.s,covs2), survey="line", dist.breaks=db, numPrimary=1, tlength=covs2$translengt, unitsIn="m")
head(umf)
> head(umf)
Data frame representation of unmarkedFrame object.
y.1 y.2 y.3 y.4 y.5 ndvi temp prec ele riv set lake Activefire firefreq Firecomb
1 2 4 2 0 0 1.0772732 -1.428142 1.008960 0.4001723 -0.7200181 -1.072631 -0.8688888 -0.3098932 -0.3881905 -0.4593782
2 4 3 1 2 0 1.0772732 -1.428142 1.008960 0.4001723 -0.7200181 -1.072631 -0.8688888 -0.3098932 -0.3881905 -0.4593782
3 2 2 1 0 0 1.5158589 -1.428142 1.008960 0.3865088 -0.7078094 -1.021457 -0.8739560 -0.3098932 -0.3881905 -0.4593782
4 2 1 0 1 0 0.6304119 -1.428142 1.027776 0.3796771 -0.7868838 -1.087620 -0.8651899 -0.3098932 -0.3881905 -0.4593782
5 0 1 3 0 0 1.0027962 -1.428142 1.027776 0.4001723 -0.7868838 -1.072631 -0.8846160 -0.3098932 1.5244906 1.0652374
6 2 1 1 2 0 1.4993087 -1.428142 1.008960 0.3933406 -0.7868838 -1.042892 -0.9038299 -0.3098932 -0.3881905 -0.4593782
7 0 2 0 0 0 0.5890358 -1.428142 1.008960 0.4001723 -0.7868838 -1.087620 -0.8402437 -0.3098932 -0.3881905 -0.4593782
8 3 4 1 1 0 0.7793656 -1.428142 1.008960 0.3933406 -0.8234539 -1.051434 -0.8210714 -0.3098932 -0.3881905 -0.4593782
9 4 4 1 0 0 0.7793656 -1.428142 1.008960 0.3933406 -0.8234539 -1.051434 -0.8210714 -0.3098932 -0.3881905 -0.4593782
10 3 1 2 2 0 0.7959160 -1.428142 1.008960 0.4138358 -0.8234539 -1.042892 -0.8144356 -0.3098932 -0.3881905 -0.4593782
uniqueID OBS month translengt landcover area
1 20091A01 MULTI 5 500 10 25
2 20091A02 MULTI 5 500 10 25
3 20091A03 MULTI 5 500 30 25
4 20091A04 MULTI 5 500 30 25
5 20091A05 MULTI 5 500 20 25
6 20091A06 MULTI 5 500 30 25
7 20091A07 MULTI 5 500 30 25
8 20091A08 MULTI 5 500 30 25
9 20091A09 MULTI 5 500 30 25
10 20091A10 MULTI 5 500 30 25
# Load the raster layers of the predictors for the entire landscape.
install.packages(c('raster', 'rgdal', 'dismo', 'rJava'))
library(doParallel)
library(raster)
library(rgdal)
setwd("E:/paper 1/ANALYSIS/GIS and bird excel/GIS_projection UTM zone 42")
WWL<-gdistsamp(lambdaformula = ~riv + lake + prec + temp +offset(log(area)), phiformula = ~1,
pformula = ~OBS, data = umf, keyfun = "exp", output = "abund",
unitsOut = "ha", mixture = "NB")
summary(WWL)
layers <- list.files(pattern="tif$", full.names=FALSE)
layers
#stackkazc10a_Clip=river
#stackkazc12a_Clip=lake
#stackkazc2a_clipNDVI=
#stackkazc4a_Clip=temp
#stackkazc6a_Clip=prec
#stackkazc8a_Clip=elevation
#create four raster objects (coordinate system already specified).
riv <- raster("stackkazc10a_UTM42R1_Project1.tif")
lake<- raster("stackkazc12a_UTM42R1.tif")
prec<- raster("stackkazc6a_UTM42clip1.tif")
temp<- raster("stackkazc4a_UTM42clip1.tif")
ndvi<- raster("stackkazc2a_NDVIUTM42R1.tif")
ele<- raster("stackkazc8a_UTM42R1.tif")
firefreq<- raster("firefreq2000_15R.tif")
extent(temp)
###EXAMPLE RASTER
class : RasterLayer
dimensions : 2547, 1593, 4057371 (nrow, ncol, ncell)
resolution : 856.3835, 856.3835 (x, y)
extent : -542838.3, 821380.6, 4871142, 7052351 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=42 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
data source : in memory
names : stackkazc10a_UTM42R1_Project1
values : -11.60904, 139.2227 (min, max)
#riv <- raster("stackkazc10a_Clip.tif")
#lake<- raster("stackkazc12a_Clip.tif")
#prec<- raster("stackkazc6a_Clip.tif")
#temp<- raster("stackkazc4a_Clip.tif")
sc.s # data set for the scaled variables
attributes (sc.s)
#$`scaled:center`
# ndvi temp prec ele riv set lake Activefire firefreq Firecomb
#107.7638431 58.2120523 205.3780557 253.4246731 0.1981767 0.2733345 0.4512685 0.1569073 0.2029562 0.3013076
#$`scaled:scale`
# ndvi temp prec ele riv set lake Activefire firefreq Firecomb
# 24.1685758 19.7543778 53.1457608 146.3752595 0.2406652 0.2432223 0.4376988 0.5063272 0.5228263 0.6559030
#Since we standardized the covariates during the modelling process, we need to transform the country-wide data using the same values
riv.s <- (riv-0.1981767)/0.2406652
lake.s <- (lake-0.4512685)/0.4376988
prec.s <- (prec-
205.3780557)/53.1457608
temp.s <- (temp-58.2120523)/19.7543778
habitat <- stack(prec.s, temp.s, lake.s, riv.s)
names(habitat) <- c("prec", "temp", "lake", "riv")
habitat.s<-habitat
habitat.s$area<-(856.3835*856.3835)/10000 #cell resolution (856.3835)
#plot variables in model
plot(habitat.s, col=terrain.colors(100))
#predict species abundance per hectre
#WWL.density <- predict(WWL, type="lambda", newdata=habitat.s)
plot(WWL.density, axes=FALSE, col=terrain.colors(100))