| update_d | R Documentation |
Update utility threshold increments
update_d(d, y, sys, ll, mu_d_0, Sigma_d_0, Tvec, step_scale = 0.1)
d |
[ |
y |
[ |
sys |
[ |
ll |
[ |
mu_d_0 |
[ |
Sigma_d_0 |
[ |
Tvec |
[ |
step_scale |
[ |
An update for d.
set.seed(1)
N <- 1000
d_true <- rnorm(2)
gamma <- c(-Inf, 0, cumsum(exp(d_true)), Inf)
X <- matrix(rnorm(N * 2L), ncol = 2L)
beta <- c(0.8, -0.5)
mu <- matrix(as.vector(X %*% beta), ncol = 1L)
U <- rnorm(N, mean = mu[, 1], sd = 1)
yvec <- as.integer(cut(U, breaks = gamma, labels = FALSE))
y <- matrix(yvec, ncol = 1L)
Tvec <- rep(1, N)
mu_d_0 <- c(0, 0)
Sigma_d_0 <- diag(2) * 5
d <- rnorm(2)
ll <- -Inf
R <- 1000
for (iter in seq_len(R)) {
ans <- update_d(
d = d, y = y, sys = mu, ll = ll, mu_d_0 = mu_d_0, Sigma_d_0 = Sigma_d_0,
Tvec = Tvec
)
d <- ans$d
ll <- ans$ll
}
cbind("true" = d_true, "sample" = d) |> round(2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.