rstan

Error on the stan file compilation using R 3.6.0. and Win 10

喜夏-厌秋 提交于 2020-01-16 18:52:51
问题 Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! Error in .shlib_internal(commandArgs(TRUE)) : C++14 standard requested but CXX14 is not defined Calls: <Anonymous> -> .shlib_internal Execution halted In addition: Warning message: In system(cmd, intern = !verbose) : running command 'C:/PROGRA~1/R/R-36~1.0/bin/x64/R CMD SHLIB file1a1860a0379.cpp 2> file1a1860a0379.cpp.err.txt' had status 1 Error in sink(type = "output"

Error on the stan file compilation using R 3.6.0. and Win 10

有些话、适合烂在心里 提交于 2020-01-16 18:51:21
问题 Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! Error in .shlib_internal(commandArgs(TRUE)) : C++14 standard requested but CXX14 is not defined Calls: <Anonymous> -> .shlib_internal Execution halted In addition: Warning message: In system(cmd, intern = !verbose) : running command 'C:/PROGRA~1/R/R-36~1.0/bin/x64/R CMD SHLIB file1a1860a0379.cpp 2> file1a1860a0379.cpp.err.txt' had status 1 Error in sink(type = "output"

prep_call_sampler not found in Stan program in Linux using R

三世轮回 提交于 2020-01-05 03:59:06
问题 I have a simple .stan program for multilevel model that was running fine in Windows. But I was getting this strange error in Linux when I was running it. 'prep_call_sampler not found' 回答1: I tried to find the source of the problem, updated packages and looked up online for solutions. Finally, I saw a blog with a post describing a similar problem in the STAN forum The solution was to simply replace the a*b with a * b in the .stan program and the model works fine in linux. Just thought of

Sampling from prior without running a separate model

江枫思渺然 提交于 2020-01-02 08:01:45
问题 I want to graph the histograms of parameter estimates from a stan model against the priors for those parameters. I have tried doing this by running a model in stan, graphing it with ggplot2, then overlaying an approximation of the prior distribution using R's random generator function (e.g. rnorm() , rbinom() ) but I have run into many scaling issues that make the graphs impossible to get looking right. I was thinking a better way to do it would be simply to sample directly from the prior

Calculating marginal effects in binomial logit using rstanarm

邮差的信 提交于 2019-12-22 17:42:11
问题 I am trying to get the marginal effects, according to this post: http://andrewgelman.com/2016/01/14/rstanarm-and-more/ td <- readRDS("some data") CHAINS <- 1 CORES <- 1 SEED <- 42 ITERATIONS <- 2000 MAX_TREEDEPTH <- 9 md <- td[,.(y,x1,x2)] # selection the columns i need. y is binary glm1 <- stan_glm(y~x1+x2, data = md, family = binomial(link="logit"), prior = NULL, prior_intercept = NULL, chains = CHAINS, cores = CORES, seed = SEED, iter = ITERATIONS, control=list(max_treedepth=MAX_TREEDEPTH)

Fitting a poisson HMM JAGS model with RSTAN

别说谁变了你拦得住时间么 提交于 2019-12-11 18:12:02
问题 Walter Zucchini in his book Hidden Markov Models for Time Series An Introduction Using R, in chapter 8 page 129, adjusts a Poisson HMM using R2OpenBUGS, then I show the code. I am interested in adjusting this same model but with rstan, but since I am new using this package, I am not clear about the syntax any suggestion. data dat <- read.table("http://www.hmms-for-time-series.de/second/data/earthquakes.txt") RJAGS library(R2jags) library(rjags) HMM <- function(){ for(i in 1:m){ delta[i] <- 1

R Prophet crashing Rstudio in loop

送分小仙女□ 提交于 2019-12-11 07:05:47
问题 I've been using prophet in R on windows for several months now and have recently started seeing random RStudio crashes. Prior to a few days ago, I was having no issues. I know that's not much to go off of, but I'm hoping someone can recognize what might be going on with my system. I've noticed that it crashes more frequently when n.changepoints is higher than the default of 25. I see the crashes on both R 3.4 and 3.5. I have Rtools installed properly and can compile cpp code inline as

Extract and add to the data frame the values of sigma from a stan distributional linear model

狂风中的少年 提交于 2019-12-08 05:02:45
问题 Given the sample data sampleDT and the brms models brm.fit and brm.fit.distr below, I would like to: estimate, extract and add to the data frame the values of the standard deviations for each observation from the distributional model brm.fit.distr . I can do this using brm.fit , but my approach fails when I use brm.fit.distr . Sample data sampleDT<-structure(list(id = 1:10, N = c(10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L), A = c(62L, 96L, 17L, 41L, 212L, 143L, 143L, 143L, 73L, 73L), B

Developing Hierarchical Version of Nonlinear Growth Curve Model in Stan

不问归期 提交于 2019-12-08 03:13:07
问题 The following model is model 1 of Preece and Baines (1978, Annals of Human Biology ), and is used to describe human growth. My Stan code for this model is as follows: ```{stan output.var="test"} data { int<lower=1> n; ordered[n] t; // age ordered[n] y; // height of human } parameters { positive_ordered[2] h; real<lower=0, upper=t[n-1]>theta; positive_ordered[2] s; real<lower=0>sigma; } model { h[1] ~ uniform(0, y[n]); h[2] ~ normal(180, 20); sigma ~ student_t(2, 0, 1); s[1] ~ normal(5, 5); s

Can you use sample weights in pystan or pymc3?

老子叫甜甜 提交于 2019-12-08 01:19:56
问题 If my observed dataset has weights (for example tracking multiplicity) is it possible to provide this either to pystan or pymc3, similar to the function signature (http://mc-stan.org/rstanarm/reference/stan_glm.html) in the rstanarm package: stan_glm(formula, family = gaussian(), data, weights, subset, na.action = NULL, offset = NULL, model = TRUE, x = FALSE, y = TRUE, contrasts = NULL, ..., prior = normal(), prior_intercept = normal(), prior_aux = exponential(), prior_PD = FALSE, algorithm =