Beta distribution as likelihood with different prior(uniform- truncated uniform- gamma,…)
but the normal beta not work with stan_model
I just needed to run library(simulations) to simulate ‘prep’
I try this
data{
int N;
real theta[N];
real<lower=0,upper=1> phi;
real<lower=0.1> lambda;
}
transformed parameters {
real<lower=0> alpha = lambda * phi;
real<lower=0> beta = lambda * (1 - phi);
}
model {
theta ~ beta(lambda * phi, lambda * (1 - phi));
}
and this second try
model {
real alpha = lambda * phi
real beta = lambda * (1 - phi);
for (n in 1:N)
theta[n] ~ beta(alpha, beta);
}
the third try
model {
phi ~ beta(1, 1); // uniform
lambda ~ pareto(0.1, 1.5);
for (n in 1:N)
theta[n] ~beta_1pdf(alpha, beta);
}
i get this message
Error in stanc(filename, allow_undefined = TRUE) :
failed to parse Stan model ‘4_file’ due to the above error.
In addition: Warning message:
In readLines(file, warn = TRUE) :
incomplete final line found on ‘4_file.stan’
rstan:::rstudio_stanc(“4_file.stan”)
PARSER FAILED TO PARSE INPUT COMPLETELY
STOPPED AT LINE 17:
}
Error in stanc(filename, allow_undefined = TRUE) :
failed to parse Stan model ‘4_file’ due to the above error.
In addition: Warning message:
In readLines(file, warn = TRUE) :
incomplete final line found on ‘4_file.stan’
I don’t know why it is not complete
also, if I add beta_1pdf for likelihood ,it is error (lambda, and phi are continuous in my data)
like this
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
Probability function must end in _lpdf or _lpmf. Found distribution family = beta_1pdf with no corresponding probability function beta_1pdf_lpdf, beta_1pdf_lpmf, or beta_1pdf_log
addition I don’t find kummer distribution {one of Kummer’s functions (a confluent hypergeometric function)}