aboutsummaryrefslogtreecommitdiff
path: root/R/unmarkedFit.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/unmarkedFit.R')
-rw-r--r--R/unmarkedFit.R16
1 files changed, 8 insertions, 8 deletions
diff --git a/R/unmarkedFit.R b/R/unmarkedFit.R
index 0a8d107..6557b9d 100644
--- a/R/unmarkedFit.R
+++ b/R/unmarkedFit.R
@@ -1631,13 +1631,13 @@ setMethod("getP", "unmarkedFitDS",
umf <- object@data
designMats <- getDesign(umf, formula, na.rm = na.rm)
y <- designMats$y
- V <- designMats$V
+ V <- cbind(designMats$V, designMats$Z_det)
V.offset <- designMats$V.offset
if (is.null(V.offset))
V.offset <- rep(0, nrow(V))
M <- nrow(y)
J <- ncol(y)
- ppars <- coef(object, type = "det")
+ ppars <- coef(object, type = "det", fixedOnly=FALSE)
db <- umf@dist.breaks
w <- diff(db)
survey <- umf@survey
@@ -1902,13 +1902,13 @@ setMethod("getP", "unmarkedFitMPois", function(object, na.rm = TRUE)
umf <- object@data
designMats <- getDesign(umf, formula, na.rm = na.rm)
y <- designMats$y
- V <- designMats$V
+ V <- as.matrix(cbind(designMats$V, designMats$Z_det))
V.offset <- designMats$V.offset
if (is.null(V.offset))
V.offset <- rep(0, nrow(V))
M <- nrow(y)
J <- obsNum(umf) #ncol(y)
- ppars <- coef(object, type = "det")
+ ppars <- coef(object, type = "det", fixedOnly=FALSE)
p <- plogis(V %*% ppars + V.offset)
p <- matrix(p, M, J, byrow = TRUE)
pi <- do.call(piFun, list(p = p))
@@ -2063,13 +2063,13 @@ setMethod("simulate", "unmarkedFitDS",
w <- diff(db)
designMats <- getDesign(umf, formula, na.rm = na.rm)
y <- designMats$y
- X <- designMats$X
+ X <- as.matrix(cbind(designMats$X, designMats$Z_state))
X.offset <- designMats$X.offset
if (is.null(X.offset))
X.offset <- rep(0, nrow(X))
M <- nrow(y)
J <- ncol(y)
- lamParms <- coef(object, type = "state")
+ lamParms <- coef(object, type = "state", fixedOnly=FALSE)
lambda <- drop(exp(X %*% lamParms + X.offset))
if(identical(object@output, "density")) {
switch(umf@survey,
@@ -2342,14 +2342,14 @@ setMethod("simulate", "unmarkedFitMPois",
umf <- object@data
designMats <- getDesign(umf, formula, na.rm = na.rm)
y <- designMats$y
- X <- designMats$X
+ X <- as.matrix(cbind(designMats$X, designMats$Z_state))
X.offset <- designMats$X.offset
if (is.null(X.offset)) {
X.offset <- rep(0, nrow(X))
}
M <- nrow(y)
J <- ncol(y)
- lamParms <- coef(object, type = "state")
+ lamParms <- coef(object, type = "state", fixedOnly=FALSE)
lam <- as.numeric(exp(X %*% lamParms + X.offset))
lamvec <- rep(lam, each = J)
pivec <- as.vector(t(getP(object, na.rm = na.rm)))