Hi,I have some strange problem with truncated data model from user guide. It is not producing expected estimation of any parameters neither mu nor sigma. My testing procedure is as follows.1. Prepare random vector of observations from normal random generator with parameters (mean=0, sigma =1).2. Next truncate data when it is greater than 0.3. Compile and fit model.4. Instead of expecting estimations near real values I get mu=-0.8, sigma=0.5.My code in R is:library(rstan)model_code <- 'data {int<lower=0> N;real U;real<upper=U> y[N];}parameters{real mu;real<lower=0> sigma;}model {for (n in 1:N)y[n] ~ normal(mu,sigma) T[,U];}'real_data<- rnorm(200)truncated_data<-real_data[which(real_data<0)]data <- list(N = length(truncated_data),U=0, y = truncated_data)fit <- stan(model_code = model_code, data = data)print(fit)
Could you suggest what am I doing wrong or how can I achieve better estimations?regards,Marek Smigielski
Use a specialised algorithm to get log normals.
[forgive me if I am preaching to the converted]
Garsaglia has done some interesting work in this area 'Evaluating the Normal Distribution' in JSS.
But even that was nowhere near enough for my tails, so I used the concept and wrote my own approximation. I was more interested in speed than accuracy.
You can get some ideas from that paper how to get log cum norm approximations at extreme tails.
On Tue, Sep 4, 2012 at 6:05 PM, Ben Goodrich <goodri...@gmail.com> wrote:
> On Tuesday, September 4, 2012 3:15:09 PM UTC-4, Bob Carpenter wrote:
>>
>> If you only see a few, as you did here, it's not
>> a problem. We're also working on making that
>> clear by changing "Error" to "Warning" in the report.
>> (What would be really nice is to link them back to
>> a line of the Stan source, but that's MUCH trickier
>> and not on our short-term to-do list.)
>
>
> Can you metaprogram a call to git grep -n $WARNING inside the C++ source?
>
No. git is not on the list of requirements for Stan.
What would that line accomplish? Perhaps we can find another way to do
the same thing.