Skip to content

Commit

Permalink
Rel 10.6.0 - Added test for Cholesky factor cov
Browse files Browse the repository at this point in the history
  • Loading branch information
goedman committed Jan 16, 2024
1 parent 6fa4aa7 commit dcc6b3c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Examples/Bernoulli/bernoulli2.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
######### Stan program example ###########

using StanSample
using StanSample, DataFrames

function duplicate_tmpdir_for_windows_only(sm)

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
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
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ examples = [
"Examples-Test-Cases/MatrixInput/input_dict_symbol.jl",
"Examples-Test-Cases/MatrixInput/input_dict_string.jl",
"Examples-Test-Cases/MatrixInput/input_nt.jl",
"Examples-Test-Cases/Cholesky-factor-cov/test_cholesky_factor_cov.jl",

"Examples-Stan-Methods/Generate_Quantities/generate_quantities.jl",
"Examples-Stan-Methods/Parse_and_Interpolate/parse.jl",
Expand Down

0 comments on commit dcc6b3c

Please sign in to comment.