> in order to plot my convolution-function - that means :all
> integral-values as a function of my steps; ->I will show you what I
> did: ~ drop _all
set obs 100
tempname tempd1 tempd2
scalar `tempd1'=0.1
gen double d=.
gen double conv=.
forvalue i=1/100 {
scalar `tempd2'=`i'*`tempd1'
range x 0 `tempd1' 100
gen double
y=exp(-(`tempd2'-x)^2/2)*0.1/(x+0.1)
integ y x, gen(Sy)
replace d=`tempd2' in `i'
replace conv=Sy[100] in `i'
drop Sy x y if ****
}
gen x=d
gen f1=exp(-(`tempd2'-x)^2/2) gen f2=0.1/(x+0.1) line f1 x || line f2
x || line conv x ~
I can't comment on the overall procedure, but the reason why your code isn't working is
the last statement within your loop has an undefined if statement (flaged with *** in the
above).
You either need to define the if statement (e.g. -drop Sy x y if(Sy == 1)) or remove it.
HTH's
Neil
Neil Shephard
Genetics Statistician
ARC Epidemiology Unit, University of Manchester
[email protected]
[email protected]
"Contrariwise, if it was so, it might be; and if it
were so it would be; but as it isn't, it ain't. That's
logic" - Tweedledee (Alice Through the Looking Glass)
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/