Error in `process_initialize when compiling Rstan code

368 Views Asked by At

I have the following Rcode

library(cmdstanr)

d <- read.csv(file='data-salary.csv')
data <- list(N=nrow(d), X=d$X, Y=d$Y)
model <- cmdstan_model('model4-4.stan')

init_fun <- function(chain_id) {
  set.seed(chain_id)
  list(a=runif(1,30,50), b=runif(1,0,1), sigma=5)
}

fit <- model$sample(
  data=data, seed=123,
  init=init_fun,
  chains=3, iter_warmup=500, iter_sampling=500, thin=2,
  parallel_chains=3,
  save_warmup=TRUE
)

linked to the following STAN code called "model4-4.stan":

data {
  int N;
  vector[N] X;
  vector[N] Y;
}

parameters {
  real a;
  real b;
  real<lower=0> sigma;
}

model {
  Y[1:N] ~ normal(a + b*X[1:N], sigma);
}

When I compile the line

model <- cmdstan_model('model4-4.stan')

I get the following error message:

Compiling Stan program...
Error in `process_initialize(self, private, command, args, stdin, stdout, …`:
! Native call to `processx_exec` failed
Caused by error in `chain_call(c_processx_exec, command, c(command, args), pty, pty_options, …`:
! Command 'bin/stanc.exe' not found @win/processx.c:982 (processx_exec)
Type .Last.error to see the more details.

Can someone help me please?

I try to read the documentation or previous posts but I do not understand how to overcome the problem.

0

There are 0 best solutions below