bernor {bernor} | R Documentation |
Evaluate the complete data log density for Bernoulli regression model with normal random effects.
bernor(y, beta, b, sigma, x, z, i, deriv = 0)
y |
a zero-one-valued (Bernoulli) vector, the response. |
beta |
the fixed effect vector. |
b |
the random effect vector. |
sigma |
the scale parameter vector for the fixed effects. |
x |
the model matrix for fixed effects. |
z |
the model matrix for random effects. |
i |
the index vector for random effects. |
deriv |
the number of derivatives wanted. No more than 2. Zero, the default, means no derivatives. |
evaluates the function given by the R statements
eta <- x %*% beta + z %*% (sigma[i] * b) p <- 1 / (1 + exp(- eta)) sum(dbinom(y, 1, p, log = TRUE)) + sum(dnorm(b, log = TRUE))
A list containing some of the following components:
value |
the function value. |
gradient |
the gradient vector. The length is
|
hessian |
the hessian matrix. The dimension is
|
data(salam) attach(salam) beta <- rnorm(ncol(x)) sigma <- rgamma(length(unique(i)), 5, 5) b <- rnorm(ncol(z)) bernor(y[ , 1], beta, b, sigma, x, z, i) bernor(y[ , 1], beta, b, sigma, x, z, i, deriv = 2)