Hello dear all, I am new at the unmarked package. I am working with distance sampling and I am interested in appliying an HDS model with guanaco (Lama guanicoe) populations and I am having some trouble with the model script and with density estimation. I am working with two different sites each one has 500 kmsq. Below is my R-script. My questions are:
1) Which is the best way to choose among the key function? I looked at the histograms and ran null models for all the possibilities (hazard, halfnorm, uniform or exp); afther that I calculated the AIC foreach model and choose the model with the smallest AIC . Is this correct? Is there any statics which help with this?
2) I ran the models that you can see below but when I run sc5 and sc6 I have this alarm: "Hessian is singular. Try using fewer covariates or providing starting values." I tried to provide an starting value but another error appears: “Error in names(starts) <- c(lamParms, detParms) : 'names' attribute [5] must be the same length as the vector [2]. I can’t see any problem in my R-script. How can I solve this?
3) I decided leave the two problematic models and to run all to others models just to learn when I do it and try to estimate density with the selected model which is the null one, it seems that all the transects from both sites have the same guanaco’s density. This seems wrong.
Perhaps my questions are too simpler to this group; in that case I would be grateful to receive some advice of another group. I’ve read Chandler,2015 R-script example and I am also reading the Kéry and Royle book “Hirarchical modeling in ecology”, but I am still having trouble with this,perhaps they are too advanced for me. Can you recommend something for starters?
R-script
library(unmarked)
distancia<-transectas_grupos[,2]
transecta<-transectas_grupos[,1]
yDat <- formatDistData(transectas_grupos, distCol="distancia",
transectNameCol="transecta", dist.breaks=c(0, 230,440,700))
area1<-500
area2<-500
#transect lenght en metros
tlenght<-c(6000,6600,5900,4500,10200,6500,9900,10000) #creo el objeto tlenght porque todas las transectas son de
#distinta longitud
#juntamos las transectas con las covaribales
umf<- unmarkedFrameDS(y=as.matrix(yDat),siteCovs=data.frame(covariables, (area1+area2)),
dist.breaks=c(0,230,440,700), unitsIn="m",survey="line",
tlenght,(unitsIn=m))
summary (umf)
hist(umf)
#fitmodels (primero pruebo las fnciones halfnorm y hazzard con el modelo nulo para ver si puedo ajustar
#una u otra función)
NUll1<-distsamp(~1~1, umf, keyfun="halfnorm", output="density",unitsOut="kmsq")
Null2<-distsamp(~1~1, umf, keyfun="hazard", output="density",unitsOut="kmsq")
Null3<-distsamp(~1~1, umf, keyfun="exp", output="density",unitsOut="kmsq")
Null4<-distsamp(~1~1, umf, keyfun="uniform", output="density",unitsOut="kmsq")
#comparo los aic de cada uno de los modelos nulos para selecciionar la keynfun que mejor funcione
scs<-fitList(Null=NUll1, a=Null2,b=Null3,c=Null4)
ms <- modSel(scs, nullmod="Null")
ms
hist(NUll1)
hist(Null2)
hist(Null3)
hist(Null4)
#elijo Null1 que tiene un ajuste halfnorm entonces a todos los otros modelos les hago un ajuste halfnorm
NUll1<-distsamp(~1~1, umf, keyfun="halfnorm", output="density",unitsOut="kmsq")
SC1<-distsamp(~1~sitio, umf, keyfun="halfnorm", output="density",unitsOut="kmsq")
sc2<-distsamp(~1~relieve, umf, keyfun="halfnorm", output="density",unitsOut="kmsq")
sc3<-distsamp(~relieve~1, umf, keyfun="halfnorm", output="density",unitsOut="kmsq")
sc4<-distsamp(~sitio~1, umf, keyfun="halfnorm", output="density",unitsOut="kmsq")
sc5<-distsamp(~sitio~relieve +sitio, umf,keyfun="halfnorm", output="density",unitsOut="kmsq")
sc6<-distsamp(~sitio~relieve*sitio, umf,starts = c(1), keyfun="halfnorm", output="density",unitsOut="kmsq")
sc7<-distsamp(~sitio~sitio^2, umf, keyfun="halfnorm", output="density",unitsOut="kmsq")
sc8<-distsamp(~relieve~relieve, umf, keyfun="halfnorm", output="density",unitsOut="kmsq")
sc9<-distsamp(~relieve~relieve*sitio, umf, keyfun="halfnorm", output="density",unitsOut="kmsq")
### model selection
> scs2<-fitList(Null=NUll1,a=SC1,b=sc2,c=sc3,d=sc4,e=sc5,f=sc8,g=sc9 )
> ms <- modSel(scs, nullmod="Null")
> ms
nPars AIC delta AICwt cumltvWt Rsq
Null 2 126.11 0.00 5.0e-01 0.50 0.0000
b 2 127.00 0.89 3.2e-01 0.82 -0.1174
a 3 128.10 1.99 1.8e-01 1.00 0.0012
c 1 156.12 30.01 1.5e-07 1.00 -41.5956
> null
Error: object 'null' not found
> NULL
NULL
> Null1
Error: object 'Null1' not found
> NUll1
Call:
distsamp(formula = ~1 ~ 1, data = umf, keyfun = "halfnorm", output = "density",
unitsOut = "kmsq")
Density:
Estimate SE z P(>|z|)
0.916 0.123 7.47 7.78e-14
Detection:
Estimate SE z P(>|z|)
5.83 0.104 56 0
AIC: 126.1083
> backTransform(NUll1,type=state)
Error in obj[type] : object 'state' not found
> backTransform(NUll1,type="state")
Backtransformed linear combination(s) of Density estimate(s)
Estimate SE LinComb (Intercept)
2.5 0.307 0.916 1
Transformation: exp
> backTransform(NUll1,type="det")
Backtransformed linear combination(s) of Detection estimate(s)
Estimate SE LinComb sigma(Intercept)
340 35.4 5.83 1
|
Transformation: exp > backTransform(NUll1,type="det") Backtransformed linear combination(s) of Detection estimate(s)
Estimate SE LinComb sigma(Intercept) 340 35.4 5.83 1
> predict(NUll1,type="state")$Predicted [1] 2.500199 2.500199 2.500199 2.500199 2.500199 2.500199 2.500199 2.500199 |
|
|
|
--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.