Stan model does not contain samples

Now I have create a stan file named as moments.stan .The stan file is syntactically correct , but when I run the R software , Stan model ‘moments’ does not contain samples. What I should do ?Thank you so much.

Hi @xiaodi321,

This can happen for many reasons so it would be best if you could share the Stan model and small reproducible example. In this way, we can help you figure out what the problem is.

Cheers

Ok,thank you a lot . I hope you can give me some uesful advices.
My main is to estimate the beta using generalized methods of moment.

Thank you very much@tiagocc ,I want to know that is there an error in using the stan function in the R program. The parameter I want to estimate is the vector beta,so are there any questions?

Your inits function does not return anything. It should return a named list, so you can correct it to

inits <- function(){
  list(beta = beta_init0)
}

I am so sorry .I made a great mistake ,thank you so much @jtimonen.Futhermore ,when I try it ,there is also the same result.

There is warning message :“Log probability evaluates to log(0), i.e. negative infinity.”,what I should do ?
Thank you very much.

You had

  cov_onepart =rep_matrix(0,p,p);
  for (i in 1:n){
    tm=col(m,i);
    cov_onepart_o +=tm*tm';
  }

and cov_onepart_o was not set to any value. I think you should have

  cov_onepart_o =rep_matrix(0,p,p);
  for (i in 1:n){
    tm=col(m,i);
    cov_onepart_o +=tm*tm';
  }

I am so carelessness,thank you for your help .Now I have solve the problem.