Open
Description
Hello, I've been trying to solve the practice problem from Monte Carlo Chapter, and I can't compute WAIC from ulam model.
N <- 100
height <- rnorm(N,10,2)
leg_prop <- runif(N,0.4,0.5)
leg_left <- leg_prop*height +
rnorm( N , 0 , 0.02 )
leg_right <- leg_prop*height +
rnorm( N , 0 , 0.02 )
d <- data.frame(height,leg_left,leg_right)
output <- capture.output(m5.8s2 <- ulam(
alist(
height ~ dnorm( mu , sigma ) ,
mu <- a + bl*leg_left + br*leg_right ,
a ~ dnorm( 10 , 100 ) ,
bl ~ dnorm( 2 , 10 ) ,
br ~ half_normal(1, 10),
sigma ~ dcauchy( 0 , 1 )
),
data=d, chains=4, start=list(a=10,bl=0,br=1,sigma=1), log_lik = TRUE))
print(WAIC(m5.8s2))
When I run the above code, I got error message:
Error in UseMethod("WAIC") :
no applicable method for 'WAIC' applied to an object of class "ulam" . How do I solve this, please?
Metadata
Metadata
Assignees
Labels
No labels