Skip to content

Commit

Permalink
Merge pull request #221 from flatironinstitute/tests/rhat-ess
Browse files Browse the repository at this point in the history
Add tests for ess and R-hat based on Stan's
  • Loading branch information
WardBrian authored Oct 2, 2024
2 parents 223463e + 057f974 commit 7f6b8ff
Show file tree
Hide file tree
Showing 5 changed files with 2,309 additions and 0 deletions.
17 changes: 17 additions & 0 deletions gui/test/app/util/stan_stats/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import stanCSV1 from "./data/stan1.csv?raw";
import stanCSV2 from "./data/stan2.csv?raw";

const parseCSV = (csv: string): number[][] => {
let lines = csv.split("\n");
lines = lines.filter((l) => l.trim() && !l.trimStart().startsWith("#"));
lines.shift(); // remove header
const data = lines.map((line) => {
return line.split(",").map((value) => parseFloat(value));
});
// transpose
const dataT = data[0].map((_, i) => data.map((row) => row[i]));
return dataT;
};

export const data1 = parseCSV(stanCSV1);
export const data2 = parseCSV(stanCSV2);
Loading

0 comments on commit 7f6b8ff

Please sign in to comment.