WAIC not computing from ulam() model, even with log_lik = TRUE
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
Research direction
The failing call is WAIC() applied to a ulam() fit in the rethinking package, which raises 'no applicable method' because the object class is not handled. Start by checking which WAIC method exists for the stanfit/map classes in R/ and whether the log_lik output from ulam(log_lik = TRUE) is stored where WAIC expects it. Done when WAIC(m5.8s2) returns a value or the docs state the supported path, and this stale thread has a clear answer.
Written by the indexing model from the issue text.
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?
- Dominant language
- R
- Stars
- 2.4k
- Forks
- 632
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rmcelreath/rethinking
-
Typo: p.381Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100
rmcelreath/rethinking#482 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
rmcelreath/rethinking#476 ·
-
Typo: p.302Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
rmcelreath/rethinking#475 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
rmcelreath/rethinking#474 ·
-
Comma splice: p.557Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
rmcelreath/rethinking#471 ·
All issues in rmcelreath/rethinking
Similar issues
-
1.7
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pharmaverse/admiral#3235 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
SticsRPacks/CroPlotR#185 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day