Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

321 improve nomenclature for statistical outputs #2

Merged
merged 31 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
980e84a
8
hausman-gdit Dec 11, 2023
a6239cc
25a, 26, 30 comment
hausman-gdit Dec 14, 2023
ffcd742
27, 29, 33, 34, 35
hausman-gdit Dec 14, 2023
0e17626
2, 6
hausman-gdit Dec 19, 2023
ba412d0
31
hausman-gdit Dec 19, 2023
9a481bc
testfix
hausman-gdit Jan 4, 2024
40b49f1
rm comment, 31
hausman-gdit Jan 4, 2024
163f18a
3 note, 2, 5a, 12, 24, rm comment
hausman-gdit Jan 4, 2024
e7af169
js eol lf
hausman-gdit Jan 4, 2024
3e7bb42
revert MT
hausman-gdit Jan 5, 2024
2482580
Merge branch 'next' into 321-collated-nomenclature
shapiromatron Feb 5, 2024
7f1d575
Merge branch 'next' into 321-collated-nomenclature
shapiromatron Feb 8, 2024
f7c9b0f
rename percentile to cummulative probability
shapiromatron Feb 8, 2024
f885035
resize tables as needed
shapiromatron Feb 8, 2024
b04dddc
remove change
shapiromatron Feb 9, 2024
54c2e1a
fix test w/ degree symbol
shapiromatron Feb 9, 2024
9007c7f
rename log likelihood globally
shapiromatron Feb 9, 2024
eabf495
fix bug in layout
shapiromatron Feb 9, 2024
16553b0
rename scaled residual
shapiromatron Feb 9, 2024
33126af
rename DOF to d.f.
shapiromatron Feb 9, 2024
e3a8853
change Summary to Modeling Summary
shapiromatron Feb 9, 2024
f6a93e9
rename "Abs(Residual of interest)" -> "|Residual near BMD|"
shapiromatron Feb 9, 2024
cf10766
rename "Frequentist Model Results" to "Maximum Likelihood Approach Mo…
shapiromatron Feb 9, 2024
6876c7a
title case
shapiromatron Feb 9, 2024
f2b32b5
add vertical spacing
shapiromatron Feb 9, 2024
7d7a464
Change "Confidence Level" to "Confidence Level (one-sided)" globally
shapiromatron Feb 9, 2024
69126fd
add on bound footnote to UI
shapiromatron Feb 9, 2024
6e5d96f
handle goodness of fit table
shapiromatron Feb 9, 2024
417b638
use < and > instead of less than and greater than
shapiromatron Feb 9, 2024
e42856a
only show tail probability if hybrid continuous bmr
shapiromatron Feb 9, 2024
225fc6b
make format
shapiromatron Feb 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion frontend/src/components/IndividualModel/CDFTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ class CDFTable extends Component {
const {bmd_dist} = this.props;
return (
<table className="table table-sm table-bordered text-right">
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<thead>
<tr className="bg-custom text-left">
<th colSpan="2">CDF</th>
</tr>
<tr>
<th>Percentile</th>
<th>Cumulative Probability</th>
<th>BMD</th>
</tr>
</thead>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/IndividualModel/ContinuousDeviance.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class ContinuousDeviance extends Component {
</colgroup>
<thead>
<tr className="bg-custom">
<th colSpan="9">Likelihoods of Interest</th>
<th colSpan="9">Likelihoods</th>
</tr>
<tr>
<th>Model</th>
<th>Log Likelihood</th>
<th>-2* Log(Likelihood Ratio)</th>
<th># of Parameters</th>
<th>AIC</th>
</tr>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/IndividualModel/ContinuousSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ContinuousSummary extends Component {
</colgroup>
<thead>
<tr className="bg-custom">
<th colSpan="2">Summary</th>
<th colSpan="2">Modeling Summary</th>
</tr>
</thead>
<tbody>
Expand All @@ -40,7 +40,7 @@ class ContinuousSummary extends Component {
<td>{ff(results.fit.aic)}</td>
</tr>
<tr>
<td>Log Likelihood</td>
<td>-2* Log(Likelihood Ratio)</td>
<td>{ff(results.fit.loglikelihood)}</td>
</tr>
<tr>
Expand All @@ -50,7 +50,7 @@ class ContinuousSummary extends Component {
<td>{fractionalFormatter(p_value)}</td>
</tr>
<tr>
<td>Model DOF</td>
<td>Model d.f.</td>
<td>{ff(results.tests.dfs[3])}</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class ContinuousTestOfInterest extends Component {
</colgroup>
<thead>
<tr className="bg-custom text-left">
<th colSpan="4">Test of Interest</th>
<th colSpan="4">Tests of Mean and Variance Fits</th>
</tr>
<tr>
<th>Test</th>
<th>
LLR
<HelpTextPopover title="LLR" content="2 * Log(Likelihood Ratio)" />
</th>
<th>Test DOF</th>
<th>Test d.f.</th>
<th>
<i>P</i>-Value
</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class DichotomousDeviance extends Component {
</tr>
<tr>
<th>Model</th>
<th>Log Likelihood</th>
<th>-2* Log(Likelihood Ratio)</th>
<th># Parameters</th>
<th>Deviance</th>
<th>Test DOF</th>
<th>Test d.f.</th>
<th>
<i>P</i>-Value
</th>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/IndividualModel/DichotomousSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DichotomousSummary extends Component {
</colgroup>
<thead>
<tr className="bg-custom">
<th colSpan="2">Summary</th>
<th colSpan="2">Modeling Summary</th>
</tr>
</thead>
<tbody>
Expand All @@ -39,7 +39,7 @@ class DichotomousSummary extends Component {
<td>{ff(results.fit.aic)}</td>
</tr>
<tr>
<td>Log Likelihood</td>
<td>-2* Log(Likelihood Ratio)</td>
<td>{ff(results.fit.loglikelihood)}</td>
</tr>
<tr>
Expand All @@ -49,7 +49,7 @@ class DichotomousSummary extends Component {
<td>{fourDecimalFormatter(results.gof.p_value)}</td>
</tr>
<tr>
<td>Overall DOF</td>
<td>Overall d.f.</td>
<td>{ff(results.gof.df)}</td>
</tr>
<tr>
Expand Down
172 changes: 113 additions & 59 deletions frontend/src/components/IndividualModel/GoodnessFit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,87 +6,141 @@ import {Dtype} from "@/constants/dataConstants";
import {isLognormal} from "@/constants/modelConstants";
import {ff} from "@/utils/formatters";

/* eslint-disable */
const hdr_c_normal = [
"Dose", "Size", "Observed Mean", "Calculated Mean", "Estimated Mean",
"Observed SD", "Calculated SD", "Estimated SD", "Scaled Residual",
],
hdr_c_lognormal = [
"Dose", "Size", "Observed Mean", "Calculated Median", "Estimated Median",
"Observed SD", "Calculated GSD", "Estimated GSD", "Scaled Residual",
],
hdr_d = [ "Dose", "Size", "Observed", "Expected", "Estimated Probability", "Scaled Residual"];
/* eslint-enable */

@observer
class GoodnessFit extends Component {
getHeaders(dtype, settings) {
if (dtype == Dtype.CONTINUOUS || dtype == Dtype.CONTINUOUS_INDIVIDUAL) {
const headers = isLognormal(settings.disttype) ? hdr_c_lognormal : hdr_c_normal;
return [headers, [10, 10, 10, 12, 12, 12, 10, 12, 12]];
}
if (dtype == Dtype.DICHOTOMOUS) {
return [hdr_d, [17, 16, 16, 17, 17, 17]];
}
throw Error("Unknown dtype");
getDichotomousData() {
const {store} = this.props,
gof = store.modalModel.results.gof,
dataset = store.selectedDataset;
return {
headers: [
"Dose",
"N",
"Observed",
"Expected",
"Estimated Probability",
"Scaled Residual",
],
colwidths: [17, 16, 16, 17, 17, 17],
data: dataset.doses.map((dose, i) => {
return [
dose,
dataset.ns[i],
dataset.incidences[i],
ff(gof.expected[i]),
ff(gof.expected[i] / dataset.ns[i]),
ff(gof.residual[i]),
];
}),
};
}

getContinuousNormalData(dtype) {
const {store} = this.props,
gof = store.modalModel.results.gof,
dataset = store.selectedDataset,
useFF = dtype === Dtype.CONTINUOUS_INDIVIDUAL;
return {
headers: [
"Dose",
"N",
"Sample Mean",
"Model Fitted Mean",
"Sample SD",
"Model Fitted SD",
"Scaled Residual",
],
colwidths: [1, 1, 1, 1, 1, 1, 1],
data: dataset.doses.map((dose, i) => {
return [
dose,
dataset.ns[i],
useFF ? ff(gof.obs_mean[i]) : gof.obs_mean[i],
ff(gof.est_mean[i]),
useFF ? ff(gof.obs_sd[i]) : gof.obs_sd[i],
ff(gof.est_sd[i]),
ff(gof.residual[i]),
];
}),
};
}

getContinuousLognormalData(dtype) {
const {store} = this.props,
gof = store.modalModel.results.gof,
dataset = store.selectedDataset,
useFF = dtype === Dtype.CONTINUOUS_INDIVIDUAL;
return {
headers: [
"Dose",
"N",
"Sample Mean",
"Approximate Sample Median",
"Model Fitted Median",
"Sample SD",
"Approximate Sample GSD",
"Model Fitted GSD",
"Scaled Residual",
],
colwidths: [10, 10, 10, 12, 12, 12, 10, 12, 12],
data: dataset.doses.map((dose, i) => {
return [
dose,
dataset.ns[i],
useFF ? ff(gof.obs_mean[i]) : gof.obs_mean[i],
ff(gof.calc_mean[i]),
ff(gof.est_mean[i]),
useFF ? ff(gof.obs_sd[i]) : gof.obs_sd[i],
ff(gof.calc_mean[i]),
ff(gof.est_sd[i]),
ff(gof.residual[i]),
];
}),
};
}
render() {
const {store} = this.props,
settings = store.modalModel.settings,
gof = store.modalModel.results.gof,
dataset = store.selectedDataset,
{dtype} = dataset,
headers = this.getHeaders(dtype, settings);
{dtype} = dataset;

let data;
if (dtype == Dtype.DICHOTOMOUS) {
data = this.getDichotomousData();
} else {
if (isLognormal(settings.disttype)) {
data = this.getContinuousLognormalData(dtype);
} else {
data = this.getContinuousNormalData(dtype);
}
}
return (
<table className="table table-sm table-bordered text-right">
<colgroup>
{headers[1].map((d, i) => (
{data.colwidths.map((d, i) => (
<col key={i} width={`${d}%`} />
))}
</colgroup>
<thead>
<tr className="bg-custom text-left">
<th colSpan={headers[0].length}>Goodness of Fit</th>
<th colSpan={data.headers.length}>Goodness of Fit</th>
</tr>
<tr>
{headers[0].map((d, i) => (
{data.headers.map((d, i) => (
<th key={i}>{d}</th>
))}
</tr>
</thead>
<tbody>
{dtype == Dtype.CONTINUOUS || dtype == Dtype.CONTINUOUS_INDIVIDUAL
? gof.dose.map((item, i) => {
const useFF = dtype === Dtype.CONTINUOUS_INDIVIDUAL;
return (
<tr key={i}>
<td>{item}</td>
<td>{gof.size[i]}</td>
<td>{useFF ? ff(gof.obs_mean[i]) : gof.obs_mean[i]}</td>
<td>{ff(gof.calc_mean[i])}</td>
<td>{ff(gof.est_mean[i])}</td>
<td>{useFF ? ff(gof.obs_sd[i]) : gof.obs_sd[i]}</td>
<td>{ff(gof.calc_sd[i])}</td>
<td>{ff(gof.est_sd[i])}</td>
<td>{ff(gof.residual[i])}</td>
</tr>
);
})
: null}
{dtype == Dtype.DICHOTOMOUS
? dataset.doses.map((dose, i) => {
return (
<tr key={i}>
<td>{dose}</td>
<td>{dataset.ns[i]}</td>
<td>{dataset.incidences[i]}</td>
<td>{ff(gof.expected[i])}</td>
<td>{ff(gof.expected[i] / dataset.ns[i])}</td>
<td>{ff(gof.residual[i])}</td>
</tr>
);
})
: null}
{data.data.map((row, i) => {
return (
<tr key={i}>
{row.map((cell, j) => (
<td key={j}>{cell}</td>
))}
</tr>
);
})}
</tbody>
</table>
);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/IndividualModel/ModelDetailModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ModelBody extends Component {
</Col>
</Row>
<Row>
<Col xl={isDichotomous ? 8 : 10}>
<Col xl={isDichotomous ? 8 : 12}>
<GoodnessFit store={outputStore} />
</Col>
</Row>
Expand All @@ -82,7 +82,7 @@ class ModelBody extends Component {
) : null}
{isContinuous ? (
<Row>
<Col xl={6}>
<Col xl={8}>
<ContinuousDeviance store={outputStore} />
<ContinuousTestOfInterest store={outputStore} />
</Col>
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/components/IndividualModel/ModelOptionsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {getLabel} from "@/common";
import TwoColumnTable from "@/components/common/TwoColumnTable";
import {Dtype} from "@/constants/dataConstants";
import {hasDegrees} from "@/constants/modelConstants";
import {isHybridBmr} from "@/constants/optionsConstants";
import {
continuousBmrOptions,
dichotomousBmrOptions,
Expand Down Expand Up @@ -39,7 +40,7 @@ class ModelOptionsTable extends Component {
data = [
["BMR Type", getLabel(model.settings.bmr_type, dichotomousBmrOptions)],
["BMR", ff(model.settings.bmr)],
["Confidence Level", ff(1 - model.settings.alpha)],
["Confidence Level (one sided)", ff(1 - model.settings.alpha)],
hasDegrees.has(model.model_class.verbose)
? ["Degree", ff(model.settings.degree)]
: null,
Expand All @@ -53,8 +54,10 @@ class ModelOptionsTable extends Component {
["BMRF", ff(model.settings.bmr)],
["Distribution Type", getLabel(model.settings.disttype, distTypeOptions)],
["Direction", model.settings.is_increasing ? "Up" : "Down"],
["Confidence Level", 1 - ff(model.settings.alpha)],
["Tail Probability", ff(model.settings.tail_prob)],
["Confidence Level (one sided)", 1 - ff(model.settings.alpha)],
isHybridBmr(model.settings.bmr_type)
? ["Tail Probability", ff(model.settings.tail_prob)]
: null,
hasDegrees.has(model.model_class.verbose)
? ["Degree", ff(model.settings.degree)]
: null,
Expand All @@ -66,7 +69,7 @@ class ModelOptionsTable extends Component {
data = [
["BMR Type", getLabel(model.settings.bmr_type, dichotomousBmrOptions)],
["BMR", ff(model.settings.bmr)],
["Confidence Level", ff(1 - model.settings.alpha)],
["Confidence Level (one sided)", ff(1 - model.settings.alpha)],
["Bootstrap Seed", model.settings.bootstrap_seed],
["Bootstrap Iterations", model.settings.bootstrap_iterations],
[
Expand Down
Loading
Loading