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
0
votes
1 answer

Errors while trying to write joint likelihood of a normal_lpdf and a bernoulli_lpmf in Stan

I am trying to calculate Bayes Factor using the package bridgesampling in R. For this I am trying to fit the model in Stan. It is a hierarchical model with the Alternative (Hypothesis) model having parameters beta, gamma1, gamma3 & sigma. Please…
0
votes
1 answer

What is "linear.predictors" as extractable from stan_glm() object in "rstanarm" package?

I'm writing to find out what is "linear.predictors" as returned by stan_glm() object. Apparently, "linear.predictors" is not the same as the predictor(s) provided by the user (documentation didn't help). In any case, is there a way to obtain…
rnorouzian
  • 7,397
  • 5
  • 27
  • 72
0
votes
1 answer

"lines()" acting like "polygon()" R?

I'm trying to draw two black lines around a red regression line. But the lines() command draws something more like a polygon() than a simple line (see picture below code). I'm wondering is there a fix to simply draw two lines around the regression…
rnorouzian
  • 7,397
  • 5
  • 27
  • 72
0
votes
1 answer

Problematic `rstanarm::stan_lmer` - invalid internal subsetting

I'm running into the following problem, which appears to be related to subsetting done within rstanarm. See this related problem Error in xj[i] : invalid subscript type 'list' reproducible…
alexwhitworth
  • 4,839
  • 5
  • 32
  • 59
0
votes
1 answer

Graphing Gaussian Process in R using rstan

I am trying to understand where I am going wrong with rstan. I have figured out a workaround, but it seems like there should be a better option for graphing draws from the posterior than what I have come up with. I am trying to learn how to use…
Matt Barstead
  • 235
  • 1
  • 8
0
votes
1 answer

Error compiling Rstan model Windows 7 professional 64 bits

I get an error when trying to fit a stan model in R at work's Windows machine. I am pretty sure there is no issue with my coding, since it all works fine in my personal Linux machine. Due to the length of the error message I paste it at the end.…
Joaquin
  • 121
  • 9
0
votes
0 answers

Rstan not running without internet connection on mac

When rstan starts to compile a model, and I'm not connected to the internet, it halts and gives me a curl related error. I assume this is because rstan depends in some way on shinystan. Error below: Error in curl::curl_fetch_memory(url, handle =…
0
votes
1 answer

Use a prior triangular distribution in rethinking - R

I’m using the rethinking package in R to make a simple linear model. In the folowing code I use a prior normal distribution for the dependent variable and everything works good. library(rethinking) col <- alist( courework_n ~ dnorm(mean,0.2), …
Oscar Muñoz
  • 439
  • 1
  • 5
  • 18
0
votes
0 answers

Integer matrix in stan getting flattened

I'm trying to pass a three-dimensional data structure to Stan (in RStan) where the entries must be integers, because a function down-stream requires that. However I'm having trouble declaring it. I tried the straight-forward approach: int…
one_observation
  • 454
  • 5
  • 16
0
votes
1 answer

Predicting from the full posterior distribution using stan_glmer

Could I ask for some help please? I have fit a binomial model using stan_glmer and have picked the model which I think best fits the data. I have used the posterior predict command to compare my observed data to data simulated by the model and it…
gemster
  • 3
  • 1
0
votes
1 answer

Stan code works on Windows but not Linux

I have the following Stan code working perfectly fine when used with rstan on Windows. However, when running on a cluster with Linux (CentOS 6), it throws out a very long error which includes ~500 lines of, I guess, Rcpp code and the last chunk is…
Siamak
  • 25
  • 1
  • 1
  • 7
0
votes
1 answer

Overall predictive power (e.g. R2) for Bayesian Linear (Mixed) Models

Following this question about journal reporting, I would like to know if there is any overall effect size indice for Bayesian models fitted using stan_lmer? In the frequentist framework, there is for example the pseudo-R2 (computed by this package)…
Dominique Makowski
  • 1,511
  • 1
  • 13
  • 30
0
votes
1 answer

Extract BFMI from stanfit object in rstan

After fitting a model in stan using stan(), how can I extract the BFMI for each chain? From this conversation: https://groups.google.com/forum/#!topic/stan-dev/uJhsapVwlk8, it appears that BFMI at one point displayed when using the print method.…
Jake Thompson
  • 2,591
  • 1
  • 16
  • 32
0
votes
1 answer

Constructing a non-linear exponential model -- use a vector or real?

I'm new to Stan and probabilistic programming. I'm trying to construct a non-linear growth model. I've been able to construct the model in NLS The NLS formula I used is: Trump_Pct ~ alpha - beta * lambda^Population My NLS summary is: Parameters: …
Union find
  • 7,759
  • 13
  • 60
  • 111
0
votes
0 answers

RStan: Correct update for "poisson_log" function

I have been trying to get the Stan version of the old BUGS example "leuk" working, using the version from github.com/stan-dev/example-models. The version of leuk.stan there works fine, but gives warnings that "<-", "increment_log_prob", and…
Larry Hunsicker
  • 406
  • 5
  • 12
1 2 3
19
20