That's great news. I'm not sure how exactly the distribution testing
framework works, but I'd be glad to help / will look into it.
Peter
On 6/2/13 12:18 AM, Daniel Lee wrote:
> I think I've got it working using our old code. More to come. We need
> to do some more testing. Peter, want to help me out? The test
> distribution tests should test fvars too.
>
> Also, I think it's not efficient and it probably could be made more
> efficient.
>
>
> Daniel
This sounds great. The other day I was thinking that we should have a test somewhere that, for each distribution,
-- specified its (f)var parameters
-- drew a large random sample from that distribution given those parameters
-- evaluated the log-likelihood given the true parameters and verified that the average score vector was sufficiently close to a zero vector
That would go a long way toward verifying that everything for that distribution is coherent.
Ben
On Sunday, June 2, 2013 12:31:53 AM UTC-4, Peter Li wrote:That's great news. I'm not sure how exactly the distribution testing
framework works, but I'd be glad to help / will look into it.
Peter
On 6/2/13 12:18 AM, Daniel Lee wrote:
> I think I've got it working using our old code. More to come. We need
> to do some more testing. Peter, want to help me out? The test
> distribution tests should test fvars too.
>
> Also, I think it's not efficient and it probably could be made more
> efficient.
>
>
> Daniel
--
?? I'm lost? What would this be used for?
# Pick population parameters
# In Stan, these would be var types rather than doubles
# although the the foo_rng() functions only take doubles I think
mu <- 0
sigma <- 1
# Generate large sample from this population
SIMS <- 100000
X <- rnorm(SIMS, mu, sigma)
# Calculate derivatives
# In Stan, this would entail evaluating the gradient of normal_log(X, mu, sigma)
# In R, I just do the gradient analytically
score <- function(x, mu, sigma) c( (x - mu) / sigma^2, (mu^2 - sigma^2 + x^2 - 2 * mu * x) / sigma^3 )
partials <- t(sapply(X, score, mu = mu, sigma = sigma))
colMeans(partials) # small because at the mode
normal_log(X, mu, sigma) is evaluated in Stan, get the inverse of the estimated information matrix, and conduct a score test. In R, this is likeI_inv <- diag(c(sigma^2 / SIMS, 2 * sigma^4 / SIMS)) # known analytically
grad <- colSums(partials)
grad %*% I_inv %*% grad # ~ chi-squared with length(grad) degrees of freedom
Good point --- you're absolutely right. And the digamma
function derivative involves a trigramma. It's turtles all the
way down.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.