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
|