Skip to content

Stratum-specific multipliers in dht2 does not work #205

Description

@erex

Workshop participant has done indirect survey of orangutan nests in multiple strata. She has stratum-specific nest decay rates (or mean persistence times). dht2 is supposed to be able to deal with this according to dht2 help:

You can use a multirow data.frame to have different rates for different geographical areas (for example). In this case the rows need to have a column (or columns) to merge with the data (for example Region.Label).

Applying the help instructions resulted in a cryptic error message for her; I created this minimum reproducible example, fabricating multipliers to apply to the minke two stratum data set shipped in the Distance package:

library(Distance)
data(minke)
mult.list <- list(creation=data.frame(Region.Label=c("North", "South"),rate=2, SE=1),
                  decay=data.frame(Region.Label=c("North", "South"), rate=c(0.5, 0.2), SE=c(0.1, 0.05)))
print(mult.list)
fitmod <- ds(minke, key="hr", truncation=1.5)
adjust.mult <- dht2(ddf=fitmod, flatfile = minke, 
                    strat_formula = ~Region.Label, multipliers = mult.list)

Results in this error

Error in ii == "decay" && multipliers[[ii]]$SE != 0 : 
  'length = 2' in coercion to 'logical(1)'

Running in debug mode, I traced the error to line 60 in the function dht2_multipliers.

It is not clear what that line of code is trying to do. As an aside, although the help notes there needs to be a merge using the stratum labels, I could not find any merges taking place in this function, even though a comment early in the function states that a merge is about to happen.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions