Hi, I think I may have uncovered a bug in dht2 -
I am currently working on some data to develop abundance estimates for penguins and seals. We have data taken from ship surveys and aerial surveys.
I have fitted two detection functions, one for each transect type, and want to combine these into one overall density and abundance estimate. I have used dht2 to specifiy the dataframes with observations and transect information, with ddf_id specifiying which detection function applies. There is no stratification necessary. However, when I run it, the Effort and therefore, Covered Area double. The number of sightings remains unchanged, and so the outcomes are roughly half of what I expect. I have checked my dataframes for repeat observations and that the correct lengths are provided to dht2.
When I run them individually using summary() their densities are 0.64 and 0.61, when run together in dht2, the density is 0.28.
Here is some code I wrote using minke to show what I mean, I have removed the stratification, and used 'north' and 'south' as how I treated my 'aerial' and 'ship' transects, producing individual detection functions and specifing that to dht2.
Please let me know if I have gone wrong somewhere, or you need more information. Thanks!
`library(Distance)
data(minke)
minke$Platform <- factor(minke$Region.Label, levels = c("North", "South"))
minke$ddf_id <- as.numeric(minke$Platform)
minke$Region.Label <- 'All'
minke.north <- subset(minke, Platform != 'South')
minke.north.ds <- ds(minke.north, truncation = 1)
minke.south <- subset(minke, Platform != 'North')
minke.south.ds <- ds(minke.south, truncation = 1)
minke.ddf <- list(minke.north.ds, minke.south.ds)
minke.obs <- unique(data.frame(
object = minke$object,
Sample.Label = minke$Sample.Label,
distance = minke$distance,
Region.Label = "All",
ddf_id = minke$ddf_id))
minke.effort <- unique(data.frame(
Sample.Label = minke$Sample.Label,
Effort = c(minke$Effort),
Region.Label = "All",
ddf_id = minke$ddf_id,
Platform = minke$Platform))
minke.strat <- data.frame(Region.Label = 'All', Area = sum(unique(minke$Area)))
minke.dht <- dht2(
observations = minke.obs,
transects = minke.effort,
geo_strat = minke.strat,
ddf = minke.ddf,
binomial_var = FALSE,
strat_formula = ~1)
minke.dht
sum(minke.effort$Effort)`
Hi, I think I may have uncovered a bug in dht2 -
I am currently working on some data to develop abundance estimates for penguins and seals. We have data taken from ship surveys and aerial surveys.
I have fitted two detection functions, one for each transect type, and want to combine these into one overall density and abundance estimate. I have used dht2 to specifiy the dataframes with observations and transect information, with ddf_id specifiying which detection function applies. There is no stratification necessary. However, when I run it, the Effort and therefore, Covered Area double. The number of sightings remains unchanged, and so the outcomes are roughly half of what I expect. I have checked my dataframes for repeat observations and that the correct lengths are provided to dht2.
When I run them individually using summary() their densities are 0.64 and 0.61, when run together in dht2, the density is 0.28.
Here is some code I wrote using minke to show what I mean, I have removed the stratification, and used 'north' and 'south' as how I treated my 'aerial' and 'ship' transects, producing individual detection functions and specifing that to dht2.
Please let me know if I have gone wrong somewhere, or you need more information. Thanks!
`library(Distance)
data(minke)
minke$Platform <- factor(minke$Region.Label, levels = c("North", "South"))
minke$ddf_id <- as.numeric(minke$Platform)
minke$Region.Label <- 'All'
minke.north <- subset(minke, Platform != 'South')
minke.north.ds <- ds(minke.north, truncation = 1)
minke.south <- subset(minke, Platform != 'North')
minke.south.ds <- ds(minke.south, truncation = 1)
minke.ddf <- list(minke.north.ds, minke.south.ds)
minke.obs <- unique(data.frame(
object = minke$object,
Sample.Label = minke$Sample.Label,
distance = minke$distance,
Region.Label = "All",
ddf_id = minke$ddf_id))
minke.effort <- unique(data.frame(
Sample.Label = minke$Sample.Label,
Effort = c(minke$Effort),
Region.Label = "All",
ddf_id = minke$ddf_id,
Platform = minke$Platform))
minke.strat <- data.frame(Region.Label = 'All', Area = sum(unique(minke$Area)))
minke.dht <- dht2(
observations = minke.obs,
transects = minke.effort,
geo_strat = minke.strat,
ddf = minke.ddf,
binomial_var = FALSE,
strat_formula = ~1)
minke.dht
sum(minke.effort$Effort)`