Invntr
Source

All instruments

calibration_curve

Instrument calibration: unweighted or weighted least-squares straight line (or quadratic) of response against standard concentration, with residuals, R², standard errors, detection and quantitation limits (k s / slope), inverse prediction of an unknown with its confidence interval, and a lack-of-fit F test from replicate standards. Student's t and Fisher's F are computed from the incomplete beta function; no table is stored.

Field
Measurement and data
Version
0.1.0
Runs as
Compiled (Rust)
Typical run
0.05 s

Compiled from source: run sh packs/install.sh once before admitting it.

Known answers it must pass

Admission replaycalibration_curve 0.1.0 · files de1fa3b88e01…fb0a
  1. r0001exact line y = 2x + 1 (closed form): slope 2, intercept 1, residuals 0, R2 1; inverse of y0 = 8 is x0 = 3.5 exactly (rounding tolerance only)passed

    slope2 ± 2e-122lockedunder 0.01 % of the tolerance used
    intercept1 ± 1e-121lockedunder 0.01 % of the tolerance used
    max_abs_residual0 ± 1e-120lockedunder 0.01 % of the tolerance used
    residual_sd0 ± 1e-120lockedunder 0.01 % of the tolerance used
    r21 ± 1e-121lockedunder 0.01 % of the tolerance used
    x_unknown3.5 ± 3.5e-123.5lockedunder 0.01 % of the tolerance used
    lod0 ± 1e-120lockedunder 0.01 % of the tolerance used
  2. r0002five-point set worked by hand with exact fractions (Sxx=10, Sxy=98/5): b=49/25, a=11/50, SSres=11/250, s=sqrt(11/750); LOD=3.3s/b, LOQ=10s/b; t(0.975,3) from the closed-form nu=3 t cdf; x0=(7-a)/b with the textbook s_x0 (rel 1e-9: exact arithmetic; t from a root solve, rel 1e-9)passed

    slope1.96 ± 2e-091.96lockedunder 0.01 % of the tolerance used
    intercept0.22 ± 2.2e-100.22lockedunder 0.01 % of the tolerance used
    ss_residual0.044 ± 4.4e-110.044lockedunder 0.01 % of the tolerance used
    residual_sd0.121106 ± 1.2e-100.121106lockedunder 0.01 % of the tolerance used
    se_slope0.0382971 ± 3.8e-110.0382971lockedunder 0.01 % of the tolerance used
    se_intercept0.127017 ± 1.3e-100.127017lockedunder 0.01 % of the tolerance used
    r20.998856 ± 1e-090.998856lockedunder 0.01 % of the tolerance used
    lod0.203903 ± 2e-100.203903lockedunder 0.01 % of the tolerance used
    loq0.617888 ± 6.2e-100.617888lockedunder 0.01 % of the tolerance used
    t_critical3.18245 ± 3.2e-093.18245lockedunder 0.01 % of the tolerance used
    x_unknown3.45918 ± 3.5e-093.45918lockedunder 0.01 % of the tolerance used
    s_x_unknown0.0682783 ± 6.8e-110.0682783lockedunder 0.01 % of the tolerance used
    x_unknown_ci_half_width0.217292 ± 2.2e-100.217292lockedunder 0.01 % of the tolerance used
  3. r0003four standards, dof 2, unknown read twice (m=2): b=24/25, a=3/50, SSres=4/125; t(0.975,2)=0.95/sqrt(2*0.975*0.025) in closed form; x0=2.125 and s_x0 with 1/m (rel 1e-9)passed

    slope0.96 ± 9.6e-100.96lockedunder 0.01 % of the tolerance used
    intercept0.06 ± 6e-110.06lockedunder 0.01 % of the tolerance used
    residual_sd0.126491 ± 1.3e-100.126491lockedunder 0.01 % of the tolerance used
    t_critical4.30265 ± 4.3e-094.30265lockedunder 0.01 % of the tolerance used
    x_unknown2.125 ± 2.1e-092.125lockedunder 0.01 % of the tolerance used
    s_x_unknown0.119905 ± 1.2e-100.119905lockedunder 0.01 % of the tolerance used
    x_unknown_ci_low1.60909 ± 1.6e-091.60909lockedunder 0.01 % of the tolerance used
    x_unknown_ci_high2.64091 ± 2.6e-092.64091lockedunder 0.01 % of the tolerance used
  4. r0004weighted line, weights 4:3:2:1 rescaled to sum n (exact fractions): xbar_w=2, b=47/50, a=1/5, SSres_w=9/125, s_b=s/2, s_a=s sqrt(1/4+1); unknown y0=3 with weight 3 -> x0=(3-a)/b and weighted s_x0 (rel 1e-9)passed

    slope0.94 ± 9.4e-100.94lockedunder 0.01 % of the tolerance used
    intercept0.2 ± 2e-100.2lockedunder 0.01 % of the tolerance used
    residual_sd0.189737 ± 1.9e-100.189737lockedunder 0.01 % of the tolerance used
    se_slope0.0948683 ± 9.5e-110.0948683lockedunder 0.01 % of the tolerance used
    se_intercept0.212132 ± 2.1e-100.212132lockedunder 0.01 % of the tolerance used
    x_unknown2.97872 ± 3e-092.97872lockedunder 0.01 % of the tolerance used
    s_x_unknown0.232152 ± 2.3e-100.232152lockedunder 0.01 % of the tolerance used
  5. r0005lack of fit, duplicates at 3 levels: SSpe=6/100, SSlof=1/3, F(1,3)=50/3; p from F(1,3)=t(3)^2 and the closed-form nu=3 t cdf (rel 1e-9)passed

    slope1 ± 1e-091lockedunder 0.01 % of the tolerance used
    intercept0.166667 ± 1.7e-100.166667lockedunder 0.01 % of the tolerance used
    ss_pure_error0.06 ± 6e-110.06lockedunder 0.01 % of the tolerance used
    ss_lack_of_fit0.333333 ± 3.3e-100.333333lockedunder 0.01 % of the tolerance used
    lack_of_fit_f16.6667 ± 1.7e-0816.6667lockedunder 0.01 % of the tolerance used
    lack_of_fit_p0.0265479 ± 2.7e-100.0265479lockedunder 0.01 % of the tolerance used
    lack_of_fit_significant= truetruelockedexact match
  6. r0006exact quadratic y = 1 + 2x + 0.5x^2 (closed form): coefficients recovered, y0 = 11.5 inverts to the root x0 = 3; t(0.975, nu=1) = tan(0.475 pi) = 12.7062... (Cauchy, closed form)passed

    intercept1 ± 1e-101lockedunder 0.01 % of the tolerance used
    slope2 ± 2e-102lockedunder 0.01 % of the tolerance used
    quadratic0.5 ± 5e-110.5lockedunder 0.01 % of the tolerance used
    x_unknown3 ± 3e-103lockedunder 0.01 % of the tolerance used
    t_critical12.7062 ± 1.3e-0812.7062lockedunder 0.01 % of the tolerance used
  7. r0007blank-based limits on the five-point set: LOD = 3.3 x 0.05 / 1.96, LOQ = 10 x 0.05 / 1.96 (closed form, rel 1e-9)passed

    lod0.0841837 ± 8.4e-110.0841837lockedunder 0.01 % of the tolerance used
    loq0.255102 ± 2.6e-100.255102lockedunder 0.01 % of the tolerance used
7 of 7 cases passed · sandbox macos-seatbeltrecorded from the kernel in a fresh lab

Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.

Inputs

NameUnitDefaultMeaning
xConcentrations of the standards, one per reading; replicate readings repeat the concentration.
yInstrument response of each standard, paired with x.
x_unit1Unit of concentration (e.g. "mg/L"); the concentration readings carry it. "1" for arbitrary units.
y_unit1Unit of the response; the response readings carry it. "1" for arbitrary units (absorbance, counts, peak area).
modellineary = a + b x, or y = a + b x + c x^2.
weightingnoneWeights of the standards; they are rescaled so they sum to n (textbook convention).
weights1With weighting="custom": one weight per reading, e.g. 1/s_i^2.
weight_unknown1With weighting="custom": the weight of one reading of the unknown, on the scale of weights. Default: the mean weight.
y_unknownReplicate responses of the unknown sample (m of them); its concentration is read from the curve.
confidence10.95Two-sided confidence level for t intervals and the lack-of-fit test (alpha = 1 - confidence).
lod_basisresidualSigma in LOD = k_lod sigma / b: the residual standard deviation s_y/x, the standard error of the intercept, or blank_sd.
blank_sdStandard deviation of replicate blank readings, with lod_basis="blank".
k_lod13.3Detection-limit factor (ICH Q2: 3.3).
k_loq110Quantitation-limit factor (ICH Q2: 10).

Readings

NameUnitMeaning
modellinear or quadratic
equationthe fitted curve as text
intercepta
slopeb, in the unit of y per unit of x (sensitivity)
quadraticc, in the unit of y per unit of x squared; null for a line
se_intercept
se_slopein the unit of y per unit of x
se_quadraticin the unit of y per unit of x squared
slope_ci_lowin the unit of y per unit of x
slope_ci_highin the unit of y per unit of x
intercept_ci_low
intercept_ci_high
x_min
x_max
x_meanweighted mean concentration
y_meanweighted mean response
sxxweighted sum of squared deviations of x, unit of x squared
ss_residualweighted residual sum of squares, unit of y squared
residual_sds_y/x = sqrt(SS_res / (n - p))
max_abs_residual
residuals
r21
adjusted_r21
t_critical1two-sided Student t at the confidence level, n - p degrees of freedom
lod_sigma
loddetection limit k_lod sigma / |b|
loqquantitation limit k_loq sigma / |b|
y_unknown_mean
x_unknownx0 = (y0 - a) / b
s_x_unknown(s/b) sqrt(1/(m w0) + 1/n + (y0 - ybar)^2 / (b^2 Sxx))
x_unknown_ci_low
x_unknown_ci_high
x_unknown_ci_half_width
x_unknown_rel_sd_pct%
weight_unknown_scaled1
g_factor1(t s_b / b)^2; above 0.05 the symmetric interval is approximate
ss_pure_errorunit of y squared
ss_lack_of_fitunit of y squared
lack_of_fit_f1
lack_of_fit_p1
lack_of_fit_significanttrue when p < 1 - confidence; null when it cannot be tested
point_count1
level_count1
degrees_of_freedom1
df_pure_error1
df_lack_of_fit1
unknown_replicates1
points
all_okno warnings
warnings
notes
filesout/points.csv (x, y, weight, fitted, residual, standardised residual) and out/curve.csv (fit with confidence band of the mean and prediction band of a single reading)

Try the call

Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.

Terminal
MCP call