<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1.0"
>
<
title
>The Inverse t-Distribution Calculator</
title
>
<
link
href
=
rel
=
"stylesheet"
>
</
head
>
<
body
class
=
"bg-gray-100"
>
<
h1
class="text-center text-3xl
font-bold my-8">
Inverse t-Distribution Calculator
</
h1
>
<
div
class="max-w-md mx-auto border
border-green-500 p-8
rounded-lg shadow-md">
<
form
class
=
"mb-6"
>
<
div
class
=
"mb-4"
>
<
label
for
=
"prob"
class
=
"block text-gray-700"
>
Probability (p):
</
label
>
<
input
type
=
"number"
id
=
"prob"
step
=
"0.01"
min
=
"0"
max
=
"1"
class="w-full px-4 py-2 border
rounded-md focus:outline-none
focus:border-blue-500">
</
div
>
<
div
class
=
"mb-4"
>
<
label
for
=
"dof"
class
=
"block text-gray-700"
>
Degrees of Freedom (DOF):
</
label
>
<
input
type
=
"number"
id
=
"dof"
class="w-full px-4 py-2 border
rounded-md focus:outline-none
focus:border-blue-500">
</
div
>
<
div
class
=
"flex justify-center space-x-4"
>
<
button
type
=
"button"
onclick
=
"inverseT()"
class="w-1/2 bg-green-500 text-white
py-2 px-4 rounded-md
hover:bg-green-600 focus:outline-none
focus:bg-green-600">
Calculate
</
button
>
<
button
type
=
"button"
onclick
=
"clearFields()"
class="w-1/2 bg-gray-500 text-white
py-2 px-4 rounded-md hover:bg-gray-600
focus:outline-none focus:bg-gray-600">
Clear
</
button
>
</
div
>
</
form
>
<
div
id
=
"result"
class="text-center font-bold
text-lg text-green-500">
</
div
>
</
div
>
<
script
src
=
</
script
>
<
script
>
function fun(p, DOF) {
if (p <
0
|| p > 1) {
return "Probability value (p) must be between 0 and 1.";
}
const result = jStat.studentt.inv(p, DOF);
return result;
}
function inverseT() {
const probInput = document.getElementById("prob");
const DOF = document.getElementById("dof");
const ans = document.getElementById("result");
const prob = parseFloat(probInput.value);
const dof = parseInt(DOF.value);
if (!prob || !dof) {
ans.textContent =
"Please enter both probability and degrees of freedom.";
return;
}
const inverseT = fun(prob, dof);
if (typeof inverseT === 'number' && !isNaN(inverseT)) {
ans.textContent =
`Inverse t-distribution for p=${prob}
and DOF=${dof}: ${inverseT}`;
} else {
ans.textContent = inverseT;
}
}
function clearFields() {
document.getElementById("prob").value = "";
document.getElementById("dof").value = "";
document.getElementById("result").textContent = "";
}
</
script
>
</
body
>
</
html
>