0

The likelihood function for my data (m) is like below:

          "dexp(m,beta) * pnorm(m,mu,sigma)".

The user defined loglikelihood function that I wrote inside my STAN code is like:

functions{
    real loglikelihood(int N,
    real mu,
    real sigma,
    real beta,
    real[] m
    ){
      real a[N];
      real b[N];
      real c[N];
      real final;
      for(i in 1:N){

         a[i]<-  exponential_log(m[i],beta);
         b[i]<-  normal_cdf_log( m[i],  mu,  sigma);
         c[i]<-  a[i]+b[i];
     }

     final<- sum(c);
     return(final);
  }
}

. I want to know if I am doing it right? Can I use the STAN functions like "exponential_log" and "normal_cdf_log" inside the user defined function?

Geotas
  • 35
  • 6

0 Answers0