Announcement

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

  • Using stored scalar

    Dear All,
    I stored a scalar named, inv_a How do I use it if I want to run an estimation say
    Code:
    nl( y=({alpha=inv_a}^5 )*l5.y
    ?

    Thanks

  • #2
    have a look at the manual: [P] scalar; the easy way to get there is "h scalar" and then click on the link at the top of the help file

    Comment


    • #3
      Thanks Rich. However I could't get related help

      Comment


      • #4
        Zuhumnan:
        I do hope that what follows may be helpful:

        Code:
        use auto.dta, clear
        scalar a=2
        g y=runiform()
        g x=runiform()
        nl (y = {a} + { weight }*x^{ turn =1})
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thanks Carlo. However, the idea is that I must associate the parameter being estimated with an initial value. For instance, am estimating alpha and its initial value is stored as a scalar with the name inv_a. Therefore the user function has to be
          Code:
            
           nl( y=({alpha=inv_a}^5 )*l5.y
          . It works if I use
          Code:
            
           nl( y=({alpha=0.7}^5 )*l5.y
          . I prefer the first option because I have many of such equations to estimate.

          Comment


          • #6

            Code:
            nl( y=({alpha=`=inv_a'}^5 )*l5.y
            Last edited by Nick Cox; 18 Mar 2015, 03:28.

            Comment


            • #7
              Goodness me! Dr Cox you are such an amazing person on this forum. My longstanding problem is now solved. Thanks a million.
              Last edited by Zuhumnan Dapel; 18 Mar 2015, 03:50.

              Comment

              Working...
              X