Error message by using Stan

198 views
Skip to first unread message

jie liu

unread,
Sep 20, 2016, 2:47:06 PM9/20/16
to Stan users mailing list
Hi All,

Could you please help me to check there messages that shows after I run fit<-stan(file.choose(),iter=1000,chains=2):


DIAGNOSTIC(S) FROM PARSER:
Warning: Deprecated function 'binomial_log'; please replace suffix '_log' with '_lpdf' for density functions or '_lpmf' for mass functions

Error in eval(substitute(expr), envir, enclos) : 
  variable does not exist; processing stage=data initialization; variable name=t; base type=int
In addition: Warning messages:
1: In readLines(file, warn = TRUE) :
  incomplete final line found on 'C:\Users\cathy\Desktop\work\baye.stan'
2: In is.na(x) : is.na() applied to non-(list or vector) of type 'closure'
3: In FUN(X[[i]], ...) : data with name t is not numeric and not used
failed to create the sampler; sampling not done


Thanks!

Jie Liu
baye.stan
data.dat
datax.dat
stan code.R

Bob Carpenter

unread,
Sep 20, 2016, 3:06:34 PM9/20/16
to stan-...@googlegroups.com
I don't have much to add to what the messages say:

1. binomial_log is deprecated

2. you didn't define the variable t in your inits

Usually Stan is fine initializing randomly on its own and you should
only use custom initialization if random inits fail to converge.

- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> <baye.stan><data.dat><datax.dat><stan code.R>

Ben Goodrich

unread,
Sep 20, 2016, 3:25:35 PM9/20/16
to Stan users mailing list
On Tuesday, September 20, 2016 at 3:06:34 PM UTC-4, Bob Carpenter wrote:
I don't have much to add to what the messages say:

1.  binomial_log is deprecated

2.  you didn't define the variable t in your inits

Usually Stan is fine initializing randomly on its own and you should
only use custom initialization if random inits fail to converge.

Actually, it is objecting that the symbol named t that it found is not numeric when trying to pass it to the data block. Perhaps this is because the variable is named t[] in data.dat.

Also, there should be a blank line at the end of the Stan program.

Ben

jie liu

unread,
Sep 20, 2016, 3:52:29 PM9/20/16
to stan-...@googlegroups.com
Hi Bob,

Thanks for your response. I am a new user for Stan. Could you please let me know how to fix it?

Jie Liu


On Tue, Sep 20, 2016 at 3:05 PM, Bob Carpenter <ca...@alias-i.com> wrote:
I don't have much to add to what the messages say:

1.  binomial_log is deprecated

2.  you didn't define the variable t in your inits

Usually Stan is fine initializing randomly on its own and you should
only use custom initialization if random inits fail to converge.

- Bob


> On Sep 20, 2016, at 2:47 PM, jie liu <cathy...@gmail.com> wrote:
>
> Hi All,
>
> Could you please help me to check there messages that shows after I run fit<-stan(file.choose(),iter=1000,chains=2):
>
>
> DIAGNOSTIC(S) FROM PARSER:
> Warning: Deprecated function 'binomial_log'; please replace suffix '_log' with '_lpdf' for density functions or '_lpmf' for mass functions
>
> Error in eval(substitute(expr), envir, enclos) :
>   variable does not exist; processing stage=data initialization; variable name=t; base type=int
> In addition: Warning messages:
> 1: In readLines(file, warn = TRUE) :
>   incomplete final line found on 'C:\Users\cathy\Desktop\work\baye.stan'
> 2: In is.na(x) : is.na() applied to non-(list or vector) of type 'closure'
> 3: In FUN(X[[i]], ...) : data with name t is not numeric and not used
> failed to create the sampler; sampling not done
>
>
> Thanks!
>
> Jie Liu
>
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> <baye.stan><data.dat><datax.dat><stan code.R>

--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/asW31iFlCjk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.

Ben Goodrich

unread,
Sep 20, 2016, 4:06:19 PM9/20/16
to Stan users mailing list
On Tuesday, September 20, 2016 at 3:52:29 PM UTC-4, jie liu wrote:
Thanks for your response. I am a new user for Stan. Could you please let me know how to fix it?

It is best to pass all objects declared in the data block of a Stan program as elements of a named list in R to the data argument of stan(). That will fix the error.

Also, it is better to not use deprecated functions and to end your Stan program with a new line, which will avoid the other warnings.

Ben


 
Reply all
Reply to author
Forward
0 new messages