Stan

hi all.
I am estimating stan, I am facing this error.
what should I do?
can anyone help?
stan.R (885 Bytes)

Hi, @shayeste. It’s easier for us if you just paste into the message rather than attaching. In your attachment, there’s no error. What’s the error you’re getting?

hi , i am getting this error.
i did not know what to do . thank you for your time.

packageVersion(“rstan”)
[1] ‘2.21.5’
write("// Stan model for simple linear regression

  • data {
  • int < lower = 1 > N; // Sample size
  • vector[N] x; // Predictor
  • vector[N] y; // Outcome
  • }
  • parameters {
  • real alpha; // Intercept
  • real beta; // Slope (regression coefficients)
  • real < lower = 0 > sigma; // Error SD
  • }
  • model {
  • y ~ normal(alpha + x * beta , sigma);
  • }
  • generated quantities {
  • } // The posterior predictive distribution",
  • “stan_model1.stan”)

stanc=(“stan_model1.stan”)
stan_model1 ← “stan_model1.stan”
fit ← stan(file = stan_model1, data = Hyperglysemya, warmup = 500, iter = 1000, chains = 4, cores = 2, thin = 1)
Error in FUN(X[[i]], …) : Stan does not support NA (in avg) in data
In addition: Warning message:
In FUN(X[[i]], …) : data with name name is not numeric and not used
failed to preprocess the data; sampling not done

@Bob_Carpenter