Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1108 from andrjohns/log_prob-constrained
Update log_prob method to take constrained_params in init format
- Loading branch information
Showing
12 changed files
with
141 additions
and
78 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
params_r <- | ||
structure(c(0.5, 0.1, -1.5, -3.5, 2.6, 1.6), | ||
.Dim = c(2, 3)) | ||
theta <- 0.8 | ||
mu_vector <- | ||
c(-1.03192029533272, -0.479415242304312) | ||
mu_row_vector <- | ||
c(-1.01866970062961, 0.67699454858025) | ||
mu_array_1d <- | ||
c(2.15402112425165, 1.11815245534682) | ||
mu_matrix <- | ||
structure(c(0.176100961348628, -1.47536938928953, 2.17309623676142, -0.263993484783208), | ||
.Dim = c(2, 2)) | ||
mu_matrix_array <- | ||
structure(c(0.704803511993464, 0.596396994136899, -1.04596396482332, -0.454458757498793, -0.711702526766766, -0.80021133760908, -1.71856146447761, | ||
-0.384149678939469), | ||
.Dim = c(2, 2, 2)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
{"params_r":[[0.5, -1.5, 2.6], [0.1, -3.5, 1.6]]} | ||
{ | ||
"theta": 0.8, | ||
"mu_vector": [-1.03192029533272, -0.479415242304312], | ||
"mu_row_vector": [-1.01866970062961, 0.67699454858025], | ||
"mu_array_1d": [2.15402112425165, 1.11815245534682], | ||
"mu_matrix": [ | ||
[0.176100961348628, 2.17309623676142], | ||
[-1.47536938928953, -0.263993484783208] | ||
], | ||
"mu_matrix_array": [ | ||
[ | ||
[0.704803511993464, -0.711702526766766], | ||
[-1.04596396482332, -1.71856146447761] | ||
], | ||
[ | ||
[0.596396994136899, -0.80021133760908], | ||
[-0.454458757498793, -0.384149678939469] | ||
] | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
{"params_r":[[0.5, -1.5, 2.6], [0.1, -3.5]]} | ||
{ | ||
"theta": 0.1, | ||
"mu1" : 2.0 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
data { | ||
int<lower=0> N; | ||
int<lower=0,upper=1> y[N]; | ||
} | ||
parameters { | ||
real<lower=0,upper=1> theta; | ||
vector[2] mu_vector; | ||
row_vector[2] mu_row_vector; | ||
array[2] real mu_array_1d; | ||
matrix[2, 2] mu_matrix; | ||
array[2] matrix[2, 2] mu_matrix_array; | ||
} | ||
model { | ||
theta ~ beta(1,1); | ||
y ~ bernoulli(theta); | ||
mu_vector ~ std_normal(); | ||
mu_row_vector ~ std_normal(); | ||
to_vector(mu_array_1d) ~ std_normal(); | ||
to_vector(mu_matrix) ~ std_normal(); | ||
to_vector(mu_matrix_array[1]) ~ std_normal(); | ||
to_vector(mu_matrix_array[2]) ~ std_normal(); | ||
} | ||
generated quantities { | ||
real theta_copy = theta; | ||
int y_rep[N]; | ||
for (n in 1:N) | ||
y_rep[n] = bernoulli_rng(theta); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
params_r <- | ||
structure(c(0.5, 3.1, -1.5, -3.5, 2.6, 1.6), | ||
.Dim = c(2, 3)) | ||
params_r <- | ||
c(1.38629436111989, -1.03192029533272, -0.479415242304312, -1.01866970062961, 0.67699454858025, 2.15402112425165, 1.11815245534682, | ||
0.176100961348628, -1.47536938928953, 2.17309623676142, -0.263993484783208, 0.704803511993464, -1.04596396482332, -0.711702526766766, -1.71856146447761, | ||
0.596396994136899, -0.454458757498793, -0.80021133760908, -0.384149678939469) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
{"params_r":[[0.5, -1.5, 2.6], [3.1, -3.5, 1.6]]} | ||
{ | ||
"params_r": [1.38629436111989, -1.03192029533272, -0.479415242304312, -1.01866970062961, 0.67699454858025, 2.15402112425165, 1.11815245534682, 0.176100961348628, -1.47536938928953, 2.17309623676142, -0.263993484783208, 0.704803511993464, -1.04596396482332, -0.711702526766766, -1.71856146447761, 0.596396994136899, -0.454458757498793, -0.80021133760908, -0.384149678939469] | ||
} |