Skip to content

Commit

Permalink
fixed isCatch
Browse files Browse the repository at this point in the history
  • Loading branch information
abigailkeller committed Dec 23, 2024
1 parent 782db9f commit f674956
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions R/detectionCalculate.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ detectionCalculate <- function(modelfit, mu, cov.val = NULL, probability = 0.9,
}

# get n traditional samples
if(isCatch(modelfit@model_pars)){
if(isCatch(modelfit)){
ntrad_out <- get_ntrad_q(modelfit@model_pars, modelfit, mu, probability)
} else {
ntrad_out <- get_ntrad(modelfit@model_pars, modelfit, mu, probability)
Expand All @@ -128,7 +128,7 @@ detectionCalculate <- function(modelfit, mu, cov.val = NULL, probability = 0.9,

# combine into one df - joint model
if(isJoint(modelfit@model_pars)){
if(isCatch(modelfit@model_pars)){
if(isCatch(modelfit)){
out <- cbind(mu,ntrad_out,ndna_out)
#rename columns
trad_names <- c()
Expand All @@ -144,7 +144,7 @@ detectionCalculate <- function(modelfit, mu, cov.val = NULL, probability = 0.9,

# combine into one df - traditional model
if(!isJoint(modelfit@model_pars)){
if(isCatch(modelfit@model_pars)){
if(isCatch(modelfit)){
out <- cbind(mu,ntrad_out)
#rename columns
for(i in 1:modelfit@par_dims$q){
Expand All @@ -165,8 +165,8 @@ isJoint <- function(pars){
out <- ifelse('p10' %in% pars,TRUE,FALSE)
return(out)
}
isCatch <- function(pars){
out <- ifelse('q' %in% pars,TRUE,FALSE)
isCatch <- function(modelfit){
out <- ifelse(modelfit@par_dims$q>0,TRUE,FALSE)
return(out)
}
isNegbin <- function(modelfit){
Expand Down
6 changes: 3 additions & 3 deletions R/jointSummarize.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ isJoint <- function(pars){
out <- ifelse('p10' %in% pars,TRUE,FALSE)
return(out)
}
isCatch <- function(pars){
out <- ifelse('q' %in% pars,TRUE,FALSE)
isCatch <- function(modelfit){
out <- ifelse(modelfit@par_dims$q>0,TRUE,FALSE)
return(out)
}
isNegbin <- function(modelfit){
Expand All @@ -135,7 +135,7 @@ get_all_params <- function(pars,modelfit){
params <- c('mu')

# catchability
if(isCatch(pars)){
if(isCatch(modelfit)){
params <- c(params,'q')
}

Expand Down

0 comments on commit f674956

Please sign in to comment.