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