powered by
This function computes the logarithm of the posterior density associated with a log-linear model and the noninformative prior used in Chapter 4.
loglinnoinflpost(beta, y, X)
returns the logarithm of the logit posterior density for the data y, covariate matrix X and parameter vector beta
y
X
beta
parameter of the log-linear model
binary response variable
covariate matrix
This function does not test for coherence between the lengths of y, X and beta, hence may return an error message in case of incoherence.
X=matrix(rnorm(20*3),ncol=3) beta=c(3,-2,1) y=rpois(20,exp(X%*%beta)) loglinnoinflpost(beta, y, X)
Run the code above in your browser using DataLab