AICcmodavg

426 views
Skip to first unread message

Chris

unread,
Dec 22, 2011, 3:56:59 PM12/22/11
to unmarked
Hi everyone<

I know that the package AICcmodavg works with a number of unmarked
classes; does it work with distance sampling (unmarkedFrameDS and
distsamp)? I would like to conduct model averaging for a study I have
conducted. If not, does anyone have a workaround?

Thanks

Chris Hamm

Marc.Ma...@uqat.ca

unread,
Dec 22, 2011, 4:08:48 PM12/22/11
to unma...@googlegroups.com
Hi Chris,

AICcmodavg does not support distance models yet, but I could include it in an upcoming version in early January.

Best,

Marc
--
____________________________________
Marc J. Mazerolle
Centre d'étude de la forêt
Université du Québec en Abitibi-Témiscamingue
445 boulevard de l'Université
Rouyn-Noranda, Québec J9X 5E4, Canada
Tel: (819) 762-0971 ext. 2458
Email: marc.ma...@uqat.ca

________________________________________
De : unma...@googlegroups.com [unma...@googlegroups.com] de la part de Chris [tophe...@gmail.com]
Date d'envoi : jeudi 22 décembre 2011 15:56
À : unmarked
Objet : [unmarked] AICcmodavg

Richard Chandler

unread,
Dec 22, 2011, 4:16:11 PM12/22/11
to unma...@googlegroups.com
Hi Chris,

Have you seen the help pages: ?fitList and ?unmarked. They show examples of model-averaging predictions. There is also this old post with a function for averaging coefficients, but it should be used with caution: https://groups.google.com/forum/#!searchin/unmarked/model$20averaging/unmarked/kvDLzq9AJp8/olkUsc5zK2QJ.

Richard

_____________________________________
Richard Chandler, post-doc
USGS Patuxent Wildlife Research Center
301-497-5696

Chris Hamm

unread,
Dec 23, 2011, 12:30:48 PM12/23/11
to unmarked
Hello Richard,

Thanks for taking the time to respond and happy holidays.

Yes, I have gone through the help pages you listed. I guess my problem
with using predict after modsel and fitlList is how to properly
interpret the output. I am very new to distance sampling and
information theoretic approaches to statistics for that matter.

Thanks again.

Chris



On Dec 22, 4:16 pm, Richard Chandler <rchand...@usgs.gov> wrote:
> Hi Chris,
>
> Have you seen the help pages: ?fitList and ?unmarked. They show examples
> of model-averaging predictions. There is also this old post with a
> function for averaging coefficients, but it should be used with caution:https://groups.google.com/forum/#!searchin/unmarked/model$20averaging...

Chris Hamm

unread,
Dec 27, 2011, 2:12:27 PM12/27/11
to unmarked
Hello everyone,

I am still stuck on how to interpret the output from the predict()
after using modSel(). I am interested in getting the AIC weighted
avereage for the predicted density of (in this case) butterflies. I
don't understand why I am not getting a single predicted density, SE,
LCI and UCI. Rather, I am getting 27 lines of output (though many are
the same). Any help would be much appreciated.

Thanks

Chris

Below are the outputs from modSel and predict:

>ms.j4.h <- modSel(j4.h.list)
> ms.j4.h
nPars AIC delta AICwt cumltvWt
~Unit ~1 5 311.78 0.00 7.7e-01 0.77
~1 ~Unit 5 314.23 2.45 2.3e-01 1.00
Null 2 323.32 11.54 2.4e-03 1.00
~Unit ~Unit 8 349.30 37.53 5.5e-09 1.00




>predict(j4.h.list, type='state')
Predicted SE lower upper
1 104.1235 26.86572 51.46673 156.7804
2 104.1235 26.86572 51.46673 156.7804
3 104.1235 26.86572 51.46673 156.7804
4 104.1235 26.86572 51.46673 156.7804
5 104.1235 26.86572 51.46673 156.7804
6 104.1235 26.86572 51.46673 156.7804
7 104.1235 26.86572 51.46673 156.7804
8 104.1235 26.86572 51.46673 156.7804
9 104.1235 26.86572 51.46673 156.7804
10 122.7387 18.36424 86.74484 158.7327
11 122.7387 18.36424 86.74484 158.7327
12 122.7387 18.36424 86.74484 158.7327
13 122.7387 18.36424 86.74484 158.7327
14 122.7387 18.36424 86.74484 158.7327
15 122.7387 18.36424 86.74484 158.7327
16 122.7387 18.36424 86.74484 158.7327
17 124.3682 20.25154 84.67517 164.0612
18 124.3682 20.25154 84.67517 164.0612
19 124.3682 20.25154 84.67517 164.0612
20 124.3682 20.25154 84.67517 164.0612
21 124.3682 20.25154 84.67517 164.0612
22 124.3682 20.25154 84.67517 164.0612
23 124.3682 20.25154 84.67517 164.0612
24 124.3682 20.25154 84.67517 164.0612
25 115.0667 19.40955 77.02396 153.1094
26 115.0667 19.40955 77.02396 153.1094

Richard Chandler

unread,
Dec 29, 2011, 9:49:04 AM12/29/11
to unma...@googlegroups.com
Hi Chris,

You are seeing model-averaged density estimates for the observed covariate values at each of your 26 sites. If you want a single density estimate, create a data.frame with 1 row for the covariate values of interest, and use something like:

predict(j4.h.list, type='state', newdata=someDataFrame)


Richard


_____________________________________
Richard Chandler


USGS Patuxent Wildlife Research Center
301-497-5696

-----unma...@googlegroups.com wrote: -----


To: unmarked <unma...@googlegroups.com>
From: Chris Hamm <tophe...@gmail.com>
Sent by: unma...@googlegroups.com
Date: 12/27/2011 02:12PM
Subject: Re: RE : [unmarked] AICcmodavg

Pablo García Díaz

unread,
Dec 29, 2011, 1:37:16 PM12/29/11
to unma...@googlegroups.com
Hello,

I'm trying to construct a unmarkedMultFrame to analyse a data set using the colext algorithm. But, when I try to add years as a yearly site covariate it is impossible to get the job done. Then I've tried using the examples in the reference manual and I obtain the same kind of error. This is the report in R

> n <- 50 # number of sites
> T <- 4 # number of primary periods
> J <- 3 # number of secondary periods
> site <- 1:50
> years <- data.frame(matrix(rep(2010:2013, each=n), n, T))
> years <- data.frame(lapply(years, as.factor))
> occasions <- data.frame(matrix(rep(1:(J*T), each=n), n, J*T))
> y <- matrix(0:1, n, J*T)
> umf <- unmarkedMultFrame(y=y,
+ siteCovs = data.frame(site=site),
+ obsCovs=list(occasion=occasions),
+ yearlySiteCovs=data.frame(year=years),
+ numPrimary=T)
> print(umf)
Error in data.frame(df, yscwide) : 
  arguments imply differing number of rows: 50, 13
In addition: Warning messages:
1: In FUN(X[[4L]], ...) :
  data length [50] is not a sub-multiple or multiple of the number of rows [13]
2: In FUN(X[[4L]], ...) :
  data length [50] is not a sub-multiple or multiple of the number of rows [13]
3: In FUN(X[[4L]], ...) :
  data length [50] is not a sub-multiple or multiple of the number of rows [13]
4: In FUN(X[[4L]], ...) :
  data length [50] is not a sub-multiple or multiple of the number of rows [13]

Any suggestion? Thanks

Pablo

Richard Chandler

unread,
Dec 29, 2011, 6:26:45 PM12/29/11
to unma...@googlegroups.com
Hi Pablo,

Thanks for catching this mistake in the example. Change it to this and it should work:

umf <- unmarkedMultFrame(y=y,
siteCovs = data.frame(site=site),
obsCovs=list(occasion=occasions),
yearlySiteCovs=list(year=years), # list not data.frame
numPrimary=T)

Richard

_____________________________________
Richard Chandler
USGS Patuxent Wildlife Research Center
301-497-5696

-----unma...@googlegroups.com wrote: -----


To: <unma...@googlegroups.com>
From: Pablo García Díaz <her...@hotmail.com>
Sent by: unma...@googlegroups.com
Date: 12/29/2011 01:37PM
Subject: [unmarked] unmarkedMultFrame

Marc J. Mazerolle

unread,
Jan 23, 2012, 10:40:31 AM1/23/12
to unma...@googlegroups.com
Hi Chris,

For your info, AICcmodavg now supports models fit with the distsamp( ) and gdistsamp( ) functions, including model-averaging beta estimates of parameters on abundance. The new version is now on CRAN.


Best,

Marc
-- 
____________________________________
Marc J. Mazerolle
Centre d'étude de la forêt
Université du Québec en Abitibi-Témiscamingue
445 boulevard de l'Université
Rouyn-Noranda, Québec J9X 5E4, Canada
Tel: (819) 762-0971 ext. 2458
Email: marc.ma...@uqat.ca


-------- Message initial --------
De: Chris Hamm <tophe...@gmail.com>
À: unmarked <unma...@googlegroups.com>
Sujet: Re: RE : [unmarked] AICcmodavg
Date: Tue, 27 Dec 2011 11:12:27 -0800

Chris Hamm

unread,
Jan 24, 2012, 12:33:25 PM1/24/12
to unmarked
Hi Richard,

I created the data.frame as suggested with one row and a column for
each parameter of interest (Predicted, SE, lower, and upper) and I get
an error:

a <- array(dim=c(1,4))
a <- as.data.frame(a)

predict(j4.h.list, type='state', newdata = data.frame(a))
Error in E %*% wts : requires numeric/complex matrix/vector arguments
In addition: Warning messages:
1: 'newdata' had 1 rows but variable(s) found have 27 rows
2: 'newdata' had 1 rows but variable(s) found have 27 rows

Thoughts?


On Dec 29 2011, 9:49 am, Richard Chandler <rchand...@usgs.gov> wrote:
> Hi Chris,
>
> You are seeing model-averaged density estimates for the observed covariate values at each of your 26 sites. If you want a single density estimate, create a data.frame with 1 row for the covariate values of interest, and use something like:
>
> predict(j4.h.list, type='state', newdata=someDataFrame)
>
> Richard
>
> _____________________________________
> Richard Chandler
> USGS Patuxent Wildlife Research Center
> 301-497-5696
>
> -----unma...@googlegroups.com wrote: -----
>
> To: unmarked <unma...@googlegroups.com>
> From: Chris Hamm <topher.h...@gmail.com>

Richard Chandler

unread,
Jan 24, 2012, 2:24:39 PM1/24/12
to unma...@googlegroups.com
Hi Chris,

The "newdata" data.frame should contain the values of the covariates for which you want predictions. In your example, "a" has no values. They are all NA. I'm not familiar with your data, but if "Unit" is a factor with 3 levels, say "a", "b", and "c", then you could do something like this:

newdata <- data.frame(Unit=c("a", "b", "c"))
predict(j4.h.list, type='state', newdata = newdata)

or, if you want a prediction for a single level, try this:

newdata <- data.frame(Unit=factor("a", levels=c("a", "b", "c")))
predict(j4.h.list, type='state', newdata = newdata)


Hope this helps.

Richard

_____________________________________
Richard Chandler, post-doc
USGS Patuxent Wildlife Research Center
301-497-5696



From: Chris Hamm <tophe...@gmail.com>
To: unmarked <unma...@googlegroups.com>
Date: 01/24/2012 12:33 PM
Subject: Re: RE : [unmarked] AICcmodavg
Sent by: unma...@googlegroups.com


Reply all
Reply to author
Forward
0 new messages