The question about offset in a brms fit

I am trying to understand the interaction effect on cNo (number of some plant) ,

I got my observed data of plant numbers from some 2m*2m square.

I want to use a poission distribution in my model, I can’t just divide by 4 to calculate the density in each of these squares.

So, I used offset, but weather I used +offset(log(area)), or +offset(log(4)), or +offset(log(100)), ps:all area were 4 in my data as the squares area.

but, I got the same result when I used these different offset in my models, it doesn’t seem to be working, what is the problem?

The code I used is written below, thank you very much everybody!

fit_number<-brm(formula=cNo~canopy*year2+(1|plot)+offset(log(100)),
family = poisson(),
data=data_culm_structure,
seed=1,
prior=c(set_prior("",class=“Intercept”),
set_prior("",class=“sd”)),
chains=4,
iter=5000,
warmup=2000,
thin=1,
control = list(adapt_delta=0.97,max_treedepth = 15,stepsize=0.001))

I need some help to this question

Hey @wucco12345 and sorry for the long wait. I guess it is vacation time for most of here.
I think your problem might be that you can’t use a numerical value for your offset but have to use a variable in your data instead.
I have never used offsets so I am not sure what they do and can’t help you with what should be in that column but you should be able to add a column to your data and do + offset(offset_column) with it.

Mr. scholz

thank you very much for your answer,

I try to use +offset(log(area)) in my models, and that area was a column of

my data, the values were 4.

Could it be that, because the area is the same for each sample, the whole offset thing doesn’t make a difference?

I am also not sure what you are using it for. Maybe you could explain that again.
My understanding is that you try to model the count of some plant in each square. What do you need the offset for exactly?

1 Like