Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stan_demo example 500 not working #144

Open
caimiao0714 opened this issue Nov 30, 2018 · 4 comments
Open

stan_demo example 500 not working #144

caimiao0714 opened this issue Nov 30, 2018 · 4 comments

Comments

@caimiao0714
Copy link

Hi Ben,

I tried the 500th example of stan_demo, but it seems not to be working. I ran the code from RStudio cloud. Here are my codes:

library(RStan)
stan_demo()
500

Here are the console log:

> K <- 8

> D <- 4

> N <- 500

> y <- 
>+ structure(c(1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0,
>+ 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0,  .... [TRUNCATED] 

> x <- 
+ structure(c(-0.56947710721168, 0.0686981186395276, 0.807151998639757,
+ 0.311832939914023, 0.670993954113173, -0.914759441112067, -0.1375718 .... [TRUNCATED] 


SAMPLING FOR MODEL 'probit-multi-good' NOW (CHAIN 1).
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.
Rejecting initial value:
  Error evaluating the log probability at the initial value.
Exception: Phi: x is nan, but must not be nan!  (in 'model4f66680104f2_probit_multi_good' at line 26)

Rejecting initial value:
  Log probability evaluates to log(0), i.e. negative infinity.
  Stan can't start sampling from this initial value.

Initialization between (-2, 2) failed after 100 attempts. 
 Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
[1] "Error in sampler$call_sampler(args_list[[i]]) : Initialization failed."
error occurred during calling the sampler; sampling not done
@bob-carpenter
Copy link
Contributor

Thanks. The set of examples was just scraped and many of them don't work. In my opinion, it should be edited down to a small set of working examples. The decision's up to @bgoodri.

@bob-carpenter
Copy link
Contributor

Also, this is partly an RStan issue for just scraping this repo and partly this repo's fault for not having consistent working examples. So there are two ways to fix it---either by pruning example-models or by cleaning up RStan. Cleaning the example-models repo is probably best.

@bgoodri
Copy link
Contributor

bgoodri commented Nov 30, 2018 via email

@bgoodri
Copy link
Contributor

bgoodri commented Nov 30, 2018

In this case, I think it is fine if you specify init_r = 1 or thereabouts. But we don't have a way of knowing that in stan_demo. I guess the example-models repo could optionally specify initial values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants