Nested Dichotomous Data¶
Quickstart¶
To run a nested dichotomous dataset:
import pybmds
dataset = pybmds.NestedDichotomousDataset(
name="Nested Dataset",
dose_units="ppm",
doses= [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
100, 100, 100, 100, 100, 100, 100, 100, 100
],
litter_ns = [
16, 9, 15, 14, 13, 9, 10, 14, 10, 11,
14, 9, 14, 9, 13, 12, 10, 10, 11, 14,
11, 11, 14, 11, 10, 11, 10, 15, 7, 14,
11, 14, 12, 13, 12, 14, 11, 8, 10
],
incidences = [
1, 1, 2, 3, 3, 0, 2, 2, 1, 2,
4, 5, 6, 2, 6, 3, 1, 2, 4, 3,
4, 5, 5, 4, 5, 4, 5, 6, 2, 4,
6, 6, 8, 7, 8, 6, 6, 5, 4
],
litter_covariates = [
16, 9, 15, 14, 13, 9, 10, 14, 10, 11,
14, 9, 14, 9, 13, 12, 10, 10, 11, 14,
11, 11, 14, 11, 10, 11, 10, 15, 7, 14,
11, 14, 12, 13, 12, 14, 11, 8, 10
]
)
# create a BMD session
session = pybmds.Session(dataset=dataset)
# add all default models
session.add_default_models()
# execute the session
session.execute()
# recommend a best-fitting model
session.recommend()
if session.recommended_model is not None:
display(session.recommended_model.plot())
print(session.recommended_model.text())
# save excel report
df = session.to_df()
df.to_excel("output/nd-report.xlsx")
# save to a word report
report = session.to_docx()
report.save("output/nd-report.docx")
Nested Logistic (lsc+ilc+) Model
══════════════════════════════
Version: pybmds 24.1 (bmdscore 24.1)
Input Summary:
╒══════════════════════════════╤═══════════════════════╕
│ BMR │ 10% Extra Risk │
│ Confidence Level (one sided) │ 0.95 │
│ Litter Specific Covariate │ Overall Mean (11.692) │
│ Intralitter Correlation │ Estimate │
│ Estimate Background │ True │
│ Bootstrap Runs │ 3 │
│ Bootstrap Iterations │ 1000 │
│ Bootstrap Seed │ 784 │
╘══════════════════════════════╧═══════════════════════╛
Modeling Summary:
╒════════════════╤═════════════╕
│ BMD │ 12.9553 │
│ BMDL │ 9.64347 │
│ BMDU │ 19.433 │
│ AIC │ 546.957 │
│ P-Value │ 0.996667 │
│ d.f. │ 35 │
│ Chi² │ 19.6089 │
│ Log-Likelihood │ -269.479 │
╘════════════════╧═════════════╛
Model Parameters:
╒════════╤═════════════╕
│ a │ 0.0847489 │
│ b │ -4.11365 │
│ theta1 │ 0.00476225 │
│ theta2 │ -0.0551719 │
│ rho │ 1 │
│ phi1 │ 0 │
│ phi2 │ 0 │
│ phi3 │ 0 │
│ phi4 │ 0 │
╘════════╧═════════════╛
Bootstrap Runs:
╒══════════╤═══════════╤═════════╤═════════╤═════════╤═════════╕
│ Run │ P-Value │ 50th │ 90th │ 95th │ 99th │
╞══════════╪═══════════╪═════════╪═════════╪═════════╪═════════╡
│ 1 │ 0.994 │ 39.2595 │ 51.0415 │ 54.7657 │ 61.1638 │
│ 2 │ 0.997 │ 37.7284 │ 49.5482 │ 52.5202 │ 59.9897 │
│ 3 │ 0.999 │ 38.6942 │ 50.5892 │ 55.1753 │ 62.3735 │
│ Combined │ 0.996667 │ 38.4892 │ 50.512 │ 53.9524 │ 61.0603 │
╘══════════╧═══════════╧═════════╧═════════╧═════════╧═════════╛
Scaled Residuals (for dose group nearest the BMD):
╒══════════════════════════════╤═══════════╕
│ Minimum scaled residual │ -0.314826 │
│ Minimum ABS(scaled residual) │ 0.314826 │
│ Average scaled residual │ -0.314826 │
│ Average ABS(scaled residual) │ 0.314826 │
│ Maximum scaled residual │ -0.314826 │
│ Maximum ABS(scaled residual) │ 0.314826 │
╘══════════════════════════════╧═══════════╛
Litter Data:
╒════════╤═══════╤══════════════╤════════════╤════════════╤════════════╤═══════════════════╕
│ Dose │ LSC │ Est. Prob. │ Litter N │ Expected │ Observed │ Scaled Residual │
╞════════╪═══════╪══════════════╪════════════╪════════════╪════════════╪═══════════════════╡
│ 0 │ 9 │ 0.127609 │ 9 │ 1.14848 │ 0 │ -1.14738 │
│ 0 │ 9 │ 0.127609 │ 9 │ 1.14848 │ 1 │ -0.14834 │
│ 0 │ 10 │ 0.132371 │ 10 │ 1.32371 │ 1 │ -0.302063 │
│ 0 │ 10 │ 0.132371 │ 10 │ 1.32371 │ 2 │ 0.631053 │
│ 0 │ 11 │ 0.137134 │ 11 │ 1.50847 │ 2 │ 0.430833 │
│ 0 │ 13 │ 0.146658 │ 13 │ 1.90656 │ 3 │ 0.857255 │
│ 0 │ 14 │ 0.15142 │ 14 │ 2.11989 │ 2 │ -0.0893856 │
│ 0 │ 14 │ 0.15142 │ 14 │ 2.11989 │ 3 │ 0.6562 │
│ 0 │ 15 │ 0.156183 │ 15 │ 2.34274 │ 2 │ -0.24377 │
│ 0 │ 16 │ 0.160945 │ 16 │ 2.57512 │ 1 │ -1.07157 │
│ 25 │ 9 │ 0.301387 │ 9 │ 2.71249 │ 2 │ -0.517576 │
│ 25 │ 9 │ 0.301387 │ 9 │ 2.71249 │ 5 │ 1.66174 │
│ 25 │ 10 │ 0.297691 │ 10 │ 2.97691 │ 1 │ -1.36723 │
│ 25 │ 10 │ 0.297691 │ 10 │ 2.97691 │ 2 │ -0.675631 │
│ 25 │ 11 │ 0.294329 │ 11 │ 3.23762 │ 4 │ 0.504382 │
│ 25 │ 12 │ 0.291293 │ 12 │ 3.49552 │ 3 │ -0.314826 │
│ 25 │ 13 │ 0.288578 │ 13 │ 3.75151 │ 6 │ 1.37633 │
│ 25 │ 14 │ 0.286176 │ 14 │ 4.00646 │ 3 │ -0.595141 │
│ 25 │ 14 │ 0.286176 │ 14 │ 4.00646 │ 4 │ -0.00381924 │
│ 25 │ 14 │ 0.286176 │ 14 │ 4.00646 │ 6 │ 1.17882 │
│ 50 │ 7 │ 0.433046 │ 7 │ 3.03132 │ 2 │ -0.786693 │
│ 50 │ 10 │ 0.410094 │ 10 │ 4.10094 │ 5 │ 0.578039 │
│ 50 │ 10 │ 0.410094 │ 10 │ 4.10094 │ 5 │ 0.578039 │
│ 50 │ 11 │ 0.403075 │ 11 │ 4.43383 │ 4 │ -0.266666 │
│ 50 │ 11 │ 0.403075 │ 11 │ 4.43383 │ 4 │ -0.266666 │
│ 50 │ 11 │ 0.403075 │ 11 │ 4.43383 │ 4 │ -0.266666 │
│ 50 │ 11 │ 0.403075 │ 11 │ 4.43383 │ 5 │ 0.348016 │
│ 50 │ 14 │ 0.383997 │ 14 │ 5.37596 │ 4 │ -0.756114 │
│ 50 │ 14 │ 0.383997 │ 14 │ 5.37596 │ 5 │ -0.206598 │
│ 50 │ 15 │ 0.378308 │ 15 │ 5.67462 │ 6 │ 0.173233 │
│ 100 │ 8 │ 0.572418 │ 8 │ 4.57935 │ 5 │ 0.300618 │
│ 100 │ 10 │ 0.553133 │ 10 │ 5.53133 │ 4 │ -0.974012 │
│ 100 │ 11 │ 0.543708 │ 11 │ 5.98079 │ 6 │ 0.0116311 │
│ 100 │ 11 │ 0.543708 │ 11 │ 5.98079 │ 6 │ 0.0116311 │
│ 100 │ 12 │ 0.534451 │ 12 │ 6.41342 │ 8 │ 0.918197 │
│ 100 │ 12 │ 0.534451 │ 12 │ 6.41342 │ 8 │ 0.918197 │
│ 100 │ 13 │ 0.52538 │ 13 │ 6.82994 │ 7 │ 0.0944518 │
│ 100 │ 14 │ 0.516511 │ 14 │ 7.23115 │ 6 │ -0.658439 │
│ 100 │ 14 │ 0.516511 │ 14 │ 7.23115 │ 6 │ -0.658439 │
╘════════╧═══════╧══════════════╧════════════╧════════════╧════════════╧═══════════════════╛
Nested dichotomous dataset¶
Creating a nested dichotomous dataset requires a list of doses, litter Ns, incidence, and litter covariates. All lists must have the same number of items, with the total items equal to the total number of litters.
You can also add optional attributes, such as name
, dose_name
, dose_units
, response_name
, response_units
, etc.
dataset = pybmds.NestedDichotomousDataset(
name="ChemX",
dose_name="Oral Gavage",
dose_units="mg/kg/d",
doses= [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
100, 100, 100, 100, 100, 100, 100, 100, 100
],
litter_ns = [
16, 9, 15, 14, 13, 9, 10, 14, 10, 11,
14, 9, 14, 9, 13, 12, 10, 10, 11, 14,
11, 11, 14, 11, 10, 11, 10, 15, 7, 14,
11, 14, 12, 13, 12, 14, 11, 8, 10
],
incidences = [
1, 1, 2, 3, 3, 0, 2, 2, 1, 2,
4, 5, 6, 2, 6, 3, 1, 2, 4, 3,
4, 5, 5, 4, 5, 4, 5, 6, 2, 4,
6, 6, 8, 7, 8, 6, 6, 5, 4
],
litter_covariates = [
16, 9, 15, 14, 13, 9, 10, 14, 10, 11,
14, 9, 14, 9, 13, 12, 10, 10, 11, 14,
11, 11, 14, 11, 10, 11, 10, 15, 7, 14,
11, 14, 12, 13, 12, 14, 11, 8, 10
]
)
dataset.plot()
Single model fit¶
If you want to fit only one model to your dataset, you can fit the specific model to the dataset and print the results, such as the BMD, BMDL, BMDU, p-value, AIC, etc.
For example, to execute the Nested Logistic model:
from pybmds.models import nested_dichotomous
model = nested_dichotomous.NestedLogistic(dataset)
model.execute()
model.plot()
An output report can be generated after execution:
print(model.text())
Nested Logistic (lsc+ilc+) Model
══════════════════════════════
Version: pybmds 24.1 (bmdscore 24.1)
Input Summary:
╒══════════════════════════════╤═══════════════════════╕
│ BMR │ 10% Extra Risk │
│ Confidence Level (one sided) │ 0.95 │
│ Litter Specific Covariate │ Overall Mean (11.692) │
│ Intralitter Correlation │ Estimate │
│ Estimate Background │ True │
│ Bootstrap Runs │ 3 │
│ Bootstrap Iterations │ 1000 │
│ Bootstrap Seed │ 880 │
╘══════════════════════════════╧═══════════════════════╛
Modeling Summary:
╒════════════════╤═════════════╕
│ BMD │ 12.9553 │
│ BMDL │ 9.64347 │
│ BMDU │ 19.433 │
│ AIC │ 546.957 │
│ P-Value │ 0.997667 │
│ d.f. │ 35 │
│ Chi² │ 19.6089 │
│ Log-Likelihood │ -269.479 │
╘════════════════╧═════════════╛
Model Parameters:
╒════════╤═════════════╕
│ a │ 0.0847489 │
│ b │ -4.11365 │
│ theta1 │ 0.00476225 │
│ theta2 │ -0.0551719 │
│ rho │ 1 │
│ phi1 │ 0 │
│ phi2 │ 0 │
│ phi3 │ 0 │
│ phi4 │ 0 │
╘════════╧═════════════╛
Bootstrap Runs:
╒══════════╤═══════════╤═════════╤═════════╤═════════╤═════════╕
│ Run │ P-Value │ 50th │ 90th │ 95th │ 99th │
╞══════════╪═══════════╪═════════╪═════════╪═════════╪═════════╡
│ 1 │ 0.998 │ 38.0467 │ 50.2882 │ 54.1745 │ 61.4304 │
│ 2 │ 0.998 │ 38.2679 │ 50.1188 │ 54.1846 │ 64.0975 │
│ 3 │ 0.997 │ 38.3032 │ 50.7063 │ 54.9344 │ 63.3151 │
│ Combined │ 0.997667 │ 38.1463 │ 50.2978 │ 54.2543 │ 62.4731 │
╘══════════╧═══════════╧═════════╧═════════╧═════════╧═════════╛
Scaled Residuals (for dose group nearest the BMD):
╒══════════════════════════════╤═══════════╕
│ Minimum scaled residual │ -0.314826 │
│ Minimum ABS(scaled residual) │ 0.314826 │
│ Average scaled residual │ -0.314826 │
│ Average ABS(scaled residual) │ 0.314826 │
│ Maximum scaled residual │ -0.314826 │
│ Maximum ABS(scaled residual) │ 0.314826 │
╘══════════════════════════════╧═══════════╛
Litter Data:
╒════════╤═══════╤══════════════╤════════════╤════════════╤════════════╤═══════════════════╕
│ Dose │ LSC │ Est. Prob. │ Litter N │ Expected │ Observed │ Scaled Residual │
╞════════╪═══════╪══════════════╪════════════╪════════════╪════════════╪═══════════════════╡
│ 0 │ 9 │ 0.127609 │ 9 │ 1.14848 │ 0 │ -1.14738 │
│ 0 │ 9 │ 0.127609 │ 9 │ 1.14848 │ 1 │ -0.14834 │
│ 0 │ 10 │ 0.132371 │ 10 │ 1.32371 │ 1 │ -0.302063 │
│ 0 │ 10 │ 0.132371 │ 10 │ 1.32371 │ 2 │ 0.631053 │
│ 0 │ 11 │ 0.137134 │ 11 │ 1.50847 │ 2 │ 0.430833 │
│ 0 │ 13 │ 0.146658 │ 13 │ 1.90656 │ 3 │ 0.857255 │
│ 0 │ 14 │ 0.15142 │ 14 │ 2.11989 │ 2 │ -0.0893856 │
│ 0 │ 14 │ 0.15142 │ 14 │ 2.11989 │ 3 │ 0.6562 │
│ 0 │ 15 │ 0.156183 │ 15 │ 2.34274 │ 2 │ -0.24377 │
│ 0 │ 16 │ 0.160945 │ 16 │ 2.57512 │ 1 │ -1.07157 │
│ 25 │ 9 │ 0.301387 │ 9 │ 2.71249 │ 2 │ -0.517576 │
│ 25 │ 9 │ 0.301387 │ 9 │ 2.71249 │ 5 │ 1.66174 │
│ 25 │ 10 │ 0.297691 │ 10 │ 2.97691 │ 1 │ -1.36723 │
│ 25 │ 10 │ 0.297691 │ 10 │ 2.97691 │ 2 │ -0.675631 │
│ 25 │ 11 │ 0.294329 │ 11 │ 3.23762 │ 4 │ 0.504382 │
│ 25 │ 12 │ 0.291293 │ 12 │ 3.49552 │ 3 │ -0.314826 │
│ 25 │ 13 │ 0.288578 │ 13 │ 3.75151 │ 6 │ 1.37633 │
│ 25 │ 14 │ 0.286176 │ 14 │ 4.00646 │ 3 │ -0.595141 │
│ 25 │ 14 │ 0.286176 │ 14 │ 4.00646 │ 4 │ -0.00381924 │
│ 25 │ 14 │ 0.286176 │ 14 │ 4.00646 │ 6 │ 1.17882 │
│ 50 │ 7 │ 0.433046 │ 7 │ 3.03132 │ 2 │ -0.786693 │
│ 50 │ 10 │ 0.410094 │ 10 │ 4.10094 │ 5 │ 0.578039 │
│ 50 │ 10 │ 0.410094 │ 10 │ 4.10094 │ 5 │ 0.578039 │
│ 50 │ 11 │ 0.403075 │ 11 │ 4.43383 │ 4 │ -0.266666 │
│ 50 │ 11 │ 0.403075 │ 11 │ 4.43383 │ 4 │ -0.266666 │
│ 50 │ 11 │ 0.403075 │ 11 │ 4.43383 │ 4 │ -0.266666 │
│ 50 │ 11 │ 0.403075 │ 11 │ 4.43383 │ 5 │ 0.348016 │
│ 50 │ 14 │ 0.383997 │ 14 │ 5.37596 │ 4 │ -0.756114 │
│ 50 │ 14 │ 0.383997 │ 14 │ 5.37596 │ 5 │ -0.206598 │
│ 50 │ 15 │ 0.378308 │ 15 │ 5.67462 │ 6 │ 0.173233 │
│ 100 │ 8 │ 0.572418 │ 8 │ 4.57935 │ 5 │ 0.300618 │
│ 100 │ 10 │ 0.553133 │ 10 │ 5.53133 │ 4 │ -0.974012 │
│ 100 │ 11 │ 0.543708 │ 11 │ 5.98079 │ 6 │ 0.0116311 │
│ 100 │ 11 │ 0.543708 │ 11 │ 5.98079 │ 6 │ 0.0116311 │
│ 100 │ 12 │ 0.534451 │ 12 │ 6.41342 │ 8 │ 0.918197 │
│ 100 │ 12 │ 0.534451 │ 12 │ 6.41342 │ 8 │ 0.918197 │
│ 100 │ 13 │ 0.52538 │ 13 │ 6.82994 │ 7 │ 0.0944518 │
│ 100 │ 14 │ 0.516511 │ 14 │ 7.23115 │ 6 │ -0.658439 │
│ 100 │ 14 │ 0.516511 │ 14 │ 7.23115 │ 6 │ -0.658439 │
╘════════╧═══════╧══════════════╧════════════╧════════════╧════════════╧═══════════════════╛
Change input settings¶
The default settings use a BMR of 10% Extra Risk and a 95% confidence interval. Settings can be edited as shown below when executing a single model:
model = nested_dichotomous.NestedLogistic(dataset, settings={
"bmr": 0.15,
"bmr_type": pybmds.DichotomousRiskType.AddedRisk
})
print(model.settings.tbl())
╒══════════════════════════════╤════════════════╕
│ BMR │ 15% Added Risk │
│ Confidence Level (one sided) │ 0.95 │
│ Litter Specific Covariate │ Overall Mean │
│ Intralitter Correlation │ Estimate │
│ Estimate Background │ True │
│ Bootstrap Runs │ 3 │
│ Bootstrap Iterations │ 1000 │
│ Bootstrap Seed │ 958 │
╘══════════════════════════════╧════════════════╛
BMR settings are similar to standard dichotomous models. Nested Dichotomous models can be run with different mdoeling settings for the Litter Specific Covariance (lsc) and the Intralitter Correlation (ilc):
from pybmds.types.nested_dichotomous import LitterSpecificCovariate, IntralitterCorrelation
model = nested_dichotomous.NestedLogistic(dataset, settings={
"litter_specific_covariate": LitterSpecificCovariate.Unused,
"intralitter_correlation": IntralitterCorrelation.Zero,
})
print(model.settings.tbl())
╒══════════════════════════════╤════════════════╕
│ BMR │ 10% Extra Risk │
│ Confidence Level (one sided) │ 0.95 │
│ Litter Specific Covariate │ Unused │
│ Intralitter Correlation │ Zero │
│ Estimate Background │ True │
│ Bootstrap Runs │ 3 │
│ Bootstrap Iterations │ 1000 │
│ Bootstrap Seed │ 659 │
╘══════════════════════════════╧════════════════╛
Choices for LitterSpecificCovariate
include:
for item in LitterSpecificCovariate:
print(f"{item.name}: {item.value}")
Unused: 0
OverallMean: 1
ControlGroupMean: 2
Choices for IntralitterCorrelation
include:
for item in IntralitterCorrelation:
print(f"{item.name}: {item.value}")
Zero: 0
Estimate: 1
Change parameter settings¶
To preview initial parameter settings:
model = nested_dichotomous.NestedLogistic(dataset)
print(model.priors_tbl())
╒═════════════╤═══════════╤═══════╤════════╕
│ Parameter │ Initial │ Min │ Max │
╞═════════════╪═══════════╪═══════╪════════╡
│ a │ 0 │ 0 │ 1 │
│ b │ 0 │ -18 │ 18 │
│ theta1 │ 0 │ 0 │ 1 │
│ theta2 │ 0 │ -18 │ 18 │
│ rho │ 0 │ 1 │ 18 │
│ phi1 │ 0 │ 0 │ 1e+06 │
│ phi2 │ 0 │ 0 │ 1e+06 │
│ phi3 │ 0 │ 0 │ 1e+06 │
│ phi4 │ 0 │ 0 │ 1e+06 │
╘═════════════╧═══════════╧═══════╧════════╛
Initial parameter settings can also can be modified:
model.settings.priors.update('a', initial_value=2, min_value=-10, max_value=10)
model.settings.priors.update('phi1', initial_value=10, min_value=5, max_value=100)
print(model.priors_tbl())
╒═════════════╤═══════════╤═══════╤═════════╕
│ Parameter │ Initial │ Min │ Max │
╞═════════════╪═══════════╪═══════╪═════════╡
│ a │ 2 │ -10 │ 10 │
│ b │ 0 │ -18 │ 18 │
│ theta1 │ 0 │ 0 │ 1 │
│ theta2 │ 0 │ -18 │ 18 │
│ rho │ 0 │ 1 │ 18 │
│ phi1 │ 10 │ 5 │ 100 │
│ phi2 │ 0 │ 0 │ 1e+06 │
│ phi3 │ 0 │ 0 │ 1e+06 │
│ phi4 │ 0 │ 0 │ 1e+06 │
╘═════════════╧═══════════╧═══════╧═════════╛
Multiple model fit (sessions) and model recommendation¶
A Session allows for multiple different models to be executed and potentially compared for model recommendation and selection.
A common pattern may be to add multiple versions of the same model with varying settings for the litter specific covariate and intralitter correlation. In the example below, we run instances of the Nested Logistic model, with different settings:
session = pybmds.Session(dataset=dataset)
for lsc in [LitterSpecificCovariate.Unused, LitterSpecificCovariate.OverallMean]:
for ilc in [IntralitterCorrelation.Zero, IntralitterCorrelation.Estimate]:
session.add_model(
pybmds.Models.NestedLogistic,
settings={
"bmr": 0.15,
"litter_specific_covariate": lsc,
"intralitter_correlation": ilc,
}
)
session.execute()
session.plot()
Model recommendation can be enabled, and if a recommendation can be mode, you can view outputs:
session.recommend()
if session.recommended_model is not None:
display(session.recommended_model.plot())
print(session.recommended_model.text())
Nested Logistic (lsc-ilc-) Model
══════════════════════════════
Version: pybmds 24.1 (bmdscore 24.1)
Input Summary:
╒══════════════════════════════╤════════════════╕
│ BMR │ 15% Extra Risk │
│ Confidence Level (one sided) │ 0.95 │
│ Litter Specific Covariate │ Unused │
│ Intralitter Correlation │ Zero │
│ Estimate Background │ True │
│ Bootstrap Runs │ 3 │
│ Bootstrap Iterations │ 1000 │
│ Bootstrap Seed │ 318 │
╘══════════════════════════════╧════════════════╛
Modeling Summary:
╒════════════════╤═════════════╕
│ BMD │ 20.9591 │
│ BMDL │ 15.6043 │
│ BMDU │ 31.4387 │
│ AIC │ 545.311 │
│ P-Value │ 0.995333 │
│ d.f. │ 36 │
│ Chi² │ 19.9391 │
│ Log-Likelihood │ -269.656 │
╘════════════════╧═════════════╛
Model Parameters:
╒════════╤═══════════╕
│ a │ 0.144144 │
│ b │ -4.77717 │
│ theta1 │ 0 │
│ theta2 │ 0 │
│ rho │ 1 │
│ phi1 │ 0 │
│ phi2 │ 0 │
│ phi3 │ 0 │
│ phi4 │ 0 │
╘════════╧═══════════╛
Bootstrap Runs:
╒══════════╤═══════════╤═════════╤═════════╤═════════╤═════════╕
│ Run │ P-Value │ 50th │ 90th │ 95th │ 99th │
╞══════════╪═══════════╪═════════╪═════════╪═════════╪═════════╡
│ 1 │ 0.996 │ 38.2377 │ 50.4988 │ 54.8221 │ 63.0801 │
│ 2 │ 0.994 │ 38.3404 │ 51.155 │ 55.166 │ 63.2883 │
│ 3 │ 0.996 │ 38.0349 │ 50.4492 │ 54.3787 │ 62.2555 │
│ Combined │ 0.995333 │ 38.22 │ 50.7653 │ 54.5296 │ 63.0801 │
╘══════════╧═══════════╧═════════╧═════════╧═════════╧═════════╛
Scaled Residuals (for dose group nearest the BMD):
╒══════════════════════════════╤═══════════╕
│ Minimum scaled residual │ -0.327053 │
│ Minimum ABS(scaled residual) │ 0.327053 │
│ Average scaled residual │ -0.327053 │
│ Average ABS(scaled residual) │ 0.327053 │
│ Maximum scaled residual │ -0.327053 │
│ Maximum ABS(scaled residual) │ 0.327053 │
╘══════════════════════════════╧═══════════╛
Litter Data:
╒════════╤═══════╤══════════════╤════════════╤════════════╤════════════╤═══════════════════╕
│ Dose │ LSC │ Est. Prob. │ Litter N │ Expected │ Observed │ Scaled Residual │
╞════════╪═══════╪══════════════╪════════════╪════════════╪════════════╪═══════════════════╡
│ 0 │ 9 │ 0.144144 │ 9 │ 1.29729 │ 0 │ -1.23117 │
│ 0 │ 9 │ 0.144144 │ 9 │ 1.29729 │ 1 │ -0.28214 │
│ 0 │ 10 │ 0.144144 │ 10 │ 1.44144 │ 1 │ -0.397439 │
│ 0 │ 10 │ 0.144144 │ 10 │ 1.44144 │ 2 │ 0.502892 │
│ 0 │ 11 │ 0.144144 │ 11 │ 1.58558 │ 2 │ 0.355751 │
│ 0 │ 13 │ 0.144144 │ 13 │ 1.87387 │ 3 │ 0.889241 │
│ 0 │ 14 │ 0.144144 │ 14 │ 2.01801 │ 2 │ -0.013705 │
│ 0 │ 14 │ 0.144144 │ 14 │ 2.01801 │ 3 │ 0.747213 │
│ 0 │ 15 │ 0.144144 │ 15 │ 2.16215 │ 2 │ -0.119203 │
│ 0 │ 16 │ 0.144144 │ 16 │ 2.3063 │ 1 │ -0.929789 │
│ 25 │ 9 │ 0.292969 │ 9 │ 2.63672 │ 2 │ -0.466337 │
│ 25 │ 9 │ 0.292969 │ 9 │ 2.63672 │ 5 │ 1.73086 │
│ 25 │ 10 │ 0.292969 │ 10 │ 2.92969 │ 1 │ -1.34078 │
│ 25 │ 10 │ 0.292969 │ 10 │ 2.92969 │ 2 │ -0.645966 │
│ 25 │ 11 │ 0.292969 │ 11 │ 3.22266 │ 4 │ 0.514971 │
│ 25 │ 12 │ 0.292969 │ 12 │ 3.51563 │ 3 │ -0.327053 │
│ 25 │ 13 │ 0.292969 │ 13 │ 3.8086 │ 6 │ 1.33543 │
│ 25 │ 14 │ 0.292969 │ 14 │ 4.10157 │ 3 │ -0.646871 │
│ 25 │ 14 │ 0.292969 │ 14 │ 4.10157 │ 4 │ -0.0596448 │
│ 25 │ 14 │ 0.292969 │ 14 │ 4.10157 │ 6 │ 1.11481 │
│ 50 │ 7 │ 0.397703 │ 7 │ 2.78392 │ 2 │ -0.605396 │
│ 50 │ 10 │ 0.397703 │ 10 │ 3.97703 │ 5 │ 0.660963 │
│ 50 │ 10 │ 0.397703 │ 10 │ 3.97703 │ 5 │ 0.660963 │
│ 50 │ 11 │ 0.397703 │ 11 │ 4.37474 │ 4 │ -0.230857 │
│ 50 │ 11 │ 0.397703 │ 11 │ 4.37474 │ 4 │ -0.230857 │
│ 50 │ 11 │ 0.397703 │ 11 │ 4.37474 │ 4 │ -0.230857 │
│ 50 │ 11 │ 0.397703 │ 11 │ 4.37474 │ 5 │ 0.385197 │
│ 50 │ 14 │ 0.397703 │ 14 │ 5.56785 │ 4 │ -0.856159 │
│ 50 │ 14 │ 0.397703 │ 14 │ 5.56785 │ 5 │ -0.310085 │
│ 50 │ 15 │ 0.397703 │ 15 │ 5.96555 │ 6 │ 0.0181751 │
│ 100 │ 8 │ 0.53536 │ 8 │ 4.28288 │ 5 │ 0.508356 │
│ 100 │ 10 │ 0.53536 │ 10 │ 5.3536 │ 4 │ -0.858238 │
│ 100 │ 11 │ 0.53536 │ 11 │ 5.88896 │ 6 │ 0.0671306 │
│ 100 │ 11 │ 0.53536 │ 11 │ 5.88896 │ 6 │ 0.0671306 │
│ 100 │ 12 │ 0.53536 │ 12 │ 6.42431 │ 8 │ 0.912006 │
│ 100 │ 12 │ 0.53536 │ 12 │ 6.42431 │ 8 │ 0.912006 │
│ 100 │ 13 │ 0.53536 │ 13 │ 6.95967 │ 7 │ 0.0224248 │
│ 100 │ 14 │ 0.53536 │ 14 │ 7.49503 │ 6 │ -0.801135 │
│ 100 │ 14 │ 0.53536 │ 14 │ 7.49503 │ 6 │ -0.801135 │
╘════════╧═══════╧══════════════╧════════════╧════════════╧════════════╧═══════════════════╛
Select a best-fitting model¶
You may recommend a best fitting model based on a decision tree, but expert judgment is required for model selection.
You can select any model; in this example, we agree with the recommended model:
session.select(model=session.recommended_model, notes="Lowest AIC; recommended model")
Generated outputs (Excel, Word, JSON) would include model selection information.