Added stdev to table of stats, when needed
This commit is contained in:
parent
079553cd71
commit
d125664e57
|
@ -153,6 +153,7 @@ type SummaryTableProps = {
|
||||||
|
|
||||||
const SummaryTable: React.FC<SummaryTableProps> = ({ distribution }) => {
|
const SummaryTable: React.FC<SummaryTableProps> = ({ distribution }) => {
|
||||||
const mean = distribution.mean();
|
const mean = distribution.mean();
|
||||||
|
const stdev = distribution.stdev();
|
||||||
const p5 = distribution.inv(0.05);
|
const p5 = distribution.inv(0.05);
|
||||||
const p10 = distribution.inv(0.1);
|
const p10 = distribution.inv(0.1);
|
||||||
const p25 = distribution.inv(0.25);
|
const p25 = distribution.inv(0.25);
|
||||||
|
@ -161,6 +162,9 @@ const SummaryTable: React.FC<SummaryTableProps> = ({ distribution }) => {
|
||||||
const p90 = distribution.inv(0.9);
|
const p90 = distribution.inv(0.9);
|
||||||
const p95 = distribution.inv(0.95);
|
const p95 = distribution.inv(0.95);
|
||||||
|
|
||||||
|
const hasResult = (x: result<number, distributionError>): boolean =>
|
||||||
|
x.tag === "Ok";
|
||||||
|
|
||||||
const unwrapResult = (
|
const unwrapResult = (
|
||||||
x: result<number, distributionError>
|
x: result<number, distributionError>
|
||||||
): React.ReactNode => {
|
): React.ReactNode => {
|
||||||
|
@ -180,6 +184,7 @@ const SummaryTable: React.FC<SummaryTableProps> = ({ distribution }) => {
|
||||||
<thead className="bg-slate-50">
|
<thead className="bg-slate-50">
|
||||||
<tr>
|
<tr>
|
||||||
<TableHeadCell>{"Mean"}</TableHeadCell>
|
<TableHeadCell>{"Mean"}</TableHeadCell>
|
||||||
|
{hasResult(stdev) && <TableHeadCell>{"Stdev"}</TableHeadCell>}
|
||||||
<TableHeadCell>{"5%"}</TableHeadCell>
|
<TableHeadCell>{"5%"}</TableHeadCell>
|
||||||
<TableHeadCell>{"10%"}</TableHeadCell>
|
<TableHeadCell>{"10%"}</TableHeadCell>
|
||||||
<TableHeadCell>{"25%"}</TableHeadCell>
|
<TableHeadCell>{"25%"}</TableHeadCell>
|
||||||
|
@ -192,6 +197,7 @@ const SummaryTable: React.FC<SummaryTableProps> = ({ distribution }) => {
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<Cell>{unwrapResult(mean)}</Cell>
|
<Cell>{unwrapResult(mean)}</Cell>
|
||||||
|
{hasResult(stdev) && <Cell>{unwrapResult(stdev)}</Cell>}
|
||||||
<Cell>{unwrapResult(p5)}</Cell>
|
<Cell>{unwrapResult(p5)}</Cell>
|
||||||
<Cell>{unwrapResult(p10)}</Cell>
|
<Cell>{unwrapResult(p10)}</Cell>
|
||||||
<Cell>{unwrapResult(p25)}</Cell>
|
<Cell>{unwrapResult(p25)}</Cell>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user