Created
July 5, 2014 04:09
-
-
Save hoxo-m/9d1ded1d17bd004ecfd8 to your computer and use it in GitHub Desktop.
Stan で increment_log_prob() ref: http://qiita.com/hoxo_m/items/56a63faf29e1af4db27d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model{ | |
for(i in 1:N) | |
y[i] ~ normal(alpha + beta * x[i], s); | |
s ~ inv_gamma(0.001, 0.001); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model{ | |
for(i in 1:N) | |
increment_log_prob(-0.5 * log(2 * pi() * s^2) -0.5 * ((y[i] - (alpha + beta * x[i])))^2/s^2); | |
s ~ inv_gamma(0.001, 0.001); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model{ | |
for(i in 1:N) | |
increment_log_prob(-0.5 * log(s^2) -0.5 * ((y[i] - (alpha + beta * x[i])))^2/s^2); | |
s ~ inv_gamma(0.001, 0.001); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat | |
alpha 8.69 0.06 1.18 6.27 7.90 8.72 9.43 10.99 371 1.00 | |
beta 0.83 0.00 0.02 0.78 0.81 0.83 0.84 0.88 373 1.00 | |
s 7.01 0.01 0.17 6.66 6.91 7.01 7.12 7.33 478 1.01 | |
lp__ -2449.55 0.07 1.34 -2453.09 -2450.15 -2449.17 -2448.58 -2448.10 362 1.03 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat | |
alpha 8.83 0.05 1.11 6.66 8.09 8.86 9.56 10.93 413 1.01 | |
beta 0.83 0.00 0.02 0.78 0.81 0.82 0.84 0.87 409 1.01 | |
s 7.02 0.01 0.16 6.73 6.91 7.02 7.13 7.35 597 1.00 | |
lp__ -2449.44 0.05 1.13 -2452.24 -2450.02 -2449.18 -2448.59 -2448.09 545 1.01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat | |
alpha 8.77 0.05 1.18 6.40 7.97 8.76 9.61 11.08 480 1.00 | |
beta 0.83 0.00 0.02 0.78 0.81 0.83 0.84 0.87 477 1.01 | |
s 7.02 0.01 0.15 6.71 6.92 7.01 7.12 7.31 593 1.01 | |
lp__ -3368.42 0.05 1.17 -3371.37 -3369.02 -3368.13 -3367.55 -3367.04 527 1.00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment