# CmdStan

**URL:** https://discourse.mc-stan.org/c/interfaces/cmdstan/28.md?page=2

[Latest](https://discourse.mc-stan.org/latest.md) · [Categories](https://discourse.mc-stan.org/categories.md) · [Tags](https://discourse.mc-stan.org/tags.md)

**Page:** 3

---

## [Large difference in uncertainty between manual calculation and stand-alone generated quantities](https://discourse.mc-stan.org/t/large-difference-in-uncertainty-between-manual-calculation-and-stand-alone-generated-quantities/35522)

<div class="topic-metadata">

**Author:** [@JLC](https://discourse.mc-stan.org/u/JLC)\
**Replies:** 4\
**Last updated:** [June 19, 2024, 3:54pm UTC](https://discourse.mc-stan.org/t/large-difference-in-uncertainty-between-manual-calculation-and-stand-alone-generated-quantities/35522 "2024-06-19T15:54:31Z")

</div>

I am working with a piecewise model of viral trajectories with the following function in Stan: // mufun returns mean Ct: real mufun(real t, real peak, real peaktime, real pslope, real cslope, real lod){ …

---

## [Conda cmdstan installation errors on linux CentOS cluster](https://discourse.mc-stan.org/t/conda-cmdstan-installation-errors-on-linux-centos-cluster/35436)

<div class="topic-metadata">

**Author:** [@davidh](https://discourse.mc-stan.org/u/davidh)\
**Replies:** 1\
**Last updated:** [June 10, 2024, 5:33pm UTC](https://discourse.mc-stan.org/t/conda-cmdstan-installation-errors-on-linux-centos-cluster/35436 "2024-06-10T17:33:08Z")

</div>

Hello, I have been attempting to install cmdstan on a linux cluster using the recommended process (from here). conda create -n stan -c conda-forge cmdstan While installing, I got the following errors, I’m not sure if …

---

## [Silent integer conversion in cmdstanr?](https://discourse.mc-stan.org/t/silent-integer-conversion-in-cmdstanr/35402)

<div class="topic-metadata">

**Author:** [@joffdd](https://discourse.mc-stan.org/u/joffdd)\
**Replies:** 5\
**Last updated:** [June 7, 2024, 10:57pm UTC](https://discourse.mc-stan.org/t/silent-integer-conversion-in-cmdstanr/35402 "2024-06-07T22:57:26Z")

</div>

In a stack of R cmdstanr CmdStan: I noticed that when I specify model with a data variable of type int and passing a numeric type variable from R, that it gets silently converted to integers without any warning or err…

---

## [Using the wiener\_lpdf() function in the cmdstanr package to implement a diffusion model ,the construction of a Markov chain was unsuccessful](https://discourse.mc-stan.org/t/using-the-wiener-lpdf-function-in-the-cmdstanr-package-to-implement-a-diffusion-model-the-construction-of-a-markov-chain-was-unsuccessful/35284)

<div class="topic-metadata">

**Author:** [@jlb](https://discourse.mc-stan.org/u/jlb)\
**Replies:** 7\
**Last updated:** [May 30, 2024, 12:31am UTC](https://discourse.mc-stan.org/t/using-the-wiener-lpdf-function-in-the-cmdstanr-package-to-implement-a-diffusion-model-the-construction-of-a-markov-chain-was-unsuccessful/35284 "2024-05-30T00:31:45Z")

</div>

https://discourse.mc-stan.org/t/using-the-wiener-lpdf-function-in-the-cmdstanr-package-to-implement-a-diffusion-model-the-construction-of-a-markov-chain-was-unsuccessful/35213/12 I encountered the same problem as before…

---

## [Loo moment match advice with random effects model fit in cmdstanr](https://discourse.mc-stan.org/t/loo-moment-match-advice-with-random-effects-model-fit-in-cmdstanr/35238)

<div class="topic-metadata">

**Author:** [@scienceanna](https://discourse.mc-stan.org/u/scienceanna)\
**Replies:** 5\
**Last updated:** [May 24, 2024, 9:20am UTC](https://discourse.mc-stan.org/t/loo-moment-match-advice-with-random-effects-model-fit-in-cmdstanr/35238 "2024-05-24T09:20:10Z")

</div>

Hi, I’m attempting to use moment matching with loo for a model fitted in R with cmdstan that includes random effects. (Loo without moment matching fits fine, but throws up pareto-k warnings). Unfortunately, I get the f…

---

## [Chain 1 Rejecting initial value: Chain 1 Error evaluating the log probability at the initial value. Chain 1 Exception: Exception: wiener\_lpdf: Random variable = 0.560084, but must be greater than nondecision time = 2.48104](https://discourse.mc-stan.org/t/chain-1-rejecting-initial-value-chain-1-error-evaluating-the-log-probability-at-the-initial-value-chain-1-exception-exception-wiener-lpdf-random-variable-0-560084-but-must-be-greater-than-nondecision-time-2-48104/35202)

<div class="topic-metadata">

**Author:** [@jlb](https://discourse.mc-stan.org/u/jlb)\
**Replies:** 0\
**Last updated:** [May 19, 2024, 2:20am UTC](https://discourse.mc-stan.org/t/chain-1-rejecting-initial-value-chain-1-error-evaluating-the-log-probability-at-the-initial-value-chain-1-exception-exception-wiener-lpdf-random-variable-0-560084-but-must-be-greater-than-nondecision-time-2-48104/35202 "2024-05-19T02:20:51Z")

</div>

Hello everyone, I encountered such a problem when running the cmdstanr package, I have been thinking about it for a long time and don’t know how to solve it, I hope someone can help me take a look at it if you have time,…

---

## [Sequential sampling of different models](https://discourse.mc-stan.org/t/sequential-sampling-of-different-models/35186)

<div class="topic-metadata">

**Author:** [@jelly](https://discourse.mc-stan.org/u/jelly)\
**Replies:** 0\
**Last updated:** [May 16, 2024, 10:25pm UTC](https://discourse.mc-stan.org/t/sequential-sampling-of-different-models/35186 "2024-05-16T22:25:07Z")

</div>

This may not be a Stan question but an R question, but when running MCMC on multiple models sequentially, is there a way to have the processors that are not being used go to the next model? For example, let’s say I have…

---

## [Access Hessian from optimize method in CmdStanR](https://discourse.mc-stan.org/t/access-hessian-from-optimize-method-in-cmdstanr/17789)

<div class="topic-metadata">

**Author:** [@wittja01](https://discourse.mc-stan.org/u/wittja01)\
**Replies:** 19\
**Last updated:** [May 16, 2024, 9:40pm UTC](https://discourse.mc-stan.org/t/access-hessian-from-optimize-method-in-cmdstanr/17789 "2024-05-16T21:40:10Z")

</div>

Is it possible to access the Hessian from the output when using cmdstan’s optimize method in R or to specify a draws argument so I can get estimates of standard errors on the constrained parameter space? I was using the…

---

## [Hierarchical Modeling with Aggregated Data](https://discourse.mc-stan.org/t/hierarchical-modeling-with-aggregated-data/35185)

<div class="topic-metadata">

**Author:** [@mstockingham](https://discourse.mc-stan.org/u/mstockingham)\
**Replies:** 0\
**Last updated:** [May 16, 2024, 2:39pm UTC](https://discourse.mc-stan.org/t/hierarchical-modeling-with-aggregated-data/35185 "2024-05-16T14:39:52Z")

</div>

Hello! I am attempting to build a hierarchical model in STAN. My hierarchy is national → businesses → states → locations. I have data at the location-day level and it seems impossible for my code to run (for a number of…

---

## [Cmdstan on Mac](https://discourse.mc-stan.org/t/cmdstan-on-mac/30550)

<div class="topic-metadata">

**Author:** [@Arianna\_Gambardella](https://discourse.mc-stan.org/u/Arianna_Gambardella)\
**Replies:** 7\
**Last updated:** [May 15, 2024, 9:35pm UTC](https://discourse.mc-stan.org/t/cmdstan-on-mac/30550 "2024-05-15T21:35:20Z")

</div>

I am trying to run a Stan model on python (using cmdstanpy) on a Mac computer. The error I get is the following: CmdStan’s precompiled header (PCH) files may need to be rebuilt.Please run cmdstanpy.rebuild\_cmdstan(). Wh…

---

## [How to increase the number of dropped evaluations variational bayes cmdstanr?](https://discourse.mc-stan.org/t/how-to-increase-the-number-of-dropped-evaluations-variational-bayes-cmdstanr/35115)

<div class="topic-metadata">

**Author:** [@carlos\_perez](https://discourse.mc-stan.org/u/carlos_perez)\
**Replies:** 2\
**Last updated:** [May 14, 2024, 8:39pm UTC](https://discourse.mc-stan.org/t/how-to-increase-the-number-of-dropped-evaluations-variational-bayes-cmdstanr/35115 "2024-05-14T20:39:49Z")

</div>

Kind regards. I am running a model using variational Bayes. I am able to run the model using a subsample of the data of 10K observations, but when I try with the full dataset of 500K observations I get the following er…

---

## [Cmdstanr::install\_cmdstan() GitHub Timeone, need authentication token](https://discourse.mc-stan.org/t/cmdstanr-install-cmdstan-github-timeone-need-authentication-token/35057)

<div class="topic-metadata">

**Author:** [@Richard\_Erickson](https://discourse.mc-stan.org/u/Richard_Erickson)\
**Replies:** 2\
**Last updated:** [May 7, 2024, 5:48pm UTC](https://discourse.mc-stan.org/t/cmdstanr-install-cmdstan-github-timeone-need-authentication-token/35057 "2024-05-07T17:48:56Z")

</div>

I’m getting a timeout for cmdstanr::install\_cmdstan(). Is there an option like: remotes::install\_github("stan-dev/cmdstanr", auth\_token = \<my private token here\>) for cmdstanr::install\_cmdstan()? This is being insta…

---

## [Cmdstanr processx\_exec Error](https://discourse.mc-stan.org/t/cmdstanr-processx-exec-error/30597)

<div class="topic-metadata">

**Author:** [@jswesner](https://discourse.mc-stan.org/u/jswesner)\
**Replies:** 5\
**Last updated:** [April 30, 2024, 6:35pm UTC](https://discourse.mc-stan.org/t/cmdstanr-processx-exec-error/30597 "2024-04-30T18:35:58Z")

</div>

I am trying to run a model from the rethinking package, but am getting the following error: Error in process\_initialize(self, private, command, args, stdin, stdout, …: ! Native call to processx\_exec failed Caused by e…

---

## [Error installing mingw32-make via RTools43](https://discourse.mc-stan.org/t/error-installing-mingw32-make-via-rtools43/34921)

<div class="topic-metadata">

**Author:** [@Vegae](https://discourse.mc-stan.org/u/Vegae)\
**Replies:** 2\
**Last updated:** [April 27, 2024, 8:02pm UTC](https://discourse.mc-stan.org/t/error-installing-mingw32-make-via-rtools43/34921 "2024-04-27T20:02:10Z")

</div>

Hi! I have been trying to install CmdStanR and get it to work on my laptop using the C++ toolchain tutorial listed here, however, I keep running into an error when trying to install the mingw32-make utility via Bash in R…

---

## [CmdStan on Linux server - Chain finished unexpectedly with schools example (but not with bernoulli example)](https://discourse.mc-stan.org/t/cmdstan-on-linux-server-chain-finished-unexpectedly-with-schools-example-but-not-with-bernoulli-example/34759)

<div class="topic-metadata">

**Author:** [@stressfaktors](https://discourse.mc-stan.org/u/stressfaktors)\
**Replies:** 17\
**Last updated:** [April 24, 2024, 7:33pm UTC](https://discourse.mc-stan.org/t/cmdstan-on-linux-server-chain-finished-unexpectedly-with-schools-example-but-not-with-bernoulli-example/34759 "2024-04-24T19:33:01Z")

</div>

Hello, I have been trying to fit models using cmdstan and cmdstanr on a Linux server. cmdstanr version 0.7.1 cmdstan version 2.30.1 Operating System: Linux Centos7 I can get the Bernoulli example (see attached code …

---

## [Reproducibility of a non-linear model](https://discourse.mc-stan.org/t/reproducibility-of-a-non-linear-model/34656)

<div class="topic-metadata">

**Author:** [@Garren\_Hermanus](https://discourse.mc-stan.org/u/Garren_Hermanus)\
**Replies:** 3\
**Last updated:** [April 23, 2024, 10:50pm UTC](https://discourse.mc-stan.org/t/reproducibility-of-a-non-linear-model/34656 "2024-04-23T22:50:49Z")

</div>

Hi all. I have been having some trouble with the reproducibility of my model. The problem is fairly ill behaved (several different modes some of which may be close to one another in terms of the log posterior value). I …

---

## [Impossible to download CmdStanR on Mac Sonoma 14.1 Intel Chip](https://discourse.mc-stan.org/t/impossible-to-download-cmdstanr-on-mac-sonoma-14-1-intel-chip/34270)

<div class="topic-metadata">

**Author:** [@matp1802](https://discourse.mc-stan.org/u/matp1802)\
**Replies:** 1\
**Last updated:** [March 7, 2024, 10:49pm UTC](https://discourse.mc-stan.org/t/impossible-to-download-cmdstanr-on-mac-sonoma-14-1-intel-chip/34270 "2024-03-07T22:49:00Z")

</div>

I can’t install CmdStanR on my R studio on my Mac as it can’t reach my sh: rm: command Operating System: Sonoma 14.1.1

---

## [Windows 11 cmdstan installation issue: Architecture not detected, related to version\_tbb\_2020.3](https://discourse.mc-stan.org/t/windows-11-cmdstan-installation-issue-architecture-not-detected-related-to-version-tbb-2020-3/34489)

<div class="topic-metadata">

**Author:** [@qdread](https://discourse.mc-stan.org/u/qdread)\
**Replies:** 8\
**Last updated:** [April 22, 2024, 1:23am UTC](https://discourse.mc-stan.org/t/windows-11-cmdstan-installation-issue-architecture-not-detected-related-to-version-tbb-2020-3/34489 "2024-04-22T01:23:46Z")

</div>

I have been searching all available information on these forums, GitHub Issues, and Stackoverflow, and trying out various solutions, all without success, to install CmdStan on a Windows 11 machine, on which I do not have…

---

## [Stan code compiles in RStan but not in CmdStan](https://discourse.mc-stan.org/t/stan-code-compiles-in-rstan-but-not-in-cmdstan/34736)

<div class="topic-metadata">

**Author:** [@stephando](https://discourse.mc-stan.org/u/stephando)\
**Replies:** 2\
**Last updated:** [April 8, 2024, 6:53am UTC](https://discourse.mc-stan.org/t/stan-code-compiles-in-rstan-but-not-in-cmdstan/34736 "2024-04-08T06:53:40Z")

</div>

Hi I have the very same Stan code, that I run in RStan and compiles without any problem, but which does not compile in CmdStan. The CmdStan is run through Mathematica, and I checked the installation before with some oth…

---

## [How to install older version of cmdstanr](https://discourse.mc-stan.org/t/how-to-install-older-version-of-cmdstanr/34715)

<div class="topic-metadata">

**Author:** [@ykogr](https://discourse.mc-stan.org/u/ykogr)\
**Replies:** 2\
**Last updated:** [April 5, 2024, 12:40pm UTC](https://discourse.mc-stan.org/t/how-to-install-older-version-of-cmdstanr/34715 "2024-04-05T12:40:37Z")

</div>

I would like to install cmdstanr on R running on Rstudio. I would like to install an older version of cmdstanr (cmdstanr\_0.5.3) for compatibility with the stan code I have written previously. How can I install an older v…

---

## [Pathfinder: num\_threads and num CPUs](https://discourse.mc-stan.org/t/pathfinder-num-threads-and-num-cpus/34639)

<div class="topic-metadata">

**Author:** [@irelamb](https://discourse.mc-stan.org/u/irelamb)\
**Replies:** 4\
**Last updated:** [March 29, 2024, 3:54pm UTC](https://discourse.mc-stan.org/t/pathfinder-num-threads-and-num-cpus/34639 "2024-03-29T15:54:44Z")

</div>

Hi, I have probably a very naïve question… When we use pathfinder and there are as many CPUs availables as num\_paths, does each pathfinder run in parallel? How should num\_threads be set to optimize speed? Sorry for the…

---

## [How to obtain Bayes Factor for model comparison with CmdStanR fit object?](https://discourse.mc-stan.org/t/how-to-obtain-bayes-factor-for-model-comparison-with-cmdstanr-fit-object/34569)

<div class="topic-metadata">

**Author:** [@Haoran\_Matt\_Wan](https://discourse.mc-stan.org/u/Haoran_Matt_Wan)\
**Replies:** 1\
**Last updated:** [March 22, 2024, 7:41pm UTC](https://discourse.mc-stan.org/t/how-to-obtain-bayes-factor-for-model-comparison-with-cmdstanr-fit-object/34569 "2024-03-22T19:41:32Z")

</div>

Hi everyone - I am trying to obtain Bayes Factors for model comparison (more than two models), and I used cmdstan\_stan to fit all models. I’ve tried functions from different packages such as bayestestR and brms but fai…

---

## [Cmdstan compilation errors on M3 Macos 14.4](https://discourse.mc-stan.org/t/cmdstan-compilation-errors-on-m3-macos-14-4/34583)

<div class="topic-metadata">

**Author:** [@stephando](https://discourse.mc-stan.org/u/stephando)\
**Replies:** 2\
**Last updated:** [March 24, 2024, 4:14pm UTC](https://discourse.mc-stan.org/t/cmdstan-compilation-errors-on-m3-macos-14-4/34583 "2024-03-24T16:14:51Z")

</div>

Hi all, I just installed and run Cmdstan on a M3 Max Apple silicone, with MacOS 14.4. The installation was done with conda following the recommended installation step: conda create -n stan -c conda-forge cmdstan When…

---

## [Segmentation Faults](https://discourse.mc-stan.org/t/segmentation-faults/34466)

<div class="topic-metadata">

**Author:** [@noah99](https://discourse.mc-stan.org/u/noah99)\
**Replies:** 11\
**Last updated:** [March 20, 2024, 1:23pm UTC](https://discourse.mc-stan.org/t/segmentation-faults/34466 "2024-03-20T13:23:58Z")

</div>

Hi, Running a fairly simple model, with one random effect, and it always crashes with a segmentation fault. Ive tried different parameterizations, different priors, et. Always segmentation fault after running for a fe…

---

## [Checking if sampling uses initial values?](https://discourse.mc-stan.org/t/checking-if-sampling-uses-initial-values/34406)

<div class="topic-metadata">

**Author:** [@Guido\_Biele](https://discourse.mc-stan.org/u/Guido_Biele)\
**Replies:** 4\
**Last updated:** [March 10, 2024, 10:51am UTC](https://discourse.mc-stan.org/t/checking-if-sampling-uses-initial-values/34406 "2024-03-10T10:51:42Z")

</div>

Hello, I am using pathfinder to find initialisation values for sampling, but the warmup phase seems still very slow. Now I am wondering if I am doing something wrong and the user-submitted initial value are not used. F…

---

## [Cmdstan linking error on linux server](https://discourse.mc-stan.org/t/cmdstan-linking-error-on-linux-server/34133)

<div class="topic-metadata">

**Author:** [@Garren\_Hermanus](https://discourse.mc-stan.org/u/Garren_Hermanus)\
**Replies:** 8\
**Last updated:** [February 20, 2024, 3:45pm UTC](https://discourse.mc-stan.org/t/cmdstan-linking-error-on-linux-server/34133 "2024-02-20T15:45:04Z")

</div>

Hey all I have encountered problems with installing cmdstan on a linux server. The server has mutiple toolchains which may be activated. I am using CmdStan: 2.34.0 gcc: 9.4.0 gnu make: 3.82 running make build -j4 fr…

---

## [Cmdstan install error](https://discourse.mc-stan.org/t/cmdstan-install-error/34066)

<div class="topic-metadata">

**Author:** [@dslramsey](https://discourse.mc-stan.org/u/dslramsey)\
**Replies:** 7\
**Last updated:** [February 12, 2024, 2:53am UTC](https://discourse.mc-stan.org/t/cmdstan-install-error/34066 "2024-02-12T02:53:54Z")

</div>

Hi, I have recently been in receipt of a new laptop and have been trying to install cmdstan and have run into an issue. My environment is Win10 enterprise (but with admin priviliges) R version 4.3.2 Rstudio 2023.12…

---

## [Model comparison (LOO?) from cmdstanr objects](https://discourse.mc-stan.org/t/model-comparison-loo-from-cmdstanr-objects/34035)

<div class="topic-metadata">

**Author:** [@Alasdair\_Clarke](https://discourse.mc-stan.org/u/Alasdair_Clarke)\
**Replies:** 4\
**Last updated:** [February 8, 2024, 9:50am UTC](https://discourse.mc-stan.org/t/model-comparison-loo-from-cmdstanr-objects/34035 "2024-02-08T09:50:07Z")

</div>

Hello, I am attempting to add in some form of model comparison, weights etc toa project that makes use of cmdstanr. I have used some of these tools before on brms objects, but never in a project in which I’ve written m…

---

## [Getting "Error in file(con, "r"): cannot open the connection" with cmdstanr backend](https://discourse.mc-stan.org/t/getting-error-in-file-con-r-cannot-open-the-connection-with-cmdstanr-backend/33896)

<div class="topic-metadata">

**Author:** [@joels](https://discourse.mc-stan.org/u/joels)\
**Replies:** 2\
**Last updated:** [January 21, 2024, 4:10pm UTC](https://discourse.mc-stan.org/t/getting-error-in-file-con-r-cannot-open-the-connection-with-cmdstanr-backend/33896 "2024-01-21T16:10:09Z")

</div>

When I run cmdstan\_example() it fails the first time with “Error in file(con, “r”): cannot open the connection,” but works as expected if run the same command a second time (on the second try it also prints the message “…

---

## [Canonicalizer not working in latest Cmdstan and cmdstanr](https://discourse.mc-stan.org/t/canonicalizer-not-working-in-latest-cmdstan-and-cmdstanr/33880)

<div class="topic-metadata">

**Author:** [@nicholasjclark](https://discourse.mc-stan.org/u/nicholasjclark)\
**Replies:** 2\
**Last updated:** [January 19, 2024, 2:59am UTC](https://discourse.mc-stan.org/t/canonicalizer-not-working-in-latest-cmdstan-and-cmdstanr/33880 "2024-01-19T02:59:16Z")

</div>

Hi all. I recently upgraded to the latest versions of Cmdstan and cmdstanr, and now my canonicalizer is not working. The example gives the following error: file \<- write\_stan\_file(" parameters { real x\[2\]; } model { …

[Previous page](https://discourse.mc-stan.org/c/interfaces/cmdstan/28.md?page=1)

[Next page](https://discourse.mc-stan.org/c/interfaces/cmdstan/28.md?page=3)
