Hi pals,
I have a big dataset with 1000rows, 9colums, part of which is the following dataset, I would like to find out G based on the relationship between G and wcdf: G=10*wcdf^9-9*wcdf^10. The code I wrote is as follows, but it does not work. any help would be appreciated.
clear mata
gen G=.
mata:
v=J(1,1,.)
st_view(v,.,"G wcdf")
fuction myfuc(G,a){
return(a-10*(G^9)+ (9*(G^10)))
}
for (i=1; i<=1000;i++){
r=mm_root(G=.,&myfun(),0,1)
}
end
I have a big dataset with 1000rows, 9colums, part of which is the following dataset, I would like to find out G based on the relationship between G and wcdf: G=10*wcdf^9-9*wcdf^10. The code I wrote is as follows, but it does not work. any help would be appreciated.
G | wcdf |
.428 | |
.929 | |
.661 | |
.211 | |
.863 | |
.401 | |
.436 | |
.757 | |
.078 |
gen G=.
mata:
v=J(1,1,.)
st_view(v,.,"G wcdf")
fuction myfuc(G,a){
return(a-10*(G^9)+ (9*(G^10)))
}
for (i=1; i<=1000;i++){
r=mm_root(G=.,&myfun(),0,1)
}
end
Comment