*! version 1.1.0, feb 98, Guy van Melle STB-45 gr30 *! *! function declaration for bivariate normal density *! to be represented via or *! *! call: hlbivnor x y z [in L1/L2] *! x y any two existing vars *! z created as or replaced by specified values *! prog def hlbivnor * loc x `1' loc y `2' loc z `3' cap confirm var `z' if _rc {qui gen `z'=.} mac shift 3 loc in "opt" parse "`*'" *--- actual start of function declaration --- if "$rho"=="" { glo rho 0 } loc r = 1 - ($rho)^2 /* need parentheses !!! */ loc c = 2 * _pi * sqrt(`r') #delimit ; qui replace `z'= exp( -(`x'^2 -2*$rho*`x'*`y'+`y'^2) / (2*`r') )/ `c' `in' ; #delimit cr end *