Skip to content

Commit

Permalink
Merge pull request #25 from hmecology/ranef_updates
Browse files Browse the repository at this point in the history
Consolidate `ranef` methods
  • Loading branch information
kenkellner authored Aug 22, 2024
2 parents 50462a0 + 638ed32 commit 5ad6b0d
Show file tree
Hide file tree
Showing 27 changed files with 644 additions and 806 deletions.
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: unmarked
Version: 1.4.1.9016
Date: 2024-08-21
Version: 1.4.1.9017
Date: 2024-08-22
Type: Package
Title: Models for Data from Unmarked Animals
Authors@R: c(
Expand Down Expand Up @@ -47,12 +47,13 @@ LazyData: yes
Collate: 'classes.R' 'unmarkedEstimate.R' 'unmarkedFrame.R'
'unmarkedFit.R' 'utils.R' 'getDesign.R'
'fitted.R' 'residuals.R' 'update.R' 'simulate.R' 'nonparboot.R' 'getP.R'
'ranef.R' 'posteriorSamples.R'
'colext.R' 'distsamp.R'
'multinomPois.R' 'occu.R' 'occuRN.R' 'occuMulti.R' 'pcount.R' 'gmultmix.R'
'pcountOpen.R' 'gdistsamp.R' 'unmarkedFitList.R' 'unmarkedLinComb.R'
'ranef.R' 'parboot.R' 'occuFP.R' 'gpcount.R' 'occuPEN.R' 'pcount.spHDS.R'
'parboot.R' 'occuFP.R' 'gpcount.R' 'occuPEN.R' 'pcount.spHDS.R'
'occuMS.R' 'occuTTD.R' 'distsampOpen.R' 'multmixOpen.R'
'unmarkedCrossVal.R' 'piFun.R' 'vif.R' 'makePiFun.R' 'posteriorSamples.R'
'unmarkedCrossVal.R' 'piFun.R' 'vif.R' 'makePiFun.R'
'nmixTTD.R'
'gdistremoval.R'
'plotEffects.R'
Expand Down
4 changes: 2 additions & 2 deletions R/IDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,8 @@ setMethod("nonparboot_internal", "unmarkedFitIDS",
stop("Not currently supported for unmarkedFitIDS", call.=FALSE)
})

setMethod("ranef", "unmarkedFitIDS",
function(object, B = 0, keepOldSamples = TRUE, ...)
setMethod("ranef_internal", "unmarkedFitIDS",
function(object, ...)
{
stop("Not currently supported for unmarkedFitIDS", call.=FALSE)
})
2 changes: 1 addition & 1 deletion R/gdistremoval.R
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ setMethod("residuals_internal", "unmarkedFitGDR", function(object){

# ranef

setMethod("ranef", "unmarkedFitGDR", function(object){
setMethod("ranef_internal", "unmarkedFitGDR", function(object, ...){

M <- numSites(object@data)
T <- object@data@numPrimary
Expand Down
2 changes: 1 addition & 1 deletion R/goccu.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ setMethod("fitted_internal", "unmarkedFitGOccu", function(object){


# based on ranef for GPC
setMethod("ranef", "unmarkedFitGOccu", function(object, ...){
setMethod("ranef_internal", "unmarkedFitGOccu", function(object, ...){

M <- numSites(object@data)
JT <- obsNum(object@data)
Expand Down
2 changes: 1 addition & 1 deletion R/occuCOP.R
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ setMethod("nonparboot_internal", "unmarkedFitOccuCOP",


## ranef ----
setMethod("ranef", "unmarkedFitOccuCOP", function(object, ...) {
setMethod("ranef_internal", "unmarkedFitOccuCOP", function(object, ...) {
# Sites removed (srm) and sites kept (sk)
srm <- object@sitesRemoved
if (length(srm) > 0) {
Expand Down
1 change: 1 addition & 0 deletions R/posteriorSamples.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ setMethod("posteriorSamples", "unmarkedRanef", function(object, nsims=100, ...)
out <- array(NA, c(N, T, nsims))

for (n in 1:N){
if(any(is.na(object@post[n,,]))) next
for (t in 1:T){
out[n, t, ] <- sample(0:(K-1), nsims, replace=TRUE,
prob=object@post[n,,t])
Expand Down
Loading

0 comments on commit 5ad6b0d

Please sign in to comment.