[R] Population abundance, change point

Michael Bedward michael.bedward at gmail.com
Wed Nov 17 07:47:54 CET 2010

Hi Nick,

I've used MCMC to fit change point regressions to a variety of
ecological data and prefer this approach to strucchange and similar
because I feel I have more control over the model, ie. I find it
easier to tailor the form of the model to biological / demographic
processes. I also find the imputing of missing response data more
straightforward with MCMC - at least when they are some distance from
potential changepoint(s).

Most recently I've used JAGS via the rjags package to do such models.

As an example, here is a toy model that looks for a single
change-point after which there is a change in slope (time trend) in
the data

model {
  # y[i] is population data
  # N is number of (regular) observations
  for (i in 1:N) {
    y[i] ~ dnorm(mu[i], tau)
    mu[i] <- b0 + i*(b1 + b1cp*step(cp - i))

  # intercept
  b0 ~ dnorm(0, 1.0e-6)

  # pre-change slope
  b1 ~ dnorm(0, 1.0e-6)

  # post-change slope
  b1cp ~ dnorm(0, 1.0e-6)

  # change point location (time)
  cp ~ dunif(2, N-1)

  # variance (assumed equal either side of change)
  sd ~ dunif(0.01, 100)
  tau <- pow(sd, -2)

The step() function returns 1 when its argument is positive, and 0
otherwise. As a result, the slope is b1 before the change (time = cp)
and b1 + b1cp after the change.

You can easily modify this model to, for instance...
- assume 0 slope  but different intercepts either side of the change
- allow for change in variance; or variance proportional to mean etc.
- impute missing response data


On 17 November 2010 09:30, Nicholas M. Caruso <carusonm at gmail.com> wrote:
> I am trying to understand my population abundance data and am looking into
> analyses of change point to try and determine, at approximately what point
> do populations begin to change (either decline or increasing).
> Can anyone offer suggestions on ways to go about this?
> I have looked into bcp and strucchange packages but am not completely
> convinced that these are appropriate for my data.
> Here is an example of what type of data I have
> Year of survey (continuous variable) 1960 - 2009 (there are gaps in the
> surveys (e.g., there were no surveys from 2002-2004)
> Relative abundance of salamanders during the survey periods
> Thanks for your help, Nick
> --
> Nicholas M Caruso
> Graduate Student
> CLFS-Biology
> 4219 Biology-Psychology Building
> University of Maryland, College Park, MD 20742-5815
> ------------------------------------------------------------------
> I learned something of myself in the woods today,
> and walked out pleased for having made the acquaintance.
>        [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list