Skip to content

wrong number of transects in the summary / data #84

@LHMarshall

Description

@LHMarshall

Transect generation appears correct

image

As does transect IDs within the generated transect shape object

> samplers@samplers
Simple feature collection with 243 features and 2 fields
Geometry type: LINESTRING
Dimension:     XY
Bounding box:  xmin: 0.6181902 ymin: 0 xmax: 1973.233 ymax: 200
CRS:           NA
First 10 features:
   transect strata                       geometry
1         1 strat1 LINESTRING (0.6181902 0, 0....
2         2 strat1 LINESTRING (67.28486 0, 67....
3         3 strat1 LINESTRING (133.9515 0, 133...
4         4 strat1 LINESTRING (200.6182 0, 200...
5         5 strat1 LINESTRING (267.2849 0, 267...
6         6 strat1 LINESTRING (333.9515 0, 333...
7         7 strat1 LINESTRING (400.6182 0, 400...
8         8 strat1 LINESTRING (467.2849 0, 467...
9         9 strat1 LINESTRING (533.9516 0, 533...
10       10 strat1 LINESTRING (600.6182 0, 600...

Number of transects is displayed as around 100 for the segmented design

Number of samplers:  108

However in the simulation results - the mean.k is always 15 (this is correct for strat1 and strat2 but strat3 and strat4 should be ~100) ER se also seems to reflect the wrong k values

Summary Statistics

       mean.Cover.Area mean.Effort    mean.n mean.k   mean.ER mean.se.ER sd.mean.ER
strat1        150000.0    1500.000  881.9329     15 0.5879553 0.08692732 0.01212480
strat2        150000.0    1500.000  880.8468     15 0.5872312 0.02220725 0.01098384
strat3        148419.2    1484.192  874.2893     15 0.5892201 0.04183990 0.03038126
strat4        148867.2    1488.672  873.5165     15 0.5867873 0.02015128 0.02426928
Total         597286.5    5972.865 3510.5856     15 0.5877985 0.02531741 0.01041120

Checking the survey data I can see that the transect IDs are wrong in there

> dat.strat3 <- dist.dat[dist.dat$Region.Label =="strat3",]
> length(unique(dat.strat1$Sample.Label))
[1] 15

Reproducible example

library(dsims)

BL <- matrix(c(0,0,1000,0,1000,100,0,100,0,0),ncol=2, byrow=TRUE)
BR <- matrix(c(1000,0,2000,0,2000,100,1000,100,1000,0),ncol=2, byrow=TRUE)
TL <- matrix(c(0,100,1000,100,1000,200,0,200,0,100),ncol=2, byrow=TRUE)
TR <- matrix(c(1000,100,2000,100,2000,200,1000,200,1000,100),ncol=2, byrow=TRUE)
pol1 <- sf::st_polygon(list(BL))
pol2 <- sf::st_polygon(list(BR))
pol3 <- sf::st_polygon(list(TL))
pol4 <- sf::st_polygon(list(TR))

sfc <- sf::st_sfc(pol1,pol2,pol3,pol4)
strata.names <- c("strat1", "strat2", "strat3", "strat4")
mp1 <- sf::st_sf(strata = strata.names, geom = sfc)

region <- make.region(region.name = "study.area", 
                      strata.name = strata.names, 
                      shape = mp1)
plot(region)


design <- make.design(region,
                      design = c("systematic", "systematic", "segmentedgrid", "segmentedgrid"),
                      #line.length = 6000,
                      spacing = c(66.66667, 66.66667, 28, 28),
                      seg.threshold = 0,
                      seg.length = 20,
                      truncation = 50)

samplers <- generate.transects(design, region)
plot(region, samplers)
samplers

density <- make.density(region, 
                        x.space = 10,
                        constant = rep(1,4))

density <- add.hotspot(density,c(100,100),100,3)
density <- add.hotspot(density,c(500,100),50,1)
density <- add.hotspot(density,c(250,100),80,2)
density <- add.hotspot(density,c(400,100),80,1)

plot(density)

pop.desc <- make.population.description(region,
                                        density,
                                        N = rep(1000,4))

detect <- make.detectability()

analyses <- make.ds.analysis(truncation = 50)

sim <- make.simulation(reps = 3,
                       design,
                       pop.desc,
                       detect,
                       analyses)

eg.survey <- run.survey(sim)
plot(eg.survey)

sim <- run.simulation(sim)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions