I have 3 seasons camera trapping, and 3 habitat types. I found that habitat type affected g0, and that density vary by season. So I fitted the following model:
- Code: Select all
Mdens.habitat <- secr.fit(CH, model = c(D ~ session, g0~Habitat), mask=mask.sec, detectfn=1)
I want to extract session & habitat specific values of density; using
- Code: Select all
predict(Mdens.habitat)
I get the following:
> predict(Mdens.habitat)
$`session = Summer2015, Habitat = grassandwet`
link estimate SE.estimate lcl ucl
D log 7.645846e-03 0.001513766 5.206159e-03 0.01122881
g0 logit 1.598026e-01 0.032962603 1.051871e-01 0.23531821
sigma log 3.228419e+02 34.473128615 2.620330e+02 397.76256485
z log 3.275634e+00 0.237019248 2.843049e+00 3.77403989
$`session = Winter2014, Habitat = grassandwet`
link estimate SE.estimate lcl ucl
D log 4.272679e-03 0.001077598 2.626168e-03 6.951491e-03
g0 logit 1.598026e-01 0.032962603 1.051871e-01 2.353182e-01
sigma log 3.228419e+02 34.473128615 2.620330e+02 3.977626e+02
z log 3.275634e+00 0.237019248 2.843049e+00 3.774040e+00
$`session = Winter2015, Habitat = grassandwet`
link estimate SE.estimate lcl ucl
D log 7.056588e-03 0.001449783 0.00473717 0.01051164
g0 logit 1.598026e-01 0.032962603 0.10518708 0.23531821
sigma log 3.228419e+02 34.473128615 262.03297273 397.76256485
z log 3.275634e+00 0.237019248 2.84304880 3.77403989
So I use the following for session/habitat specific density estimates
- Code: Select all
predict(Mdens.habitat,newdata =expand.grid(Habitat=factor(c("grassandwet","grass","wet")),session = c("Winter2014","Summer2015","Winter2015")))
But this gives me
Error in mat %*% beta[indx] : non-conformable arguments
What am I missing in the code, or am I missing something
Any help would be appreciated
Lourens