Announcement

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

  • Mata again

    Hi All,

    I got a dataset looks like below. I would like to find out G based on information of wcdf and bidder. I tried mata
    clear mata
    gen G=.
    mata:
    v=J(1,1,.)
    st_view(v,.,"G wcdf nbidder")

    a=v[.,2]
    b=v[.,3]
    function myfuc(G,a b){
    return(a- b *(G^(b -1))+ ((b -1)*(G^b)))
    }


    for (i=1; i<=rows(v);i++){
    r=mm_root(G=.,&myfuc(),0,1,0,100,v[i,2],v[i,3])
    v[i,1] = G
    }

    end
    But I always got the error message r(3000). Any help would be appreciated!
    G wcdf bidder
    0.01 1
    0.141 7

  • #2
    Code:
    
    
    Last edited by Li Zhang; 06 May 2021, 13:19.

    Comment


    • #3
      I found a similar question at here
      https://www.statalist.org/forums/for...ve-for-unknows
      However, I still did find why my code does not work. Any help?

      Comment


      • #4
        Hi All,

        I solved my problem, thank you all so much!

        Comment

        Working...
        X