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
But I always got the error message r(3000). Any help would be appreciated!
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
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
G | wcdf | bidder |
0.01 | 1 | |
0.141 | 7 |
Comment