[R] RSTAN

peri He @t@t|@t|c@84 @end|ng |rom hotm@||@com
Sun Jun 20 03:15:04 CEST 2021


Dear Friends,

I have started to write some codes for RSTAN, I have a general question regarding likelihood function.
Below you can see a simple structure of RSTAN model. For most of the codes, in the "model" block, I saw priors (hyperpriors) and likelihood functions.
In a few programs, I don't see a likelihood function (such as the model shown below). Has any default function been defined in RSTAN or I am mistaking?
I would appreciate your help.

Regards,
 Peri



model.stan <- "data { int<lower=0> i;
                                 .
                                 .
                                 .

                                }

                          parameters {
                                      real Mi;
                                      real<lower=0> De;
                                      real R[i];
                                      }

                          model {
                                for(i in 1:I) {
                                              b[i] ~ normal(R[i], C[i]);
                                              R[i] ~ normal(Mi,  De);
                                              }

                                Mi ~ normal(0, 10);
                                De ~ uniform(0,sigma);
                                }"

stan(model_code = model.stan,
     data = data,
     init = rep(.),
     chains = .,
     iter =iter1,
     .
     .
     refresh = 50000
)

	[[alternative HTML version deleted]]



More information about the R-help mailing list