baymode=function(X,niter=1000){
n=length(X[,1])
d=length(X[1,])
med_dat <- list(n = n,
d = d,
Y = X
)
fit <- sampling(object = stanmodels$mode, data = med_dat,
chains = 2, iter = niter)
return(list(mu=extract(fit)$mu,muhat=apply(extract(fit)$mu,2,mean)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.