You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example on p. 143-144 of Rethinking, 2nd ed, we have
# d has columns A, M, and D
m5.3A <- quap(
alist(
D ~ dnorm(mu, sigma).
mu <- a + bM * M + bA * A,
a ~ dnorm(0, 0.2),
bM ~ dnorm(0, 0.5).
bA ~ dnorm(0, 0.5),
sigma ~ dexp(1),
M ~ dnorm(mu_M, sigma_M),
mu_M <- aM + bAM * A,
aM ~ dnorm(0, 0.2),
bAM ~ dnorm(0, 0.5),
sigma_M ~ dexp(1)
), data = d
)
A_seq <- seq(2, 2, length.out = 30)
# notice, no M in sim_dat
sim_dat <- data.frame(A = A_seq)
# Use the model first to infer M from A and then to
# infer D from M and A
s <- sim(m5.3A, data = sim_dat, vars = c("M", "D"))
I can't figure out a way to do this with add_linpred_draws(). When I try
s <- predicted_draws(m5.3A, sim_dat)
I get an error message about "M" not found.
More generally, is there a way to use predicted_draws to extract predictions of M from this model, given a data frame with values of A?
The text was updated successfully, but these errors were encountered:
In the example on p. 143-144 of Rethinking, 2nd ed, we have
I can't figure out a way to do this with
add_linpred_draws()
. When I tryI get an error message about "M" not found.
More generally, is there a way to use
predicted_draws
to extract predictions ofM
from this model, given a data frame with values ofA
?The text was updated successfully, but these errors were encountered: