question on dredge for unmarked objects

1,196 views
Skip to first unread message

Kery Marc

unread,
Feb 24, 2015, 3:08:42 PM2/24/15
to unma...@googlegroups.com
Dear all,

has anybody experience with the dredge function (package MuMIn) applied to, say, a model fit using occu() ? Can I apply the dredging separately for the detection part and then for the occupancy part ?

Thanks for advice.

Kind regards  --  Marc

Dan Linden

unread,
Feb 24, 2015, 3:29:39 PM2/24/15
to unma...@googlegroups.com
You can select both models simultaneously with dredge (or better yet, use pdredge for parallel computing).  If you want to fit them separately, you simply need to specify different subsets for each component (detection vs occupancy) of the model.

Kery Marc

unread,
Feb 24, 2015, 3:46:02 PM2/24/15
to unma...@googlegroups.com
Thanks, Dan.

Would you have sample code ?

Marc
--
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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dan Linden

unread,
Feb 24, 2015, 4:41:33 PM2/24/15
to unma...@googlegroups.com
library(unmarked)
library
(MuMIn)

data
(mallard)
mallard
.y[mallard.y>1]<-1
mallardUMF
<- unmarkedFrameOccu(mallard.y, siteCovs = mallard.site,
                                                                   obsCovs
= mallard.obs)
(ufm.mallard.global <- occu(~ date + I(date^2) ~ forest + elev,mallardUMF))
# examine all combinations
(d1 <- dredge(ufm.mallard.global, rank = AIC))

# Fit model with psi held constant
(ufm.mallard <- occu(~ date + I(date^2) ~ 1,mallardUMF))
# Find the best detection model
(d2 <- dredge(ufm.mallard, rank = AIC))
# keep date and date^2 in comparisons (#2 model from above)
(d2 <- dredge(ufm.mallard.global, rank = AIC,subset=`p(date)`&`p(I(date^2))`))

This just takes the mallard dataset and illustrates some model selection options.  Note the subsetting specification is a bit complex (here I used the backtick or grave accent symbol).  The dredge help file has a pretty thorough explanation of it.

Kery Marc

unread,
Feb 26, 2015, 11:06:21 AM2/26/15
to unma...@googlegroups.com
Dear Dan,

thanks a lot !

Kind regards  --  Marc



Sent: 24 February 2015 22:41

To: unma...@googlegroups.com
Subject: [unmarked] Re: question on dredge for unmarked objects

Drew Ricketts

unread,
Dec 15, 2015, 10:30:34 AM12/15/15
to unmarked
Does anyone know if the dredge function work with pcountOpen objects?  I ran through the sample code that Dan has provided, and it works fine.  However, when I try to do the exact same thing with a pcountOpen object, dredge appears to only test a completely constant model (sample pasted below).  I also tried this with pdredge, and had the same results.  Any thoughts?

Thanks,
Drew

> summary(pm.umf)
unmarkedFrame Object

40 sites
Maximum number of observations per site: 36 
Mean number of observations per site: 26.25 
Number of primary survey periods: 12 
Number of secondary survey periods: 3 
Sites with at least one detection: 39 

Tabulation of y observations:
   0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   26 <NA> 
 216  135  153  144   89   69   59   45   33   27   23   11   10   12    7    2    3    3    3    2    2    1    1  390 

Site-level covariates:
 yr       precip.py           precip.cy                precip.gs               trt          site                state     timesince       graze         grass        
 a:10   Min.   :-1.6454     Min.   :-1.5265     Min.   :-1.1409       abg: 8    c1ae   : 4   ab0:8   Min.   :0.0    Min.   :0.0   Min.   :-1.4357  
 b:10   1st Qu.:-0.3281   1st Qu.:-0.4539    1st Qu.:-0.5218     fbn: 8    c1aw   : 4   fb4:8   1st Qu.:0.0   1st Qu.:1.0   1st Qu.:-0.7938  
 c:10   Median : 0.4193   Median : 0.1830   Median :-0.2177   pbg:24   c3ae   : 4   pb0:8   Median :1.0   Median :1.0   Median :-0.2024  
 d:10   Mean   : 0.0000    Mean   : 0.0000    Mean   : 0.0000                 c3aw   : 4   pb1:8   Mean   :0.9   Mean   :0.8   Mean   : 0.0000  
        3rd Qu.: 0.7474       3rd Qu.: 0.6368    3rd Qu.: 0.3041                 c3be   : 4   pb2:8   3rd Qu.:2.0   3rd Qu.:1.0   3rd Qu.: 0.5352  
        Max.   : 0.8068         Max.   : 1.1605    Max.   : 1.5762                  c3bw   : 4                 Max.   :3.0   Max.   :1.0   Max.   : 1.9681  
                                                                                                              (Other):16                                                        
      forb              shrub              bare             litter           litdepth            vor         
 Min.   :-1.80290   Min.   :-0.8663   Min.   :-1.1355   Min.   :-0.9160   Min.   :-0.8064   Min.   :-1.5726  
 1st Qu.:-0.69533   1st Qu.:-0.8162   1st Qu.:-0.9276   1st Qu.:-0.6778   1st Qu.:-0.6864   1st Qu.:-0.6648  
 Median :-0.09031   Median :-0.3017   Median :-0.2718   Median :-0.2237   Median :-0.5263   Median : 0.0263  
 Mean   : 0.00000   Mean   : 0.0000   Mean   : 0.0000   Mean   : 0.0000   Mean   : 0.0000   Mean   : 0.0000  
 3rd Qu.: 0.74928   3rd Qu.: 0.5502   3rd Qu.: 0.9605   3rd Qu.: 0.2436   3rd Qu.: 0.6102   3rd Qu.: 0.3306  
 Max.   : 2.45340   Max.   : 2.7750   Max.   : 2.4920   Max.   : 2.6259   Max.   : 2.4697   Max.   : 2.6773  
                                                                                                             

Observation-level covariates:
 seasonp       monthp.V1      
 fa:360   Min.   :-1.5927017  
 sp:360   1st Qu.:-0.7963509  
 su:360   Median : 0.0000000  
 wi:360   Mean   : 0.0000000  
          3rd Qu.: 0.7963509  
          Max.   : 1.5927017  

Yearly-site-level covariates:
 season         month.V1          precip.prev.V1     precip.twoprev.V1       mean.min.V1        mean.min.prev.V1  
 fa:120   Min.   :-1.5915945   Min.   :-1.3239232   Min.   :-1.3931911   Min.   :-1.5858730   Min.   :-1.5839611  
 sp:120   1st Qu.:-0.7957973   1st Qu.:-0.7956317   1st Qu.:-0.8530210   1st Qu.:-0.9274967   1st Qu.:-0.9259622  
 su:120   Median : 0.0000000   Median :-0.1739009   Median :-0.1885121   Median : 0.0066408   Median : 0.0076397  
 wi:120   Mean   : 0.0000000   Mean   : 0.0000000   Mean   : 0.0000000   Mean   : 0.0000000   Mean   : 0.0000000  
          3rd Qu.: 0.7957973   3rd Qu.: 0.7443200   3rd Qu.: 0.6677835   3rd Qu.: 0.9338962   3rd Qu.: 0.9343635  
          Max.   : 1.5915945   Max.   : 2.9718891   Max.   : 2.8132147   Max.   : 1.6753912   Max.   : 1.6754334  
> (pm.glbl <-  pcountOpen(~grass + forb + litdepth + shrub + precip.py + precip.gs + precip.cy, ~1, ~1, ~1, pm.umf, K=50))

Call:
pcountOpen(lambdaformula = ~grass + forb + litdepth + shrub + 
    precip.py + precip.gs + precip.cy, gammaformula = ~1, omegaformula = ~1, 
    pformula = ~1, data = pm.umf, K = 50)

Abundance:
            Estimate     SE      z  P(>|z|)
(Intercept)   1.2287  0.116 10.564 4.40e-26
grass         0.0723  0.155  0.465 6.42e-01
forb          0.2915  0.104  2.793 5.22e-03
litdepth     -0.5309  0.181 -2.928 3.41e-03
shrub        -0.0285  0.133 -0.214 8.30e-01
precip.py    37.5385 21.688  1.731 8.35e-02
precip.gs    43.6994 25.125  1.739 8.20e-02
precip.cy   -15.0966  8.366 -1.804 7.12e-02

Recruitment:
 Estimate     SE  z  P(>|z|)
    0.728 0.0664 11 6.11e-28

Apparent Survival:
 Estimate    SE    z  P(>|z|)
     1.22 0.128 9.52 1.78e-21

Detection:
 Estimate     SE z P(>|z|)
     0.22 0.0734 3 0.00273

AIC: 4170.2 
> (d2 <- dredge(pm.glbl, rank = AIC))
Fixed terms are "lam(Int)", "gamConst(Int)", "omega(Int)", "p(Int)" and "NA(Int)"
Global model call: pcountOpen(lambdaformula = ~grass + forb + litdepth + shrub + 
    precip.py + precip.gs + precip.cy, gammaformula = ~1, omegaformula = ~1, 
    pformula = ~1, data = pm.umf, K = 50)
---
Model selection table 
  lam(Int) gmC(Int) omg(Int) p(Int) NA(Int) df    logLik    AIC delta weight
1    1.552   0.7272    1.176 0.2987       +  4 -2121.895 4251.8     0      1
Models ranked by AIC(x) 

Kelly Perkins

unread,
Jun 26, 2017, 9:18:59 AM6/26/17
to unmarked
Does anyone have experience using dredge for the hierarchical distance models available in unmarked? When I try to apply the function to my model, it appears to be fixing an intercept on abundance and won't iterate between the null model and a single covariate on detection.

This is the model below. I want to dredge all combinations of DateCov and null on detection with all abundance covariates. Instead, it appears to iterate among the abundance covariates but fixes an intercept on abundance and fixes DateCov on detection.
Ma<-distsamp(~DateCov~WoodyWet.p+M.p+Dev.p+D.p+C.p+Canopy+Ag.p+Dem, umf, 
             keyfun="halfnorm", output="abund", se=TRUE, unitsOut="kmsq")

Da<-dredge(Ma, rank=AIC, evaluate=TRUE, fixed=NULL)

I get the following message:
Fixed terms are "lam(Int)" and "p(sigma(Intercept))"

Thanks for any suggestions!!

-Kelly

Kelly Perkins

unread,
Jun 27, 2017, 11:14:55 AM6/27/17
to unmarked
I do see now that it will iterate between a null model and a covariate on detection. But I don't understand why it is fixing an intercept on both abundance and detection?

Thanks!
-Kelly
Reply all
Reply to author
Forward
0 new messages