aboutsummaryrefslogtreecommitdiff
path: root/R/distsampOpen.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/distsampOpen.R')
-rw-r--r--R/distsampOpen.R18
1 files changed, 1 insertions, 17 deletions
diff --git a/R/distsampOpen.R b/R/distsampOpen.R
index 92588a4..c062a0f 100644
--- a/R/distsampOpen.R
+++ b/R/distsampOpen.R
@@ -85,23 +85,7 @@ distsampOpen <- function(lambdaformula, gammaformula, omegaformula, pformula,
last <- apply(!ytna, 1, function(x) max(which(x)))
first1 <- which(first==1)[1]
- #K stuff
- if(missing(K)) {
- K <- max(y, na.rm=T) + 20
- warning("K was not specified and was set to ", K, ".")
- }
-
- J <- ncol(data@y) / data@numPrimary
- inds <- split(1:ncol(data@y), ceiling(1:ncol(data@y)/J))
- Tobs <- sapply(1:length(inds), function(i){
- rowSums(data@y[,inds[[i]], drop=FALSE], na.rm=TRUE)
- })
- Kmin <- max(Tobs, na.rm=TRUE)
-
- if(K < Kmin){
- stop("Specified K is too small, must be larger than the max total count in a primary period",
- call.=FALSE)
- }
+ K <- check_K_multinomial(K, K_adjust = 20, D$y, T) # in utils.R
k <- 0:K
lk <- length(k)
#Some k-related indices to avoid repeated calculations in likelihood