Model fitting function not recognising the unmarkedFrame object

31 views
Skip to first unread message

Vaughn Bodden

unread,
Apr 15, 2020, 4:38:33 PM4/15/20
to unmarked
Hi all,


I am trying to fit a model with repeated counts. I have used unmarked before and have successfully fitted functions in the library in the past but have no clue what is wrong here. 

I keep getting the error when I run the code below. any ideas at what is causing this? 

"Error in pcount(~1, ~1, occu_umf) : 
  Data is not an unmarkedFramePCount object."  




# observation data

R <- 16 # number of sites

J <- 11 # number of visits

y <- matrix(c(
  1,1,1,0,0,3,1,0,1,0,NA,
  1,1,2,1,0,1,2,1,1,4,NA,
  1,0,0,0,2,0,1,1,0,NA,NA,
  1,0,0,2,1,0,2,1,1,NA,NA,
  1,1,1,3,1,2,3,2,0,0,NA,
  0,0,1,0,0,1,0,1,1,1,NA,
  0,1,0,2,0,1,0,1,0,NA,NA,
  1,0,0,0,1,1,1,0,1,0,NA,
  0,2,0,0,0,0,0,0,0,0,1,
  1,1,0,2,1,1,0,1,1,2,NA,
  0,0,0,0,0,0,0,1,1,NA,NA,
  0,0,0,0,0,0,0,0,0,0,0,
  3,0,1,1,1,0,0,1,0,0,1,
  0,0,1,2,0,1,1,0,0,0,NA,
  0,0,1,2,0,1,0,0,0,0,NA,
  1,0,0,0,0,0,0,0,0,0,0)
  , nrow=R, ncol=J, byrow=TRUE)


occu_umf<-unmarkedFramePCount(y = y) 

test<-pcount(~1,~1,occu_umf)

Ken Kellner

unread,
Apr 15, 2020, 5:04:50 PM4/15/20
to unmarked
Hi,

The abundance and detection formulas need to be combined into a single double right-hand-side formula, rather than being provided as two arguments. pcount is expecting the second argument to be the data but in your example it's a formula.

This should work:

test<-pcount(~1~1, occu_umf)

Ken

Vaughn Bodden

unread,
Apr 16, 2020, 10:32:22 AM4/16/20
to unmarked
Aha, I see... it's always something minor...

Thanks!!!

Vaughn
Reply all
Reply to author
Forward
0 new messages