Greetings,
Minimal reproducible example as requested by the technical expert Jeff 
Newmiller:
library(bayesmeta)

# density of $(1/10)*\sum_{j=1}{10}N(j,0.01$ 
# (convex sum of normal distributions)
#
f <- Vectorize(function(s) sum(vapply(1:10,
   FUN = function(j) dnorm(s,mean=j,sd=0.01)/10, FUN.VALUE=0
)))
g <- function(s) dnorm(s,mean=0,sd=0.01)

cat("\n\n")
for(i in 1:5){
   
  cat("Doing convolution ",i,"\n")
  g <- convolve(g,f)$density
}
cat("\nConvolutions finished, plotting density.")
s <- seq(0,100,length.out=1024)
matplot(s,g(s),type="l")
   
 
Michael Meyer
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to