Questions tagged [rstanarm]

An R package providing an interface for building and running inference for Bayesian regression models.

Estimates previously compiled regression models using the rstan package, which provides the R interface to the Stan C++ library for Bayesian estimation. Users specify models via the customary R syntax with a formula and data.frame plus some additional arguments for priors.

http://mc-stan.org/rstanarm/

66 questions
1
vote
0 answers

How to update a brmsfit object with a modified brms-generated stan model marginalizing over a distribution of weights

I would appreciate any help to update my brmsfit object with a modified brms-generated stan model because I want to pass various columns of weights to the likelihood in a way that brms does not support yet probably. My objective is to obtain the…
Krantz
  • 1,424
  • 1
  • 12
  • 31
1
vote
1 answer

Unique intercepts approach for categorical variables in "rstanarm" package in R

Background: McElearth (2016) in his rethinking book pages 158-159, uses an index variable instead of dummy coding for a 3-category variable called "clade" to predict "kcal.per.g" (linear regression). Question: I was wondering if we could apply the…
user7649990
1
vote
1 answer

How do we find the different values for each iteration in rstanarm?

I did write a basic GLM code in rstanarm. When I execute the following code it is giving the mean of the predictor variables of all the iterations done: summary(TestGLM) print(TestGLM) I wanted the value of the predictor variables at each…
Alex_P
  • 133
  • 2
  • 9
1
vote
1 answer

How to put different priors using rstanarm

Lets say i have model of a form y=a_{i} + b_{i,1}*x_{1} + b_{2}*x_{2}, where i=1,2,...,12 and i would like to estimate this model using rstanarm. Is it possible to set different priors for each intercept a_{i} (so lets say the first 4 have…
quant
  • 4,062
  • 5
  • 29
  • 70
0
votes
0 answers

How to define informative priors in rstanarm?

I have use some binomial count data and have run stan_glm using the default prior. I'm interested in getting the odds ratio (OR) and 95% credible intervals. This works well with the default vague priors. library(rstan)…
0
votes
0 answers

Is there a way to set default refresh=0 as parameter in rstanarm model function calls?

Using R the easiest way to do Bayesian analysis is to load the rstanarm package and just use e.g. stan_glm instead of base R's lm or glm. However, these functions always output very verbous information on the current status of the Markov chains. I'd…
jf1
  • 123
  • 5
0
votes
1 answer

Formula difference specifying random effects on slope rstanarm

I believe the same syntax is used with the lme4 package as rstanarm, but I'm having trouble figuring out exactly what the differences are between the different options when fitting a grouped random effect on the slope. Say we have a model with…
colebrookson
  • 831
  • 7
  • 18
0
votes
0 answers

mcmc_paracord() in bayesplot library wont plot np values

I am learning about the MCMC diagnostics. I use rstanarm to fit a simple model and I want do some diagnostic plots with bayesplot. Nevertheless, the mcmc_paracord() wont put the np values on the plot. Other plots using np values are not working as…
0
votes
0 answers

Is there an easy, error-free way to compute 400 Bayesian regression models at once in R?

I've been trying to run (RStudio) the following Bayesian regression model in a loop around 400 times to get the results for different parameters. After running it, I get the following error messages. I want to use a Bayesian regression model to make…
0
votes
0 answers

stan_betareg gets the error " Invalid stanfit object produced"?

I cannot run stan_betareg. Checked that all y variables are in hte proper support and updated the package. Still doesnt work? What else should I check? Running model<-stan_betareg( linformula, link=c('logit'), data=train , model = TRUE, x = TRUE, y…
0
votes
1 answer

R package igraph cant install, needed for rstanarm. No gfortran found?

Rstanarm seems to install normally. But attempting to load: > library(rstanarm) Error: package or namespace load failed for ‘rstanarm’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called…
0
votes
1 answer

How to specify lower bound as 0 on Bayesian priors

I am using rstanarm and want to create priors that are bound to be positive, so lower>0. How can I do this?
StudentT
  • 3
  • 1
0
votes
1 answer

bayestestR for Bayesian Logistic Regression

I would like to perform Bayesian Logistic Regression using the bayestestR and rstanarm in R. The output, I believe, is in the log(odds ratio). Do you know of a way in which I can convert everything, i.e. the centrality, uncertainty, existence and…
HNSKD
  • 1,614
  • 2
  • 14
  • 25
0
votes
1 answer

Obtain predicted probabilities from rstanarm in ordinal regression

How can I generate the posterior probability distribution for each outcome for each predictor in an ordinal regression? e.g. what I am looking for is this: library(rstanarm) fit_f <- MASS::polr(tobgp ~ agegp, data =…
Misha
  • 3,114
  • 8
  • 39
  • 60
0
votes
1 answer

Question about multilevel logistic model (mixed intercept logistic model) in Stan code

I'm trying to write stan code for multilevel logistic regression. The model that I tried is a mixed intercept logistic model with two predictors. The first level is children level and the second level is mom level. When I tried to match the summary…