Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Solving complex equations with STATA

    Dear Statalists,
    can anybody help me solve equations with STATA? In particular, I have one equation I would like to solve, and I will attach it in this post. The "re" would be the "x" I'm trying to solve for.
    Thank you in advance!



    Click image for larger version

Name:	WhatsApp Image 2021-10-10 at 17.38.05.jpeg
Views:	1
Size:	19.3 KB
ID:	1632239

  • #2
    As a start:
    Code:
    . clear
    
    . set obs 2
    Number of observations (_N) was 0, now 2.
    
    . gen double y = 0
    
    . replace y = .00001 in 1
    (1 real change made)
    
    . nl (y = 1.375/((1+{a=1})^(181/365)) + 1.375/((1+{a=1})) +1.375/((1+{a=1})^(546/365)) - 102.81)
    
    Iteration 0:  residual SS =  16100.52
    Iteration 1:  residual SS =  2318.026
    Iteration 2:  residual SS =  1375.691
    Iteration 3:  residual SS =  32.57082
    Iteration 4:  residual SS =  .0346628
    Iteration 5:  residual SS =  4.46e-08
    Iteration 6:  residual SS =  5.00e-11
    Iteration 7:  residual SS =  5.00e-11
    
    
          Source |      SS            df       MS
    -------------+----------------------------------    Number of obs =          2
           Model | -1.292e-26          0           .    R-squared     =    -0.0000
        Residual |  5.000e-11          1  5.0000e-11    Adj R-squared =    -0.0000
    -------------+----------------------------------    Root MSE      =   7.07e-06
           Total |  5.000e-11          1  5.0000e-11    Res. dev.     =  -43.14854
    
    ------------------------------------------------------------------------------
               y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
              /a |  -.9323362   2.44e-09 -3.8e+08   0.000    -.9323362   -.9323362
    ------------------------------------------------------------------------------
    Note: Parameter a is used as a constant term during estimation.

    Comment


    • #3
      Scott Merryman
      Thank you so much for your answer!

      Comment

      Working...
      X