Questions tagged [rstan]

RStan is an API in R for the STAN programming language for Bayesian Statistical Inference.

Stan uses an R-like language for specifying statistical models, and has an R interface for compiling and running the markov chain analyses, and reporting the results back to R.

Links

299 questions
4
votes
1 answer

In rstan, are initial parameter values that are specified via a list applied on the constrained support or the unconstrained support?

The help file for rstan::stan has the following to say about the init argument: init="random" (default): Let Stan generate random initial values for all parameters. The seed of the random number generator used by Stan can be specified via…
Cameron Bieganek
  • 7,208
  • 1
  • 23
  • 40
4
votes
0 answers

Translating WinBUGS models to rstan

I have WinBUGS models below which I need to use in R. However because I am not familiar with WinBUGS and for consistency with other parts of the analysis, I would appreciate any help to convert them to rstan. Here are the models and data (full…
Krantz
  • 1,424
  • 1
  • 12
  • 31
4
votes
1 answer

knitr fails on Stan chunk with cache=TRUE

According to this Github issue (marked as fixed for knitr v1.12), it should be possible to cache Stan chunks in knitr so that the Stan model object doesn't need to be re-compiled every time we knit the file. However, using knitr v1.20 (R v3.5.1…
Mark
  • 200
  • 6
4
votes
1 answer

Optimizing Gaussian Process in Stan/rstan

I have recently encountered Gaussian process models and happen to think that they may be the solution to a problem I have been working on in my lab. I have an open and related question on Cross Validated, but I wanted to separate out my…
Matt Barstead
  • 235
  • 1
  • 8
4
votes
0 answers

Difference between extract() and as.matrix() applied to a stan object

I have a Stan model (called fit) and I'm getting some strange results. I know that I'm probably missing something, but I can't see where and what. In this case I want to look at the parameter sigma_h. If I use as.matrix to get the samples from fit…
J.C.Wahl
  • 1,394
  • 8
  • 15
4
votes
1 answer

How to report with APA style a Bayesian Linear (Mixed) Models using rstanarm?

I'm currently struggling with how to report, following APA-6 recommendations, the output of rstanarm::stan_lmer(). First, I'll fit a mixed model within the frequentist approach, then will try to do the same using the bayesian framework. Here's the…
Dominique Makowski
  • 1,511
  • 1
  • 13
  • 30
4
votes
0 answers

Supplying seed to Stan doesn't guarantee the same chains

I was trying to compare the run time of two very much equivalent but slightly different models. But the chains will always take very different time based on the random numbers sampled. So I tried to fix this supplying the same seed parameter to…
Tomas
  • 57,621
  • 49
  • 238
  • 373
3
votes
0 answers

Rstan won't run just stops at prompt "Selection"

I followed the instructions to install Rstan from here. I used the macrtools to configure the c++ toolchain. But whenever I run any Rstan program it just stops with the prompt "Selection:" For example if I run the example as it instructs on the…
Mike Schmidt
  • 181
  • 9
3
votes
0 answers

Finding the amount of memory allocated for the environment output by cmdstanr sampling

Assigning the output of a call to the sample() method of a compiled model from the cmdstanr package produces an "environment" in my global environment rather than a model object. Is there some way to see how much memory this environment is…
socialscientist
  • 3,759
  • 5
  • 23
  • 58
3
votes
1 answer

Error in compileCode (Error 127) When running rstan program

I am trying to install Rstan. I have no problem installing the package and running it. However, when I try running a program that uses the library I get the following error: Error in compileCode(f, code, language = language, verbose = verbose) :…
EduardoRod
  • 105
  • 1
  • 8
3
votes
1 answer

Cannot compile rstan or Rcpp code in Rstudio with windows 10

I am not managing to compile Rcpp or rstan code on Windows. When I try to compile an rstan program (below) I receive the error Error in compileCode(f, code, language = language, verbose = verbose) : In file included from…
3
votes
2 answers

Error attaching rstan package: Entry Point Not Found

I've successfully installed rstan, but when I try to attach it with library(rstan) I get a pop-up window with the title "RGui (64-bit): Rgui.exe - Entry Point Not Found" and the message content The procedure entry point EXTPTR_PTR could not be…
Empiromancer
  • 3,778
  • 1
  • 22
  • 53
3
votes
2 answers

Installing V8 required by rstan on gentoo

is there a way to install rstan on a Gentoo amd64 system? rstan depends on v8-r (https://cran.r-project.org/web/packages/V8/index.html), which depends on a v8 installation. I haven't found a working v8 ebuild, v8 failed to compile with didactic-duck…
3
votes
1 answer

travis builds failing due to rstan compilation issues

My package builds on Linux are failing with the following compilation error for rstan package: lto-wrapper: fatal error: make returned 2 exit status compilation terminated. /usr/bin/ld: lto-wrapper failed collect2: error: ld returned 1 exit…
Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51
3
votes
1 answer

Extract data in the transformed data block in a Stan file

I want to extract z in the trasformed data block from the stanfit object f. Is it possible? library(rstan) m <- stan_model(model_code = ' data{real x;} transformed data{real z; z =…
Camford Oxbridge
  • 834
  • 8
  • 21
1
2
3
19 20