SYNTAX ERROR, MESSAGE(S) FROM PARSER: No matches for:

Please share your Stan program and accompanying data if possible.


functions{
real customProb_log(vector x, real alpha, real beta, real miu, real sigma){
vector[num_elements(x)] prob;
real lprob;
for (i in 1:num_elements(x)){
prob[i]=(4*alpha*(1-alpha))*exp(-0.5*pow((fabs((x[i]-miu)/sigma)+(2*alpha-1)*((x[i]-miu)/sigma)),2/(1+beta)))/tgamma(1+((1+beta)/2)*pow(2,1+((1+beta)/2)));
}
lprob=sum(log(prob));
return lprob;
	}
}
data{
     int N;
     real Y[N];
}
parameters{
    real<lower=0,upper=1> alpha;
    real<lower=-1,upper=1> beta;
    real miu;
    real<lower=0> sigma;
}
model{
  for(i in 1:N)
  Y~customProb(alpha, beta, miu, sigma);
}
i get this error
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
No matches for: 

  real[ ] ~ customProb(real, real, real, real)

Available argument signatures for customProb:

  vector ~ customProb(real, real, real, real)

Real return type required for probability function.
 error in 'model18e43eca1047_new' at line 24, column 40
  -------------------------------------------------
    22: model{
    23:   for(i in 1:N)
    24:   Y~customProb(alpha, beta, miu, sigma);
                                               ^
    25: }
  -------------------------------------------------

Error in stanc(filename, allow_undefined = TRUE) : 
  failed to parse Stan model 'new' due to the above error.
help what do i do

I think the _log suffix has been long-deprecated; try _lupdf

Oh wait, the suffix isn’t the issue, but the input type declarations. Your custom function is written to expect a vector as the first argument, but you’ve passed in an array of reals. In your data block, declare Y as a vector instead of an array or reals.

thanks works fine…

cmodel<-stan_model(‘new.stan’)
fit ← sampling(cmodel, warmup=100, iter=600, seed=1,data=list(x=x, N=length(x)))
Error in mod$fit_ptr() :
Exception: variable does not exist; processing stage=data initialization; variable name=Y; base type=vector_d (in ‘model218c72afb6e_new’ at line 15)

failed to create the sampler; sampling not done
had generated
y<-rnorm(100)
but am gettimg the above error