Error message when running model ulam

M2 <- ulam(
  alist(
    points ~ dbinom( market, p),
    logit(p) <- a[state],
    a[state] ~ dnorm(a_bar,sigma),
    a_bar ~ dnorm(0, 1),
    sigma ~ dexp(1)
  ), data = A_list, chains = 4, log_lik=TRUE)

I have made this model to test the total effect of state on points. It goes from state - market - points.

But im getting this error:

Warning in system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found

SAMPLING FOR MODEL ‘e7a2d10df32b9649320ef3f20cc09b2e’ NOW (CHAIN 1).
Chain 1: Unrecoverable error evaluating the log probability at the initial value.
Chain 1: Exception: []: accessing element out of range. index 0 out of range; expecting index to be between 1 and 2; index position = 1a (in ‘model44a493021e9_e7a2d10df32b9649320ef3f20cc09b2e’ at line 18)

[1] "Error in sampler$call_sampler(args_list[[i]]) : "                                                                                                                                                      
[2] "  Exception: []: accessing element out of range. index 0 out of range; expecting index to be between 1 and 2; index position = 1a  (in 'model44a493021e9_e7a2d10df32b9649320ef3f20cc09b2e' at line 18)"
[1] "error occurred during calling the sampler; sampling not done"
Stan model 'e7a2d10df32b9649320ef3f20cc09b2e' does not contain samples.
 Error in validObject(.Object) : 
invalid class “ulam” object: invalid object for slot "coef" in class "ulam": got class "NULL", should be or extend class "numeric"

And im at a loss for what to do

indicates that Stan can’t find a compiler in that location (where it expects it to be). Sorry, I’m no Windows user myself, so can’t say much more than that :(

i tested it on my other computer and that line didnt show up there, but the rest of the error was the same

@andrjohns should know what this is :)

i figured it out! i had to edit the list i used and change variables 0 and 1 to 1 and 2

1 Like