dp.r (294B)
1 BNP_DIR = "/Users/jtobin/projects/bnp" 2 SBP_SRC = paste(BNP_DIR, "stick-breaking-process/src/sbp.r", sep = "/") 3 4 source(SBP_SRC) 5 6 # ex: gaussian base measure 7 # 8 # > dp(10, 1, function() { rnorm(1) }) 9 dp = function(n, a, h) { 10 p = sbp(n - 1, a) 11 g = replicate(length(p), h()) 12 list(p, g) 13 } 14 15