Problems with function occu

77 views
Skip to first unread message

Manuel Spínola

unread,
Jan 29, 2015, 4:58:18 PM1/29/15
to unma...@googlegroups.com
Dear list members,

I am running a simple data set to fit an occupancy model in unmarked but I get an error.

variables
> dput(v)
structure(list(cob = c(0.9224113, 0.909776329, 0.967859144, 0.964839337, 
0.958391351, 0.711235437, 0.95074548, 0.954493767, 0.763810755, 
0.887282773, 0.862826, 0.651533262, 0.812919985, 0.70937, 0.826294, 
0.907559, 0.595434, 0.8797, 0.876671, 0.949974, 0.692041), dp = c(336.2957578, 
3934.906116, 4645.648181, 2039.991882, 3104.294154, 1258.992179, 
2472.790724, 2172.683993, 2907.983098, 2243.802209, 4153.566842, 
5599.975331, 3581.251043, 1121.918116, 3153.179999, 2475.440586, 
2594.476897, 2842.426909, 4752.51738, 3510.225133, 3155.688181
), dc = c(0, 141.42136, 452.76926, 1209.33866, 1051.1898, 300, 
350, 1453.44419, 2178.30209, 1947.43421, 50, 291.54759, 430.11626, 
150, 70.71068, 1070.04673, 427.20019, 552.26805, 901.38782, 1059.48101, 
70.71068)), .Names = c("cob", "dp", "dc"), class = "data.frame", row.names = c(NA, 
-21L))

detection history

> dput(p)
structure(list(y.1 = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 
NA, NA, 0L, 0L, 0L, 0L, 0L, NA, 0L, 1L, 0L), y.2 = c(0L, 0L, 
1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L), y.3 = c(0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 
0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), y.4 = c(0L, 0L, 
1L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L), y.5 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L), y.6 = c(1L, 1L, 
1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 1L, 0L), y.7 = c(0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), y.8 = c(1L, 0L, 
0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L), y.9 = c(0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L), y.10 = c(0L, NA, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
1L, 0L, 0L)), .Names = c("y.1", "y.2", "y.3", "y.4", "y.5", "y.6", 
"y.7", "y.8", "y.9", "y.10"), class = "data.frame", row.names = c(NA, 
-21L))

Organize data

site.covs = v[, c("cob", "dp", "dc")]

datos = unmarkedFrameOccu(y = p, siteCovs = site.covs)

Fit model

> mod1 <- occu(~ 1, ~ 1, datos)
Error in occu(~1, ~1, datos) : Data is not an unmarkedFrameOccu object.

unmarked is telling me that "datos" is not an unmarkedFrameOccu object, but I don´t understand why?

> class(datos)
[1] "unmarkedFrameOccu"
attr(,"package")
[1] "unmarked"


--
Manuel Spínola, Ph.D.
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspi...@una.ac.cr
mspin...@gmail.com
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036
Personal website: Lobito de río
Institutional website: ICOMVIS

Richard Chandler

unread,
Jan 29, 2015, 5:42:19 PM1/29/15
to Unmarked package
Hi Manuel,

You need "~1 ~1" instead of "~1, ~1". The "double formula" is a bit odd, and I wish we have never implemented it in the first place.

Richard




--
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.



--
Richard Chandler
Assistant Professor
Warnell School of Forestry and Natural Resources
University of Georgia

Manuel Spínola

unread,
Jan 29, 2015, 5:46:42 PM1/29/15
to unma...@googlegroups.com
Thank you very much Richard. My bad.

I didn´t see that, I used before and didn´t think on that.

Manuel
Reply all
Reply to author
Forward
0 new messages