Would value advice on obtaining marginal effects of variables fitted with polynomial terms.

df$year3<-df$year^3

count~year+year3+offset(log(PY)),family=poisson,data=df,

marginal_effects provides estimates for year and year3 separately, but can I obtain the effect of year allowing for year cubed too? Thanks for advice.

I think you should use following formula:

```
count ~ year + I(year^3) + offset(log(PY)), family = poisson, data = df,
```

That said, Iām not sure if it makes more sense to also include the quadratic term?

```
count ~ year + I(year^2) + I(year^3) + offset(log(PY)), family = poisson, data = df,
```

1 Like

Exactly how Daniel says and I also agree that you should include the quadratic term as well.

Excellent, thank you for the replies.