I want to disaggreate and decompose the quarterly real GDP into monthly trend and cycle components .Since I want use US GDP in 2019, so I modified equation1 and equation5 in this post https://estima.com/forum/viewtopic.php?f=32&t=3430,


Keep equation2 and equation3 the same.
So I get,




And I met some problems, (a)I don’t know how to set the value of g appropriately.(b)It seems I set wrong initial guess which lead wrong xv and cv.(c)Some other errors that I didn't find in the code.
There is my code and data , it would be nice if you could help me.Thanks in advance for any help.