# NOT RUN {
# Loading the data for this example
data(ma2)
true_ma2 <- c(0.6,0.2)
# Performing BSL
resultMa2BSL <- bsl(y = ma2$data, n = 500, M = 300000, start = ma2$start, cov_rw = ma2$cov,
fn_sim = ma2_sim, fn_sum = ma2_sum, fn_prior = ma2_prior,
sim_options = ma2$sim_options, theta_names = c('theta1', 'theta2'))
summary(resultMa2BSL)
plot(resultMa2BSL, true_value = true_ma2, thin = 20)
# Performing tuning for BSLasso
lambda_all <- list(exp(seq(-3,0.5,length.out=20)), exp(seq(-4,-0.5,length.out=20)),
exp(seq(-5.5,-1.5,length.out=20)), exp(seq(-7,-2,length.out=20)))
sp_ma2 <- selectPenalty(ssy = ma2_sum(ma2$data), n = c(50, 150, 300, 500), lambda_all,
theta = true_ma2, M = 100, sigma = 1.5, fn_sim = ma2_sim,
fn_sum = ma2_sum, sim_options = ma2$sim_options)
sp_ma2
plot(sp_ma2)
# Performing BSLasso with a fixed penalty
resultMa2BSLasso <- bsl(y = ma2$data, n = 300, M = 250000, start = ma2$start, cov_rw = ma2$cov,
fn_sim = ma2_sim, fn_sum = ma2_sum, penalty = 0.027, fn_prior = ma2_prior,
sim_options = ma2$sim_options, theta_names = c('theta1', 'theta2'))
summary(resultMa2BSLasso)
plot(resultMa2BSLasso, true_value = true_ma2, thin = 20)
# Plotting the results together for comparison
combinePlotsBSL(resultMa2BSL, resultMa2BSLasso, true_value = true_ma2, thin = 20)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab