Bug in RPresence 2.12.26?
				
Posted: 
Wed Mar 27, 2019 4:04 pmby monkr
				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
 
			
				Re: Bug in RPresence 2.12.26?
				
Posted: 
Wed Mar 27, 2019 4:11 pmby darryl
				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
			 
			
				Re: Bug in RPresence 2.12.26?
				
Posted: 
Wed Mar 27, 2019 4:16 pmby monkr
				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(.)")
 
			
				Re: Bug in RPresence 2.12.26?
				
Posted: 
Thu Mar 28, 2019 6:35 pmby darryl
				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
			 
			
				Re: Bug in RPresence 2.12.26?
				
Posted: 
Thu Mar 28, 2019 8:42 pmby jhines
				I've fixed the bug.  Please download new version, 2.12.27.
			 
			
				Re: Bug in RPresence 2.12.26?
				
Posted: 
Fri Mar 29, 2019 1:51 pmby monkr
				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.
			 
			
				Re: Bug in RPresence 2.12.26?
				
Posted: 
Fri Mar 29, 2019 3:49 pmby jhines
				Hi Nathan,
Sorry you're still having trouble.  Please send me the exercise data and I'll take a look.
Jim
			 
			
				Re: Bug in RPresence 2.12.26?
				
Posted: 
Thu Apr 11, 2019 9:25 amby jhines
				I've fixed the bug in the import function.  Please download the latest version and let me know if you have any trouble.
Jim