### Predicting Dsurface with groups results in all NA

Posted:

**Fri Sep 19, 2014 2:03 pm**Hello,

I am trying to predict density surfaces from full likelihood models that contain groups (e.g., sex). I am modeling density as a function of elevation (covariate "z" in my habitat mask). Everything works great if I omit the groups term from the model:

When I include the groups term, the models run just fine and give (what I believe to be) reasonable results, but all the predicted values in the Dsurface are NA. This also happens when I use any of the built-in variables (x, y, xy, x2, and y2).

Incidentally, if I keep the groups term but just model density as D~1, then predictDsurface works as expected (constant density estimates for each group across all points in the mask). I can also predict a Dsurface from a hybrid mixture model when setting hcov="sex", but I end up with just a single surface rather than group-specific surfaces and I am really interested in looking at that spatial variation of various groups (especially age class, once we have more data).

So, what all of this boils down to is: can I get group-specific Dsurfaces?

I realize I haven't provide much information here, in terms of my study design and data structure, so please let me know if more information is needed here.

Thanks!

I am trying to predict density surfaces from full likelihood models that contain groups (e.g., sex). I am modeling density as a function of elevation (covariate "z" in my habitat mask). Everything works great if I omit the groups term from the model:

- Code: Select all
`> fit.1.1 <- secr.fit(captHist, model=list(D~z, g0~1, sigma~1), mask=maskElev, trace=TRUE)`

> surf.1.1 <- predictDsurface(fit.1.1)

> head(surf.1.1)

x y D.0

1 853204.9 424468.1 0.0001354751

2 853704.9 424468.1 0.0003083124

3 854204.9 424468.1 0.0002361373

4 862204.9 424468.1 0.0006862312

5 862704.9 424468.1 0.0006563962

6 863204.9 424468.1 0.0008017443

When I include the groups term, the models run just fine and give (what I believe to be) reasonable results, but all the predicted values in the Dsurface are NA. This also happens when I use any of the built-in variables (x, y, xy, x2, and y2).

- Code: Select all
`> fit.g.g <- secr.fit(captHist, model=list(D~z, g0~g, sigma~g), mask=maskElev, groups="sex", trace=TRUE)`

> surf.g.g <- predictDsurface(fit.g.g)

> head(surf.g.g)

x y D.F D.M

1 853204.9 424468.1 NA NA

2 853704.9 424468.1 NA NA

3 854204.9 424468.1 NA NA

4 862204.9 424468.1 NA NA

5 862704.9 424468.1 NA NA

6 863204.9 424468.1 NA NA

Incidentally, if I keep the groups term but just model density as D~1, then predictDsurface works as expected (constant density estimates for each group across all points in the mask). I can also predict a Dsurface from a hybrid mixture model when setting hcov="sex", but I end up with just a single surface rather than group-specific surfaces and I am really interested in looking at that spatial variation of various groups (especially age class, once we have more data).

So, what all of this boils down to is: can I get group-specific Dsurfaces?

I realize I haven't provide much information here, in terms of my study design and data structure, so please let me know if more information is needed here.

Thanks!