View source: R/Scale_Logistic.R
1 | data.init.2(beta.eval = beta.star, datum.idx.start = 1, length.idxs = dsz)
|
beta.eval |
|
datum.idx.start |
|
length.idxs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (beta.eval = beta.star, datum.idx.start = 1, length.idxs = dsz)
{
call.data <- data.subset(datum.idx.start, length.idxs)
subset.design <- call.data$subset.design
subset.data <- call.data$subset.data
subset.zs <- as.numeric(apply(subset.design, 1, function(x) exp(sum(x *
beta.eval))))
subset.grad.log.pi <- sapply(seq_len(length.idxs), function(i) diag(n.sigma) *
subset.design[i, ] * (subset.data[i] - subset.zs[i]/(1 +
subset.zs[i])))
subset.lap.log.pi <- sapply(seq_len(length.idxs), function(i) -(diag(n.sigma) *
subset.design[i, ])^2 * subset.zs[i]/(1 + subset.zs[i])^2)
grad.log.pi <- as.numeric(apply(subset.grad.log.pi, 1, sum))
lap.log.pi <- as.numeric(apply(subset.lap.log.pi, 1, sum))
alpha.cent <<- matrix(grad.log.pi, nrow = 1)
alpha.cent.sq <<- (alpha.cent) %*% t(alpha.cent)
alpha.p.cent <<- sum(lap.log.pi)
phi.cent <<- (alpha.cent.sq + alpha.p.cent)/2
list(alpha.cent = alpha.cent, alpha.cent.sq = alpha.cent.sq,
alpha.p.cent = alpha.p.cent, phi.cent = phi.cent)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.