[R] RSTAN

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Sun Jun 20 03:54:11 CEST 2021


Off topic. Read the Posting Guide before posting here.

You may find a more suitable forum via the Url entry in the rstan description file [1].

[1] https://cran.r-project.org/web/packages/rstan/index.html

On June 19, 2021 6:15:04 PM PDT, peri He <statistics84 using hotmail.com> wrote:
>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]]
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list