| bnlogl {bernor} | R Documentation |
Evaluate by Monte Carlo the observed data log likelihood for Bernoulli regression model with normal random effects.
bnlogl(y, beta, sigma, nmiss, x, z, i, model, deriv = 0, weigh)
y |
a zero-one-valued (Bernoulli) matrix, the response. |
beta |
the fixed effect vector. |
sigma |
the scale parameter vector for the random effects. |
nmiss |
integer, the number of simulations of the missing data. |
x |
the model matrix for fixed effects. |
z |
the model matrix for random effects. |
i |
the index vector for random effects. |
model |
the model for the importance sampling distribution,
an object of class model produced by the model function. |
deriv |
the number of derivatives wanted. No more than 3. Zero, the default, means no derivatives. Three is a kludge. It doesn't mean third derivatives but to output ``big V hat''. |
weigh |
weights. Positive integer valued vector of
length ncol(y). May be missing in which case all weights one
is assumed. |
evaluates by good old-fashioned (IID) Monte Carlo observed data log density as if doing the R statements
logf <- rep(NA, nmiss)
nobs <- ncol(y)
save.Random.seed <- .Random.seed
for (j in 1:nmiss) {
.Random.seed <<- save.Random.seed
logf[j] <- bnmarg(y[ , j], beta, b, sigma, x, z, i)$value
}
sum(weigh * logf)
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. |
bigv |
the ``big V hat'' matrix. The dimension is
nparm by nparm. |
data(salam)
attach(salam)
beta <- c(0.91, -3.01, -0.49, 3.54)
sigma <- c(1.18, 0.98)
moo <- model("gauss", length(i), 1)
nmiss <- 100
bnlogl(y, beta, sigma, nmiss, x, z, i, moo, deriv = 3)