search for: parmcount

Displaying 1 result from an estimated 1 matches for "parmcount".

Did you mean: paramcount
2007 Jun 01
0
Metropolis code help
...n: www.stats.uwo.ca/faculty/murdoch/458/metropolis.r Below is My code with a flat prior on beta only (I'd like also to have the hierarchical version!) X<- cbind(1,DF$nsaid,DF$diuretic,DF$diuretic*DF$nsaid) y<- DF$Var3 Metropolis <- function(logtarget, start, R = 1000, sd = 1) { parmcount <- length(start) sims <- matrix(NA, nrow=R, ncol = parmcount) colnames(sims) <- names(start) sims[1,] <- start oldlogalpha <- logtarget(start) accepts <- 0 for (i in 2:R) { jump <- rnorm(parmcount, mean=0, sd=sd) y <- sims[i-1,] + jump newlo...