danielmork / dlmtree

Code for R package dlmtree
https://danielmork.github.io/dlmtree/
GNU General Public License v3.0
20 stars 1 forks source link

monotone functionality #13

Closed danielmork closed 1 week ago

danielmork commented 2 weeks ago

Setting dlm.type to 'monotone' does not result in a monotone ERC. I think this setting results in calling TDLNM, not Monotone TDLNM.

danielmork commented 2 weeks ago

On additional investigation, there may also be issues with the monotone tdlnm function. Changing model$class="monotone" did not resolve the issue. Please use branch 'hotfix_tdlnm_se_monotone' to explore problem and find solution

SeongwonIm commented 2 weeks ago

I am updating the monotone tdlnm cpp function for ctr->Y0 and ctr->Ystar as they replaced ctr->Y.

SeongwonIm commented 2 weeks ago

monotone tdlnm runs but still running into 'Error: std::bad_alloc' and 'segfault error'

danielmork commented 2 weeks ago

It may be similar to the TDLNM issue we were having—that there is an input missing or incorrect passed from the dlmtree() function. Perhaps check back on these?

From: Seongwon Im @.> Date: Wednesday, May 15, 2024 at 11:34 To: danielmork/dlmtree @.> Cc: Daniel Mork @.>, Author @.> Subject: Re: [danielmork/dlmtree] monotone functionality (Issue #13)

monotone tdlnm runs but still running into 'Error: std::bad_alloc' and 'segfault error'

— Reply to this email directly, view it on GitHubhttps://github.com/danielmork/dlmtree/issues/13#issuecomment-2112873112, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH7UA765FHFTQ6CQZFB2PADZCN6ANAVCNFSM6AAAAABHWWTNY6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJSHA3TGMJRGI. You are receiving this because you authored the thread.Message ID: @.***>

SeongwonIm commented 2 weeks ago

Updated monotone-TDLNM model. The ZINB flag was dropped while merging, causing the segfault error. Also updated model$shape to only be available for a single exposure case to avoid a warning from 'mean(tdlnm.exposure.se)' when tdlnm.exposure.se = NULL.

danielmork commented 2 weeks ago

There is no place in dlmtree() that sets model$class = 'monotone', which is needed to call monotdlnm_cpp().

SeongwonIm commented 2 weeks ago

Lines 551 and 567 set model$class = 'monotone' when model$monotone is TRUE.

danielmork commented 2 weeks ago

Got it! I was looking in the wrong branch. Thanks

SeongwonIm commented 1 week ago

Specifying dlm.type = "monotone" and shrinkage in dlmtree.R results in incorrect estimates. The original code set shrinkage to FALSE by default when monotone model is specified.

SeongwonIm commented 1 week ago

Also note that the scaling and centering of the fixed effect matrix (model$Z) of the original code of tdlnm.R are different to dlmtree.R so the estimates will be slightly different.