search for: ludfun

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

Did you mean: dfun
2009 Sep 06
2
question about ... passed to two different functions
...- as.numeric(runif(n) < p) out <- glm(y ~ x1 + x2 + x3, family = binomial()) summary(out) ### now we want to do a Bayesian analysis of the model, so we write ### a function that evaluates the log unnormalized density of the ### Markov chain we want to run (log likelihood + log prior) ludfun <- function(beta) { stopifnot(is.numeric(beta)) stopifnot(length(beta) == ncol(modmat)) eta <- as.numeric(modmat %*% beta) logp <- ifelse(eta < 0, eta - log1p(exp(eta)), - log1p(exp(- eta))) logq <- ifelse(eta < 0, - log1p(exp(eta)), - eta - log1p(exp(- et...