Nonlinear Least Squares

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

gerluc
Posts: 22
Joined: Fri Jun 26, 2020 10:28 pm

Nonlinear Least Squares

Postby gerluc » Sun Dec 05, 2021 8:09 am

I have data on bond yields (192 time series observations with i = 1,2,..18 monthly maturities) and estimated the following code:

Code: Select all

' Compute factor loadings across maturities
vector(18) tau
group fm
for !i=1 to 18
   if !i=1 then
      tau(!i)=1
   else if !i<=9 then
         tau(!i)=(!i-1)*3
         else   if !i<=11 then
               tau(!i)=(!i-5)*6
               else
                  tau(!i)=(!i-8)*12
               endif
         endif
   endif
   %s=@str(tau(!i))
     fm.add fm{%s}
next

equation reg
matrix(192,4) beta

for !i=1 to 192
   vector(18) r
   for !j=1 to 18
      %beta=@str(tau(!j))
      r(!j)=fm{%beta}(!i)
     next
        mtos(r,yields)
     for !k=1 to 18
          param c(1) 7.5 c(2) -2 c(3) 0.09 c(4) 0.06
          reg.ls(optmethod="legacy", cov=hac) yields=c(1) + c(2)*((1 - exp(-tau(!k)*c(4)))/(tau(!k)*c(4))) + c(3)*((1 - exp(-tau(!k)*c(4)))/(tau(!k)*c(4)) - exp(-tau(!k)*c(4)))
     next
next

As you can see, the last for loop command estimates a cross-sectional nonlinear regression for each month, which then gives me 192 estimates of c(1), c(2), c(3) and c(4). I then attach the results (please see below) of the last (192nd) non-linear regression estimates of these four parameters. As you can see that by using EViews legacy as the optimization method, I get convergence after 4 iterations, but I get a warning of Singular covariance - coefficients are not unique, which does not allow me to obtain estimates of the Std. Error, t-Statistic and p-values. What can be the reason for these results? If I change the optimization method to "bfgs" or "bhhh" or to another optimization method say "newton", I still get the same warning as well as an error message of failure to improve the hessian matrix. Was it because of not so good parameter starting values and/or that in each regression I only have 18 observations? Please kindly enlighten. Thank you.
Attachments
Capture.PNG
NLS results
Capture.PNG (40.31 KiB) Viewed 21721 times

Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 8 guests