par(mfrow = c(2, 1), mar = c(4, 4, 2, 1))
# Regression coefficients across wavelengths
models <- ciso_lib_k$coefficients
matplot(
x = wavs_pr,
y = t(models$B),
type = "l",
lty = 1,
col = rgb(0.23, 0.51, 0.96, 0.15),
xlab = "Wavelength (nm)",
ylab = "Regression coefficient",
main = paste0("Regression coefficients (", nrow(models$B), " experts)")
)
# Add mean coefficient profile
lines(wavs_pr, colMeans(models$B), col = "red", lwd = 2)
grid(lty = 1)
legend(
"topright",
legend = c("Individual experts", "Mean"),
col = c(rgb(0.23, 0.51, 0.96, 0.6), "red"),
lty = 1,
lwd = c(1, 2),
bty = "n"
)
# Distribution of intercepts
plot(
density(models$B0, na.rm = TRUE),
col = rgb(0.23, 0.51, 0.96),
lwd = 2,
xlab = "Intercept value",
ylab = "Density",
main = "Distribution of intercepts"
)
polygon(
density(models$B0, na.rm = TRUE),
col = rgb(0.23, 0.51, 0.96, 0.2),
border = NA
)
abline(v = mean(models$B0, na.rm = TRUE), col = "red", lty = 2, lwd = 2)
grid(lty = 1)
legend(
"topright",
legend = c("Density", "Mean"),
col = c(rgb(0.23, 0.51, 0.96), "red"),
lty = c(1, 2),
lwd = 2,
bty = "n"
)
par(mfrow = c(1, 1))