if (FALSE) {
# - - Example 1
q = 0.6
beta = 1.1
n = 500
y = BDgraph::rdweibull(n = n, q = q, beta = beta)
output = bdw.reg(data = y, y ~ ., iter = 5000)
output$q.est
output$beta.est
traceplot(output$sample[, 1], acf = T, pacf = T)
traceplot(output$sample[, 2], acf = T, pacf = T)
# - - Example 2
q = 0.6
beta = 1.1
pii = 0.8
n = 500
y_dw = BDgraph::rdweibull(n = n, q = q, beta = beta)
z = rbinom(n = n, size = 1, prob = pii)
y = z * y_dw
output = bdw.reg(data = y, iter = 5000, ZI = TRUE)
output$q.est
output$beta.est
output$pi.est
traceplot(output$sample[, 1], acf = T, pacf = T)
traceplot(output$sample[, 2], acf = T, pacf = T)
traceplot(output$sample[, 3], acf = T, pacf = T)
# - - Example 3
theta.q = c(0.1, -0.1, 0.34) # true parameter
theta.beta = c(0.1, -.15, 0.5 ) # true parameter
n = 500
x1 = runif(n = n, min = 0, max = 1.5)
x2 = runif(n = n, min = 0, max = 1.5)
reg_q = theta.q[1] + x1 * theta.q[2] + x2 * theta.q[3]
q = 1 / (1 + exp(-reg_q))
reg_beta = theta.beta[1] + x1 * theta.beta[2] + x2 * theta.beta[3]
beta = exp(reg_beta)
y = BDgraph::rdweibull(n = n, q = q, beta = beta)
data = data.frame(x1, x2, y)
output = bdw.reg(data, y ~. , iter = 5000)
# - - Example 4
theta.q = c(1, -1, 0.8) # true parameter
theta.beta = c(1, -1, 0.3) # true parameter
pii = 0.8
n = 500
x1 = runif(n = n, min = 0, max = 1.5)
x2 = runif(n = n, min = 0, max = 1.5)
reg_q = theta.q[1] + x1 * theta.q[2] + x2 * theta.q[3]
q = 1 / (1 + exp(-reg_q))
reg_beta = theta.beta[1] + x1 * theta.beta[2] + x2 * theta.beta[3]
beta = exp(reg_beta)
y_dw = BDgraph::rdweibull(n = n, q = q, beta = beta)
z = rbinom(n = n, size = 1, prob = pii)
y = z * y_dw
data = data.frame(x1, x2, y)
output = bdw.reg(data, y ~. , iter = 5000, ZI = TRUE)
}
Run the code above in your browser using DataLab