0
$\begingroup$

I want to model a negative relationship of count/binary data over 10 years with a known value for the decline rate (in percentage). However, I have problems in calculating the correct slope value for the trend.

Let´s say, I know that the starting value for the response is 50 (intercept value) and that the slope should be a decline of 5% per year.

The slope of the regression line shows the amount of change in the response per 1 unit X. So, in the Gaussian case, I would calculate the 5% of 50 (which is 2.5) and set the slope = 2.5. But this is not true for the poisson or binomial case as we are dealing with log-differences (poisson case).

My question thus is: "How do I translate my percentage decline rate into a slope value for a poisson or binomial model?"

So far I tried this...

    #### POISSON EXAMPLE

## load libraries and source sim.glmm.r from github
library(lme4)
library(visreg)
source("https://raw.githubusercontent.com/pcdjohnson/sim.glmm/master/sim.glmm.R")

## create a data frame with known sampling design
mydata<-expand.grid(SAMPLE=1:20,SUBSAMPLE=1:10, year=1:10) 
mydata$SAMPLE<-factor(mydata$SAMPLE)
mydata$SUBSAMPLE<-factor(mydata$SUBSAMPLE)

## create my slope value
myIntercept <- 50
AnnualPercentageDecline <- 0.05 #(=5%)
mySLOPE <- myIntercept * AnnualPercentageDecline

## simulate data with sim.glmm - here, "year" requires the declining slope
sim.data <- sim.glmm(design.data = mydata, 
              fixed.eff = list(intercept = log(50), year = -(mySLOPE)),
              rand.V = c(SAMPLE = 5, SUBSAMPLE = 1),
              distribution = 'poisson')


## perform the glmer model
mydata.temp<-(glmer(response~ year +(1+year|SAMPLE)+
(1+year|SUBSAMPLE),family="poisson",data=sim.data))

## visualize output
par(mfrow=c(1,3))
visreg(mydata.temp, scale="linear")
par(mfrow=c(1,1))

## END
$\endgroup$
1
  • 1
    $\begingroup$ 5% per year is not 50% over 10 years unless change is linear. For anything ecological or environmental, exponential decline is much more likely. I think you're conflating distribution family with link function here. Binomial distribution does not imply log link! It's also unclear how far your question is about (1) statistical ideas or (2) how to do this in your adopted software. (2) is off-topic here. I suggest rewriting your question to focus on what you are asking statistically. $\endgroup$ – Nick Cox Apr 7 '15 at 9:49
1
$\begingroup$

Linear decline of 2.5 units/year in your Gaussian example is not the same as a decline of 5% per year (as Nick Cox points out). If the response is reduced by 5% each year, then it's being multiplied by 0.95 each year. E.g.:

Linear decline: year1 = 50 - 2.5 * 0 = 50; year10 = 50 - 2.5 * 9 = 27.5

Exponential decline: year1 = 50 * 0.95^0 = 50; year10 = 50 * 0.95^9 = 31.5

NB the intercept in this example isn't the same as the response in year 1 unless year 1 has the value 0, not 1 as in your code.

Do you definitely want to model linear decline and not exponential decline? I don't know a simple way of modelling linear decline in counts. To simulate exponential decline in the Poisson example (which is much easier due to the log link) change

fixed.eff = list(intercept = log(50), year = -(mySLOPE))

to

fixed.eff = list(intercept = log(50), year = log(0.95))

and

mydata<-expand.grid(SAMPLE=1:20,SUBSAMPLE=1:10, year=1:10)

to

mydata<-expand.grid(SAMPLE=1:20,SUBSAMPLE=1:10, year=0:9)

Also,

(1+year|SAMPLE)+(1+year|SUBSAMPLE)

fits random slopes and intercepts, whereas only random intercepts have been simulated in the data. This might be what you want, but to fit the intercepts-only model, change to

(1|SAMPLE)+(1|SUBSAMPLE)

The same applies to a binomial model with a logit link provided you want to model a 5% annual decline in the odds.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.