Hi James,
Thank you very much for your reply. Here is my original code:
model {
for (k in 1:s) {
for (j in 1:n_s){
mu[(k*s-s+j)] = alpha[k] + X[(k*s-s+j), 1]*beta
lambda_tweedie[(k*s-s+j)] = 1/phi*mu[(k*s-s+j)]^(2-p)/(2-p);
alpha_tweedie[(k*s-s+j)] = (2-p)/(p-1);
beta_tweedie[(k*s-s+j)] = 1/phi*mu[(k*s-s+j)]^(1-p)/(p-1);
}
}
}
}
Then console will return the following error message:
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
Warning (non-fatal):
Left-hand side of sampling statement (~) may contain a non-linear transform of a parameter or local variable.
If it does, you need to include a target += statement with the log absolute determinant of the Jacobian of the transform.
Left-hand-side of sampling statement:
p_star ~ normal(...)
Cannot assign to variable outside of declaration block; left-hand-side variable origin=parameter
error in 'model4d2c215e6b7a_model' at line 57, column 27
-------------------------------------------------
55: for (k in 1:s) {
56: for (j in 1:n_s){
57: mu[(k*s-s+j)] = alpha[k] + X[(k*s-s+j), 1]*beta
^
58:
-------------------------------------------------
PARSER EXPECTED: <expression assignable to left-hand side>
Error in stanc(file = file, model_code = model_code, model_name = model_name, :
failed to parse Stan model 'model' due to the above error.
In addition: Warning message:
In readLines(file, warn = TRUE) :
Thank you very much for your help.
With appreciation,
Tairan