Re: [unmarked] Error message: Non-numeric argument to mathematical function

1,346 views
Skip to first unread message

Jeffrey Royle

unread,
Jan 4, 2013, 1:32:11 PM1/4/13
to unma...@googlegroups.com
hi Joe,
 I can't say for sure. Do you have any missing values in covariates that are being used?
andy


 
On Fri, Jan 4, 2013 at 12:10 PM, <jcl...@utk.edu> wrote:
I'm trying to fit a removal model and I keep getting the following error message:
Error in dpois(x, lambda, log) :
  Non-numeric argument to mathematical function
Anyone know what this is about?
Thanks!
Joe

jcl...@utk.edu

unread,
Jan 4, 2013, 1:46:14 PM1/4/13
to unma...@googlegroups.com
Hi Andy,
No, but I do have some negative numbers for obsCovs (minutes from sunrise).
Regardless, I get the same message when I run the model without any covariates...

Richard Chandler

unread,
Jan 4, 2013, 1:59:28 PM1/4/13
to Unmarked package
Hi Joe,

Are you using multinomPois() or gmultmix()? Can you show some of the code you used to format the data and fit the model?

Richard

Clark, Joseph D

unread,
Jan 4, 2013, 2:01:27 PM1/4/13
to unma...@googlegroups.com

Thanks Richard;

Here’s the code:

 

bwhistory=read.table(file = "bwmatrix.txt", colClasses = "character", sep = "\t")

bwmatrix= as.matrix(bwhistory) #Creates matrix from imported data

bwsitecov=read.table(file = "bwsitecov.txt", header = TRUE, sep = "\t")

bwobscov=read.table(file = "bwobscov.txt", header = TRUE, sep = "\t")

bwFrame <- unmarkedFrameMPois(y=bwmatrix, siteCovs=bwsitecov,

    type="removal") #need to add observation level covariates

# fit models

fm.bw.1 = multinomPois(~1 ~1, bwFrame)

 

Attached are the 3 txt files I’m using.  I’m having trouble getting unmarkedFrameMPois to work when I specify obsCovs too.

Any help is greatly appreciated!

Joe

 

Joseph D. Clark, Ph.D.

Branch Chief

USGS Southern Appalachian Research Branch

274 Ellington Plant Sciences Building

University of Tennessee

Knoxville, TN 37996

865-974-4790

jcl...@utk.edu

bwmatrix.txt
bwsitecov.txt
bwobscov.txt

Richard Chandler

unread,
Jan 4, 2013, 2:24:12 PM1/4/13
to Unmarked package
Hi Joe,

The counts in the object "bwmatrix" were characters instead of integers. Also, your covariates are all considered "siteCovs" by unmarked because they have a single value per site. This code seems to work:

bwmatrix <- read.table(file = "bwmatrix.txt", sep = "\t")
bwFrame <- unmarkedFrameMPois(y=bwmatrix,
    siteCovs=cbind(bwsitecov, bwobscov),
    type="removal") 
summary(bwFrame)

# fit models
fm.bw.1 = multinomPois(~1 ~1, bwFrame)
fm.bw.2 = multinomPois(~DOY+MSS ~ Cover, bwFrame)


Hope this helps.

Richard

Clark, Joseph D

unread,
Jan 4, 2013, 2:27:54 PM1/4/13
to unma...@googlegroups.com

Richard:
You could have made me feel a little better if you’d taken longer to fix this!  Really, thanks for your help.

Richard Chandler

unread,
Jan 4, 2013, 2:30:36 PM1/4/13
to Unmarked package
Oops, sorry about that ;-)
Reply all
Reply to author
Forward
0 new messages