Dimension mismatch error

age.csv (389 Bytes) Antigen_Decay_more.csv (33.6 KB) runR.R (477 Bytes) sample.stan (768 Bytes)

Hi, I get thié error below when I run the code. Can you assist me please?

Exception: mismatch in number dimensions declared and found in context; processing stage=data initialization; variable name=x; dims declared=(50); dims found=(1,50) (in ‘model23cc35116663_sample’ at line 6)

In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘-E’ not found
failed to create the sampler; sampling not done

1 Like

Hi,
the reason seems to be that after converting from data.frame, X is a matrix, while Stan expects an array. You should be able to get the model to work with either:

antigen_dat <- list(N = N_, 
                    K = K,
                    x = X[1,],
                    y=datay,
                    )

or

antigen_dat <- list(N = N_, 
                    K = K,
                    x = as.numeric(X),
                    y=datay,
                    )

Best of luck with your model

Thank you Martin. It works now