-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rel 10.6.0 - Added test for Cholesky factor cov
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ uuid = "682df890-35be-576f-97d0-3d8c8b33a550" | |
license = "MIT" | ||
desc = "Illustrate StanJulia's interface options to cmdstan" | ||
authors = ["Rob J Goedman <[email protected]>"] | ||
version = "10.5.0" | ||
version = "10.6.0" | ||
|
||
[deps] | ||
AxisKeys = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5" | ||
|
35 changes: 35 additions & 0 deletions
35
test/Examples-Test-Cases/Cholesky-factor-cov/test_cholesky_factor_cov.jl
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,35 @@ | ||
using StanSample | ||
|
||
stan_data = (N=3, nu=13, L_Psi=[1.0 0.0 0.0; 2.0 3.0 0.0; 4.0 5.0 6.0]); | ||
|
||
model_code = " | ||
data { | ||
int<lower=1> N; | ||
real<lower=N-1> nu; | ||
cholesky_factor_cov[N] L_Psi; | ||
} | ||
parameters { | ||
cholesky_factor_cov[N] L_X; | ||
} | ||
model { | ||
L_X ~ inv_wishart_cholesky(nu, L_Psi); | ||
} | ||
"; | ||
|
||
|
||
sm = SampleModel("test", model_code); | ||
rc = stan_sample(sm; data=stan_data); | ||
|
||
if success(rc) | ||
df = read_samples(sm, :dataframe) | ||
ndf = read_samples(sm, :nesteddataframe) | ||
display(ndf.L_X[1]) | ||
println() | ||
end | ||
|
||
for j in 1:5 | ||
run(pipeline(StanSample.par(sm.cmds), stdout=sm.log_file[1])); | ||
ndf = read_samples(sm, :nesteddataframe) | ||
display(ndf.L_X[1]) | ||
println() | ||
end |
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