[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: creating a new user function in Stata
I had a problem writing a user-written function in Stata and was wondering
if you could give me a help about how to write it. My goal is to create a
program that generates a variable with cdf values of a bivariate-beta
function in a similar way that the function ibeta(a1,b1,x1) would do.
I know how to calculate the cdf of my bivariate beta, but to avoid the
tedious task of writing a long expression every time I use it in my code I
thought it better to write a new function. I don't have a good clue however
of how to do this.
program cdf_biv_beta(a1,b1,a2,b2, w, x1, x2)
ibeta(a1,b1,x1)(1+w(x1-a1/(a1+b1))(x2-a2/(a2+b2))ibeta(a2,b2,x2) + (....)
(where x1 or x2 are variables that denote the values for integrating the
cdf, and a1,b1, a2, b2, w are variables that denote "the parameters" of my
bivariate cdf, if for example I write a code saying a1=exp(xb) )
Then cdf_biv_beta would give a new variable with the cdf values obtained
from the above function at the points given by variables (x1,x2).
Can someone give me some advice about how to do this? I don't exactly know
where to define the "input variables" of the function and the "output"
FREE pop-up blocking with the new MSN Toolbar - get it now!
* For searches and help try: