Skip to content

Why can't I replicate the lognormal model in sdmTMB with other methods? #132

Discussion options

You must be logged in to vote

The issue is that sdmTMB implements the widely used bias correction factor for the lognormal distribution, -sigma^ 2 / 2.0. This is in the code here:

tmp_ll = sdmTMB::dlnorm(y_i(i,m), log(mu_i(i,m)) - pow(phi(m), Type(2)) / Type(2), phi(m), true);

The above approaches -- which either log-transform then fit a model with a Gaussian response, or use a lognormal family with an identity link, don't include the bias correction term.

You could fit the same model yourself, with the following Stan code

cat("data {
  int<lower=1> N;  // total number of observations
  vector[N] Y;  // response variable
  int<lower=1> K;  // number of popula…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ericward-noaa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant