Simulates some data suitable for use in sparta The user defines the parameters for the data generation At present it works with just one species and generates the list length probabalistically

simOccData(nsites = 20, nvisits = 100, nTP = 10, psi = 0.5,
  trend = -0.01, mu.lp = -1, tau.lp = 10, beta1 = 0.1,
  beta2 = -0.002, dtype2.p = 3, dtype3.p = 10)

Value

A list, the first two elements of which ('spp_vis' & 'occDetData') mimic the output of occDetFunc. The third element ('Z') is the presence-absence state variable and the fourth ('p') is the true probability of detection.

Examples

# NOT RUN {
# set the sparta options
sparta_options <- c('ranwalk', # prior on occupancy is set by last year's posterior
                   'jul_date', # use the Julian date as a covariate on the detection probability
                   'catlistlength', # categorises the visits into three sets of 'qualities'
                   'halfcauchy') # prior on the precisions

# simulate some data
mydata <- simOccData(nvisit=200, nsite=10, nTP=5, psi=0.5, beta1=0.1, beta2=-2e-3)
with(mydata, plot(occDetdata$Jul_date, p))

# run the occupancy model model
out <- occDetFunc('mysp', mydata$occDetdata, mydata$spp_vis, n_iter = 1e4,
                 modeltype = sparta_options, return_data=TRUE)

out$BUGSoutput
detection_phenology(out)

qplot(data=melt(out$BUGSoutput$sims.array), geom='line',
     x=Var1, col=factor(Var2), y=value) +
 facet_wrap(~Var3, ncol=4, scales='free')

# }