Re: [TMB users] Digest for tmb-users@googlegroups.com - 6 updates in 2 topics

66 views
Skip to first unread message

Cole Monnahan - NOAA Federal

unread,
Jul 24, 2023, 11:13:07 AM7/24/23
to tmb-...@googlegroups.com
Try running the model through tmbstan and look at the posterior for the slope compared to the MLE and SE. I'd be surprised if it gives you something meaningfully different but I don't understand the theory of these models well. -Cole

On Fri, Jul 21, 2023 at 9:40 PM <tmb-...@googlegroups.com> wrote:
Cole Monnahan - NOAA Federal <cole.m...@noaa.gov>: Jul 21 09:36AM -0700

I don't see any immediate bugs in the code. I also ran the code with 100
different seeds and your coverage is about 85% for the slope. It appears
slightly positively biased actually. I'm not super familiar with these
models. Would you expect a 95% coverage? -Cole
 
DM Gillis <astros...@gmail.com>: Jul 21 01:19PM -0700

That could be it... I just ran it with one seed and hoped that it would be
well behaved (very naive). I will simulate more and be especially careful
when applying it to real data (including examining repeated simulations
with the fitted model parameters). Thanks for your exploration and all the
best for the weekend!
 
Cheers, Darren
 
 
 
Hans Skaug <hsk...@gmail.com>: Jul 21 12:20AM -0700

Hi, I think this is more a statistical theory question than a question
about TMB. There are different
assumptions that can be made for this model:
https://en.wikipedia.org/wiki/Errors-in-variables_models#Terminology_and_assumptions
 
Your approach seems to add one parameter (del) per observation, which may
be problematic.
 
 
 
 
 
 
DM Gillis <astros...@gmail.com>: Jul 21 05:47AM -0700

Thank you for the quick response. There may be different model assumptions
that work better, but I am interested in this form:
 
https://en.wikipedia.org/wiki/Errors-in-variables_models#Simple_linear_model
 
https://wikimedia.org/api/rest_v1/media/math/render/svg/72c8882e35c59a196c8115548e47a19b0555360e
 
because it would be straight forward to extend it to other models besides
linear regression. However, I am not sure that either 1) this form can be
coded in TMB, and 2) if I have done it correctly. In this code, both have
random components: Y (represented in the classic errors) and X (the del's)
. If this formulation cannot be executed in TMB then I will seek other
solutions (JAGS or STAN, perhaps), but I was hoping to stay in the world of
likelihood (and learn some TMB at the same time). Thanks again for taking
the time to review this issue.
 
Regards, Darren
 
On Friday, July 21, 2023 at 4:20:26 AM UTC-3 Hans Skaug wrote:
 
Mollie Brooks <mollie...@gmail.com>: Jul 21 06:23PM +0200

In response to Han’s comment, I tried running it with del as a random variable and didn’t do any better. I don’t know why, because the Wikipedia article seems to say it should be identifiable in this case.
 
Obj <- MakeADFun(data=Data,
parameters=Params,
random=c("del"),
DLL=model_name,
silent=FALSE)
 
Mollie
 
DM Gillis <astros...@gmail.com>: Jul 21 12:15PM -0700

Yes, when I do the same it returns the OLS slope, which makes sense to me
since setting it to "random" means it will be integrated out and should not
impact the estimates (just their SEs). However, I want it to have an impact
and move the slope around the true value of 2 :( Perhaps TMB only works
with latent random variables/effects and not variation added to predictors
that are not not LRVs to be integrated out.Thanks for taking the time to
check and enjoy the weekend!
 
Darren
 
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to tmb-users+...@googlegroups.com.

DM Gillis

unread,
Jul 25, 2023, 10:49:02 AM7/25/23
to TMB Users
Thanks Cole. As you probably found, the CIs are "tricky" in these models. I was originally worried about bias, but now that that is resolved I'll pay more attention to the precision. I may just have to grind through a bootstrap for specific cases (loops in loops) but that is why I have so many cores. Thanks for another suggestion - I'll also look into tmbstan ( another new one for me ). As I just got back from the coast, so my tinkering may slow a bit - but this is one rabbit hole I am enjoying. Comparing the CIs and significance tests to those described in Lengendre & Legendre's Numerical Ecology (1998, 2nd English Edition) will be insightful when I get back to it- as well as the citations they provide. Also, they suggest permutation tests, so Monte Carlo methods are probably where I will go. I would just use their R package, but I want a general method to use in novel models - the thing that got me interested in TMB initially. I'll post any further developments and thank everyone again for their interest and support.  All the best!

Cheers, Darren

Reply all
Reply to author
Forward
0 new messages