I see in your simulations you are choosing to maintain stochasticity in the survey (single.transect.set=FALSE), yet you do not introduce stochasticity in the population process (via load.data=TRUE). I understand the interest of speeding the simulations, but the inconsistent treatment of stochasticity is unusual--probably best to allow stochasticity to operate both upon the survey and the animals.
Secondly, good programming practice does not use concatenation within loops because of inefficiency (http://www.r-bloggers.com/faster-for-loops-in-r/). Your loop over truncation distances uses c(sims, sim). However, you know the number of elements this list will have:
sims <- vector("list", length(Trun.dists))
so allocate that space prior to entering the loop and use the list element operator [[]] to store each of your simulation objects. That will make the final loop more tidy.
@Kieran-96
I see in your simulations you are choosing to maintain stochasticity in the survey (
single.transect.set=FALSE
), yet you do not introduce stochasticity in the population process (viaload.data=TRUE
). I understand the interest of speeding the simulations, but the inconsistent treatment of stochasticity is unusual--probably best to allow stochasticity to operate both upon the survey and the animals.Secondly, good programming practice does not use concatenation within loops because of inefficiency (http://www.r-bloggers.com/faster-for-loops-in-r/). Your loop over truncation distances uses
c(sims, sim)
. However, you know the number of elements this list will have:so allocate that space prior to entering the loop and use the list element operator
[[]]
to store each of your simulation objects. That will make the final loop more tidy.