bernor {bernor}R Documentation

Complete Data Log Density for Bernoulli-Normal Random Effects Model

Description

Evaluate the complete data log density for Bernoulli regression model with normal random effects.

Usage

bernor(y, beta, b, sigma, x, z, i, deriv = 0)

Arguments

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.

Details

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))
  

Value

A list containing some of the following components:

value

the function value.

gradient

the gradient vector. The length is nparm, which is length(beta) + length(mu).

hessian

the hessian matrix. The dimension is nparm by nparm.

See Also

bnmarg, bnlogl.

Examples

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)

[Package bernor version 0.3-8 Index]