Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: convolution-integral

From   "Neil Shephard" <[email protected]>
To   [email protected]
Subject   Re: st: convolution-integral
Date   Tue, 23 Mar 2004 09:48:17 +0000

> 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
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 

You either need to define the if statement (e.g. -drop Sy x y if(Sy == 1)) or remove it.


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:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index