[R] Convolve 2 uniform distributed variables

corn at mail.tu-berlin.de corn at mail.tu-berlin.de
Thu May 24 08:29:23 CEST 2012


Hi,
I want to convolve 2 uniform distributed [0,1] variables, so that I  
get this graphic:  
http://de.wikipedia.org/wiki/Benutzer:Alfred_Heiligenbrunner/Liste_von_Verteilungsdichten_der_Summe_gleichverteilter_Zufallsvariabler (second  
graphic)

if I do

u1<-seq(0,1,length=100)
fu1=dunif(u1,min=0,max=1)

plot(u1,fu1,type="l",xlim=c(-2,2))


u2<-seq(0,1,length=100)
fu2=dunif(u2,min=0,max=1)

u1u2<-convolve(u1,rev(u1),typ="o")

plot(u1u2)

it does not work, could you help me please? The point is the convolve  
function I think, what do I have to type, to get the correct  
convolution of two uniform distributed [0,1] variables as to be seen  
in the second graphic in the given link?

Thanks a lot



More information about the R-help mailing list