RW()RW2()AR()AR1()RW_Seas()RW2_Seas()Lin()Lin_AR()Lin_AR1()Sp()plot_exch <- function(draws) {
ggplot(draws, aes(x = element, y = value)) +
facet_wrap(vars(draw), nrow = 1) +
geom_hline(yintercept = 0, col = "grey") +
geom_point(col = "darkblue", size = 0.7) +
scale_x_continuous(n.breaks = max(draws$element)) +
xlab("Unit") +
ylab("") +
theme(text = element_text(size = 8))
} plot_cor_one <- function(draws) {
ggplot(draws, aes(x = along, y = value)) +
facet_wrap(vars(draw), nrow = 1) +
geom_hline(yintercept = 0, col = "grey") +
geom_line(col = "darkblue") +
xlab("Unit") +
ylab("") +
theme(text = element_text(size = 8))
} plot_cor_many <- function(draws) {
ggplot(draws, aes(x = along, y = value)) +
facet_grid(vars(by), vars(draw)) +
geom_hline(yintercept = 0, col = "grey") +
geom_line(col = "darkblue") +
xlab("Unit") +
ylab("") +
theme(text = element_text(size = 8))
} plot_svd_one <- function(draws) {
ggplot(draws, aes(x = age_mid(age), y = value, color = sexgender)) +
facet_wrap(vars(draw), nrow = 1) +
geom_line() +
scale_color_manual(values = c("darkgreen", "darkorange")) +
xlab("Age") +
ylab("") +
theme(text = element_text(size = 8),
legend.position = "top",
legend.title = element_blank())
}plot_svd_many <- function(draws) {
draws |>
mutate(element = paste("Unit", element)) |>
ggplot(aes(x = age_mid(age), y = value, color = sexgender)) +
facet_grid(vars(element), vars(draw)) +
geom_line() +
scale_color_manual(values = c("darkgreen", "darkorange")) +
xlab("Age") +
ylab("") +
theme(text = element_text(size = 8),
legend.position = "top",
legend.title = element_blank())
}NFix()\[\begin{equation} \beta_j \sim \text{N}(0, \mathtt{sd}^2) \end{equation}\]
N()\[\begin{align} \beta_j & \sim \text{N}(0, \tau^2) \\ \tau & \sim \text{N}^+(0, \mathtt{s}) \end{align}\]
SVD()\[\begin{equation} \pmb{\beta} = \pmb{F} \pmb{\alpha} + \pmb{g} \end{equation}\]
n_comp = NULL, indep = TRUE
n_compn_comp = 5, indep = TRUE
SVD_AR()SVD_AR(HMD, indep = FALSE, s = 0.1) |>
generate(n_draw = 6, n_along = 5) |>
ggplot(aes(x = age_mid(age),
y = value,
color = sexgender)) +
facet_grid(vars(draw), vars(along)) +
geom_line() +
scale_color_manual(values = c("darkgreen", "darkorange")) +
xlab("Age") +
ylab("") +
theme(text = element_text(size = 8),
legend.position = "top",
legend.title = element_blank())