Comments (3)
I suggest using Stan directly for now. Sorry. But I do have a hack below that might be alright for you.
More detail:
I don't understand why you're getting a unknown distribution error. I'd have to see the code you are attempting. But this kinda works:
m <- map2stan(
alist(
b <- 0 + 1*tan(bu),
bu ~ dunif("-pi()/2","pi()/2")
),
data=list(y=1),
sample=TRUE )
The major issue here is that variable assignments in map2stan are assumed to be indexed by the outcome variable cases. In the above example, there is just one case, so b
gets a single value for each bu
sample. But that won't be true in ordinary regression examples. Maybe just doing b[1]
in the code would work though? Haven't tried.
All of this feels kludgy and probably dangerous. But it might work fine in your current context.
On the horizon, I have been planning to just allow users to insert raw Stan code into any of Stan's blocks. So a parameter transform could be done like:
TV : beta <- mu + tau*tan(beta_unif)
That would define beta
in the transformed variables block in Stan, so it could be used in the model block.
As for adding link functions, in principle that is trivial. We just need more entries in this list:
https://github.com/rmcelreath/rethinking/blob/master/R/map2stan.r#L33
I will put this on my to-do list. I already have a plan to add cloglog
there. So might as well as common trig functions.
from rethinking.
I don't remember if we put this in the Stan manual, but sometimes it can
also be helpful to formulate the Cauchy as a ratio of normals. Maybe that's
an easier parameterization to do in the current version of rethinking (not
sure)?
On Thursday, July 28, 2016, Richard McElreath [email protected]
wrote:
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#45 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AHb4Qx66_75QH2j4lp3flVlC-C_5n0Ltks5qaGAWgaJpZM4JW3NY
.
from rethinking.
Great, thank you to both of you. I'll try both suggestions. Appreciate the help!
from rethinking.
Related Issues (20)
- Gamma parameterisation
- sim() from model with missing value imputation breaks with error "function merge_missing not found" HOT 2
- 'reject' stan command conflicts with UCBadmit data
- Chapter 16 Lynx Hare Model Change with Stan 2.33.0? HOT 10
- How to construct a spline model using ulam() HOT 4
- cannot install rethinking HOT 1
- Error in link(), R code 4.67 HOT 1
- Poisson response imputation compilation error
- Random Effect in Zero-Inflated Model
- Rethink package is NOT getting installed HOT 8
- Sampling issue for the Cat Adoptions Survival model.
- Random walk in ulam HOT 2
- problem in precis command
- Can multiple outcomes be regressed on the same linear model?
- ulam fits missing @stanfit slot? HOT 2
- WAIC not computing from ulam() model, even with log_lik = TRUE HOT 4
- Problem installing cmdstanr HOT 1
- ulam fits giving odd errors HOT 4
- errata 2nd Edition page 130
- log_lik fails with matrices in models fit by ulam HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rethinking.