Bug in RPresence 2.12.26?

posts related to the RPresence library, which may not be of general interest to users of 'classic' PRESENCE.

Bug in RPresence 2.12.26?

Postby monkr » Wed Mar 27, 2019 4:04 pm

I believe there may be a bug in RPresence. When trying to run a multi-scale model (from an exercise in the Advance training course):

Code: Select all
m1<-occMod(model=list(psi~1,theta~1,p~1),data=camera,type="so.mm", modname = "psi(.),theta(.),p(.)")


I get the following error:
Error in terms.default(object, data = data) : no terms component nor attribute


I had previously run a static single season model without any error, but haven't checked other types of models.

I uninstalled 2.12.26 and installed 2.12.23 (the most recent previous version I had) and this code ran without error. I am using Microsoft R Open 3.5.1.

Nathan
monkr
 
Posts: 7
Joined: Tue Nov 29, 2016 3:27 pm

Re: Bug in RPresence 2.12.26?

Postby darryl » Wed Mar 27, 2019 4:11 pm

Hi Nathan,
Can you please run again, and when you get the error, type in 'traceback()' and post the results to show us where the error is occurring within the code?
Cheers
Darryl
darryl
 
Posts: 495
Joined: Thu Jun 12, 2003 3:04 pm
Location: Dunedin, New Zealand

Re: Bug in RPresence 2.12.26?

Postby monkr » Wed Mar 27, 2019 4:16 pm

Should have thought of that. Here it is:

7: stop("no terms component nor attribute")
6: terms.default(object, data = data)
5: terms(object, data = data)
4: model.matrix.default(gamma, data.frame(rep(1, (data$nunits *
data$nseasons - 1))))
3: model.matrix(gamma, data.frame(rep(1, (data$nunits * data$nseasons -
1))))
2: occMod_mm(psi = e$psi, psi.cov = e$psi.cov, theta = e$theta,
theta.cov = e$theta.cov, p = e$p, p.cov = e$p.cov, gamma = e$gamma,
gamma.cov = e$gamma.cov, epsilon = e$epsilon, epsilon.cov = e$epsilon.cov,
modname = modname, paoname = paoname, outfile = outfile,
fixed = fixed, initvals = initvals, data = data, VCoutopt = VCoutopt,
noDerived = noDerived, randinit = randinit)
1: occMod(model = list(psi ~ 1, theta ~ 1, p ~ 1), data = camera,
type = "so.mm", modname = "psi(.),theta(.),p(.)")
monkr
 
Posts: 7
Joined: Tue Nov 29, 2016 3:27 pm

Re: Bug in RPresence 2.12.26?

Postby darryl » Thu Mar 28, 2019 6:35 pm

Thanks Nathan,
Looks like the function is trying to calculate some gamma values, which it shouldn't be for a single season model. Jim Hines may have recently updated the package with a multi-season (or dynamic) version of the multi-method/multi-scale model. Will have to defer to him on this one.
Cheers
Darryl
darryl
 
Posts: 495
Joined: Thu Jun 12, 2003 3:04 pm
Location: Dunedin, New Zealand

Re: Bug in RPresence 2.12.26?

Postby monkr » Thu Mar 28, 2019 6:48 pm

OK, thanks.
monkr
 
Posts: 7
Joined: Tue Nov 29, 2016 3:27 pm

Re: Bug in RPresence 2.12.26?

Postby jhines » Thu Mar 28, 2019 8:42 pm

I've fixed the bug. Please download new version, 2.12.27.
jhines
 
Posts: 599
Joined: Fri May 16, 2003 9:24 am
Location: Laurel, MD, USA

Re: Bug in RPresence 2.12.26?

Postby monkr » Fri Mar 29, 2019 11:38 am

Thanks!
monkr
 
Posts: 7
Joined: Tue Nov 29, 2016 3:27 pm

Re: Bug in RPresence 2.12.26?

Postby monkr » Fri Mar 29, 2019 1:51 pm

I seem to be having problems with the newest update.

1. Although the model from the multi-scale exercise runs without error, the results are different from what I previously had (= those quoted on the exercise). Psi is the same (0.415), but now theta & p are different. They should be :
## est se lower upper
## unit1_1 0.1772 0.0576 0.0903 0.3185
## est se lower upper
## unit1 _ 1-1 0.3683 0.0567 0.2656 0.4845

Instead I get:

> unique(fitted(m1,"theta"))
est se lower upper
unit1_1 0.1515 0.0473 0.0798 0.2686
> unique(fitted(m1,"p"))
est se lower upper
p1(1-1)_1_unit1 0.5 0 0.5 0.5

2. The following error occurs with models in the same exercise with p~week, it doesn't occur with p~survey, e.g,

m2<-occMod(model=list(psi~1,theta~1,p~week),data=camera,type="so.mm")

Error in VC[p.coeff[, "index"], p.coeff[, "index"]] :
only 0's may be mixed with negative subscripts

> traceback()
2: occMod_mm(psi = e$psi, psi.cov = e$psi.cov, theta = e$theta,
theta.cov = e$theta.cov, p = e$p, p.cov = e$p.cov, gamma = e$gamma,
gamma.cov = e$gamma.cov, epsilon = e$epsilon, epsilon.cov = e$epsilon.cov,
modname = modname, paoname = paoname, outfile = outfile,
fixed = fixed, initvals = initvals, data = data, VCoutopt = VCoutopt,
noDerived = noDerived, randinit = randinit)
1: occMod(model = list(psi ~ 1, theta ~ 1, p ~ week), data = camera,
type = "so.mm")

I've uninstalled and reinstalled 2.12.27, restarted R and get the same result.

One other minor issue: The output to the console states the version as 2.12.26, but I'm running 2.12.27.
monkr
 
Posts: 7
Joined: Tue Nov 29, 2016 3:27 pm

Re: Bug in RPresence 2.12.26?

Postby jhines » Fri Mar 29, 2019 3:49 pm

Hi Nathan,


Sorry you're still having trouble. Please send me the exercise data and I'll take a look.

Jim
jhines
 
Posts: 599
Joined: Fri May 16, 2003 9:24 am
Location: Laurel, MD, USA

Re: Bug in RPresence 2.12.26?

Postby jhines » Thu Apr 11, 2019 9:25 am

I've fixed the bug in the import function. Please download the latest version and let me know if you have any trouble.

Jim
jhines
 
Posts: 599
Joined: Fri May 16, 2003 9:24 am
Location: Laurel, MD, USA

Next

Return to RPresence

Who is online

Users browsing this forum: No registered users and 13 guests